http://stackoverflow.com/q/25179243
tagged with: java
type: Question
upvote count: 4
answer count: 2
linked to: http://stackoverflow.com/q/23755563
tagged with: embedded
downvote count: 0
tagged with: restlet
score: 4
has answer: http://stackoverflow.com/a/37122337
favorite count: 0
tagged with: classnotfoundexception
tagged with: com.sun.net.httpserver
has title: com.sun.net.httpserver.HttpHandler ClassNotFound Exception on Java Embedded Runtime Environment
has body: i am trying to run restlet on an ejre. In eclipse with normal jre the code works absolutely fine, but in the ejre i get the following exception: java.lang.ClassNotFoundException: com.sun.net.httpserver.HttpHandler cannot be found I am using restlet v. 2.2.1. for jee and Java SE Embedded Runtime Environment (build 1.7.0_21-b11, headless) Java HotSpot Embedded Client VM (build 23.21-b01, mixed mode) I tried restlet v. 2.1. as mentioned in here but it did not work. Had someone a similar problem?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25186163

http://stackoverflow.com/comment/39175158
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25161861
type: AnswerComment
has text: One more question I want to put your code in my software and don't know where.

http://stackoverflow.com/comment/39070909
type: QuestionComment
has text: Ok, then i'll try out JFreeChart, do you consider to use this as the best way?
score: 0
comment on: http://stackoverflow.com/q/25106584
type: Comment

http://stackoverflow.com/comment/39164561
type: AnswerComment
type: Comment
has text: My problem is about creating JSON object in Recursive method. While still maintaining the parent child relationship.
comment on: http://stackoverflow.com/a/25157180
score: 0

http://stackoverflow.com/comment/39032923
score: 0
comment on: http://stackoverflow.com/q/25085910
type: Comment
type: QuestionComment
has text: if number = 3 then it means there are 3 products and why you are multiply number * 3 to make it 9 products and then again multiplying it with 3 after assigning to count that makes the while condition `countAt < 27`. is that you are aiming at?

http://stackoverflow.com/a/25132556
has comment: http://stackoverflow.com/comment/39119460
has body: &lt; T, N> Is not a return type. N is. private &lt;T, N&gt; N send(final T request) ↑ You have "choosen" type T by passing MyReq argument. Before returning value of marshalSendAndReceive it is being casted to N type. In your case MyResp. &lt;T,N&gt; just declares that this class/method is generic and you may specify generic input type as well ans output.
has comment: http://stackoverflow.com/comment/39119647
type: Answer
has comment: http://stackoverflow.com/comment/39119816
answers question: http://stackoverflow.com/q/25132499
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25132499
has comment: http://stackoverflow.com/comment/39119977
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/25176298
downvote count: 0
answers question: http://stackoverflow.com/q/25162856
accepted answer of: http://stackoverflow.com/q/25162856
type: Answer
has comment: http://stackoverflow.com/comment/39223609
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39223796
has body: The api-doc points out: When published in a Servlet container, the value of the application path may be overridden using a servlet-mapping element in the web.xml. Seems like this is happening if you register the RestEasy HttpServletDispatcher like this: ServletContextHandler servletHandler = new ServletContextHandler(); servletHandler.setInitParameter("javax.ws.rs.Application", "com.company.MyApplication"); servletHandler.addServlet(new ServletHolder(HttpServletDispatcher.class), "/*"); You could try to add this init-parameter: servletHandler.setInitParameter("resteasy.servlet.mapping.prefix", "/application-path");
type: AcceptedAnswer

http://stackoverflow.com/comment/39055021
comment on: http://stackoverflow.com/q/25098096
type: QuestionComment
type: Comment
score: 0
has text: This `this` keyword denotes a value that is a reference to the current object (http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.8.3)

http://stackoverflow.com/comment/39239689
comment on: http://stackoverflow.com/a/25197060
has text: I got the requirement of finger print authentication where I have a JSP page there is a button once I click that button Swing Application has to launch and take the finger print. As it is urgent for me If anyone can help me out will be appreciated much. thanks Sanjay
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39203494
type: Comment
comment on: http://stackoverflow.com/a/25178188
has text: I was hoping that spring would search for implementation of IQList that has bean annotated as a component or bean.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39176412
has text: Just wondering, have you thought about using SingalR? Assuming you're using .NET 4 or 4.5.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25163480

http://stackoverflow.com/comment/54569511
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/25169343
has text: I you have an empty list of local processes, try pressing Configure, select **HPROF jmap dump provider** and set the **-jdkhome** to your JDK installation directory (**NOT** the bin directory in it). Took me nearly an hour to find this solution.
type: Comment

http://stackoverflow.com/q/25110794
has title: Inject a singleton bean into a request scoped JAX-RS resource
type: Question
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/4347374
has answer: http://stackoverflow.com/a/25129303
has comment: http://stackoverflow.com/comment/39107116
score: 0
answer count: 2
tagged with: singleton
has comment: http://stackoverflow.com/comment/39113196
tagged with: jax-rs
favorite count: 0
tagged with: cdi
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39107240
upvote count: 1
has answer: http://stackoverflow.com/a/25112594
has comment: http://stackoverflow.com/comment/39102631
tagged with: java
has body: I am trying to inject a Singleton bean into my Request scoped JAX-RS resource. What I notice is that my Singleton's constructor is invoked on every request, which is obviously not the desired behavior. My Code artifacts are as below:- JAX-RS Resource @Path("/thing") @ManagedBean public class ThingResource { //This is desired to be Singleton @Inject @RedisThingDb private ThingDb thingDb; //This is request scoped @Inject private MyRequestScopedObj obj; @GET @Path("/{id}") @Produces("application/json") public Thing getById(@PathParam("id") String thingId) { return thingDb.findById(thingId); } } @RedisThingDb Annotation that marks it as a Singleton @Qualifier @Singleton @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER }) public @interface RedisThingDb { } Producer Code that creates the RedisDb object. @Produces @RedisThingDb public ThingDb getRedisDb() { return new RedisDb();// This should be called once, because @RedisThingDb is singleton. } RedisDb public class RedisDb implements ThingDb { public RedisDb() { logger.debug("Constructing..."); } public Thing findById(Long id){ ... } } Dependency from pom.xml (Implementation is Wildfly container) javax javaee-api 7.0 provided I am using javax.annotation.ManagedBean (@ManagedBean) annotation to turn the JAX-RS into a CDI managed bean. The @RedisThingDb annotation is marked as @Singleton. The JAX-RS resource is request scoped and has other request scoped beans injected into it.
downvote count: 1

http://stackoverflow.com/a/25098501
type: Answer
has comment: http://stackoverflow.com/comment/39055637
has comment: http://stackoverflow.com/comment/39055845
downvote count: 2
upvote count: 9
score: 7
has body: Add <addDefaultImplementationEntries>false</addDefaultImplementationEntries> to configration section of maven-jar-plugin in your pom.xml to completely remove default properties: org.apache.maven.plugins maven-jar-plugin <addDefaultImplementationEntries>false</addDefaultImplementationEntries> to customize it (remove just username): org.apache.maven.plugins maven-jar-plugin
has comment: http://stackoverflow.com/comment/39055957
has comment: http://stackoverflow.com/comment/39055707
has comment: http://stackoverflow.com/comment/39055760
answers question: http://stackoverflow.com/q/25098307

http://stackoverflow.com/a/25092299
type: Answer
has comment: http://stackoverflow.com/comment/39044769
downvote count: 0
has comment: http://stackoverflow.com/comment/39045408
has comment: http://stackoverflow.com/comment/39044639
has comment: http://stackoverflow.com/comment/39044859
score: 1
has comment: http://stackoverflow.com/comment/39045368
has body: Your min sdk is 8. Change this android:name="com.google.android.gms.maps.MapFragment" to android:name="com.google.android.gms.maps.SupportMapFragment" The metatag must be a child of Application tag in manifest. ... //rest of the code &lt;meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyB2mLtP5XYhIq1KB1TEhE60wlcDxQSeUWA" /&gt; &lt;/application&gt; You are missing one more metag tag in manifest &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; // missing You can get rid of &lt;permission android:name="com.example.map.permission.MAPS_RECEIVE" android:protectionLevel="signature"/&gt; &lt;uses-permission android:name="com.example.map.permission.MAPS_RECEIVE"/&gt;
upvote count: 1
answers question: http://stackoverflow.com/q/25092280
has comment: http://stackoverflow.com/comment/39044718
has comment: http://stackoverflow.com/comment/39044822

http://stackoverflow.com/comment/39150621
type: QuestionComment
type: Comment
has text: Short answer: Java primitive types are *not* unified/unifiable under the Object type system.
score: 2
comment on: http://stackoverflow.com/q/25149412

http://stackoverflow.com/comment/39240005
score: 0
type: Comment
type: QuestionComment
has text: yes thank you it worked. Boy I over thought that one. thanks alot!
comment on: http://stackoverflow.com/q/25195954

http://stackoverflow.com/comment/39263752
comment on: http://stackoverflow.com/a/25210192
type: Comment
has text: It is relevant for downloading data from internet. What you then do with the downloaded data is irrelevant.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39159834
has text: kb is the scanner btw, and I got it, so apparently it should be key = kb.next(); I dont get it shouldnt nextLine() work tho?
comment on: http://stackoverflow.com/q/25153390
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39065235
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25103449
has text: @N00bOverflow As the name suggests `ISO-8859-1` is an open standard, so it's encoding is defined and is the same on all platforms not just Java. Given it is incredibly simple i.e. chars 0 to 255 are bytes 0 to 255, it is pretty hard to get wrong. The only issue using it is the behaviour of chars > 255 is undefined, though on java they all get mapped to `?`
type: AnswerComment

http://stackoverflow.com/q/25092444
answer count: 2
has title: empty Edit Text gives me error for 0 value
has body: I'm developing a project and I have problem with my addition for empty EditText( unused) . If I enter a number in my editText then click the button it will show the output in the viewtext (which is right) also if you keep doing that the number will be added to the total number . BUT !! if I click the button without enter any number in my edittext . the project will be crashed showing the project has stopped ! What I want is : if I just click the button without enter any number the 0 will be added to the total number . ex.. 5 >> Button >> 5+0=5 show 5 for total >> 6 >> Button >> 6 + 5= 11 >> 0 >> Button >> 0 + 11 = 11 (&lt;&lt; KEY) My code MyActivity.java package b3du.im.myapplication; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; public class MyActivity extends ActionBarActivity { int total = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); } public void Add(View v){ TextView text1 = (TextView) findViewById(R.id.text1); EditText text2 = (EditText) findViewById(R.id.text2); int valueText2 = Integer.parseInt(text2.getText().toString()); total= Integer.parseInt(text1.getText().toString()); total += valueText2; text1.setText(Integer.toString(total)); text2.setText(""); } } activity_my.xml &lt;LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="center" &gt; &lt;TextView android:layout_width="50dp" android:layout_height="wrap_content" android:inputType="phone" android:ems="10" android:id="@+id/text1" android:layout_marginTop="20dp" android:layout_marginBottom="20dp" android:text="0" android:textSize="30dp" android:gravity="center" /&gt; &lt;EditText android:layout_width="50dp" android:layout_height="wrap_content" android:inputTy…
tagged with: android
has answer: http://stackoverflow.com/a/25092463
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25092486
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25092486
possible better answer: http://stackoverflow.com/a/25092463
has comment: http://stackoverflow.com/comment/39044647
score: 0

http://stackoverflow.com/comment/39239686
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25197471
has text: I did that however, now it said main is a static method, so the arraylist should be static as well. Did that as well but still gives the error "Cannot find symbol, symbol: variable temp, location: class Logs"
type: AnswerComment

http://stackoverflow.com/comment/49461883
type: Comment
score: 0
type: AnswerComment
has text: Hello sau, Please can you elaborate which part are you stuck in?? As per my experience, the issue would be in the ceritificate creation only.. FYI, i have implemented this in java platform. Please mention all your steps as iOS device calls mdm server in several number of phases. which phase are you stuck in?? Have you followed all steps i mentioned above in the solution??
comment on: http://stackoverflow.com/a/25307313

http://stackoverflow.com/a/25171018
type: Answer
accepted answer of: http://stackoverflow.com/q/25170921
has body: You should do this: int amount = getAllRed(arena).size(); Random rnd = new Random(); for (int fi = 1; fi &lt;= 1; fi++) { int i = rnd.nextInt(amount); return getAllRed(arena).get(i); } rnd.nextInt(amount) will return an int in the range [0, amount). (That's 0, inclusive and amount, exclusive.) However, you really shouldn't call getAllRed(arena) multiple times. (I don't know if the function is functionally pure or not.) // assuming that getAllRed(arena) returns a List&lt;MyType&gt; List&lt;MyType&gt; allRed = getAllRed(arena); Random rnd = new Random(); for (int fi = 1; fi &lt;= 1; fi++) return allRed.get(rnd.nextInt(allRed.size())); Another note is that return will break out of the for loop, so there's no point in even having it: // assuming that getAllRed(arena) returns a List&lt;MyType&gt; List&lt;MyType&gt; allRed = getAllRed(arena); Random rnd = new Random(); return allRed.get(rnd.nextInt(allRed.size())); Yet another note is that your Random rnd should be kept somewhere global so that it won't be reseeded every time you use this function (perhaps with the same seed every time, which would make this not be random).
has comment: http://stackoverflow.com/comment/39191255
has comment: http://stackoverflow.com/comment/39191232
has comment: http://stackoverflow.com/comment/39191216
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25170921

http://stackoverflow.com/comment/39133911
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25134665
has text: I have very messed business logic. I novice at this code. But I should to understand affection one parameter in request on another code
score: 0

http://stackoverflow.com/q/25161036
has comment: http://stackoverflow.com/comment/39171503
has answer: http://stackoverflow.com/a/25161231
favorite count: 0
has title: How to use timer in java without using thread?
answer count: 5
has comment: http://stackoverflow.com/comment/39171338
has comment: http://stackoverflow.com/comment/39171845
has comment: http://stackoverflow.com/comment/39171271
has answer: http://stackoverflow.com/a/25161250
has comment: http://stackoverflow.com/comment/39171847
has comment: http://stackoverflow.com/comment/39171864
upvote count: 3
has comment: http://stackoverflow.com/comment/39171540
has answer: http://stackoverflow.com/a/25161161
has comment: http://stackoverflow.com/comment/39171337
has comment: http://stackoverflow.com/comment/39171268
type: Question
has answer: http://stackoverflow.com/a/25161791
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/25161861
has comment: http://stackoverflow.com/comment/39171521
accepted answer: http://stackoverflow.com/a/25161861
has comment: http://stackoverflow.com/comment/39171355
has comment: http://stackoverflow.com/comment/39171708
has comment: http://stackoverflow.com/comment/39171596
possible better answer: http://stackoverflow.com/a/25161250
has body: How can I make a java program wait X seconds without usingThread.sleep? public class newClass{ public static void main(String[] args){ for(int i = 0; i &lt; 10; i++){ //Wait X second System.out.println("Hello"); } } } Thanks for any help!! I need the program won't freeze while it's counting
downvote count: 0
has comment: http://stackoverflow.com/comment/39171480
has comment: http://stackoverflow.com/comment/39171312
tagged with: wait

http://stackoverflow.com/comment/39120293
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25133157
type: QuestionComment
has text: Correct! I am worried about converting from one primitive to another.

http://stackoverflow.com/a/25211099
type: Answer
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39270197
answers question: http://stackoverflow.com/q/25156890
has comment: http://stackoverflow.com/comment/39270089
has body: You usually install following architecture: LB -> 2xIHS -> NxWAS where LB - is a Load Balancer - it can be a hardware one or, if customer doesn't have any balancer you can use software Load Balancer from Edge components package from WebSphere Network Deployment edition. LB should also be highly available. The software one provider with WAS ND works in Active/Standby mode, where standby node monitors active one and takes over, when it fails. IHS - is IBM Http Server, with Plugin installed - you usually install at least 2 to have HA. Plugin handles session affinity and reroutes, if any of WAS servers is down. Because Plugin handles that LB can be simpler and may just balance across IHS servers WAS - is WebSphere App Server - you create cluster there and install your application in the cluster.

http://stackoverflow.com/comment/39156168
type: QuestionComment
score: 0
has text: @maneesh i am changed question
comment on: http://stackoverflow.com/q/25152523
type: Comment

http://stackoverflow.com/comment/39184652
type: Comment
type: QuestionComment
score: 2
has text: How about you try a for-loop.
comment on: http://stackoverflow.com/q/25167823

http://stackoverflow.com/comment/39288233
has text: The method was originally meant to print results and that would have printed "No results" or something to that effect. And no I do not have stack trace. Not entirely sure what that is. I'm relatively new to programming.
comment on: http://stackoverflow.com/q/25223297
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25170471
has body: Consider using a JList for the right panel to take advantage of the flexible layout options and selection handling, as shown here and below. import java.awt.Component; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridLayout; import java.awt.RenderingHints; import java.awt.image.BufferedImage; import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.Icon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.ListSelectionModel; import javax.swing.UIManager; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; /** * @see https://stackoverflow.com/a/25170471/230513 */ public class ListDisplayPanel { private static final Icon icon = UIManager.getIcon("html.pendingImage"); private ListPanel listPanel = new ListPanel(); private DisplayPanel displayPanel = new DisplayPanel(); private class DisplayPanel extends JPanel { private static final int SIZE = 256; private JLabel label = new JLabel(); public DisplayPanel() { this.add(label); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); BufferedImage img = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D temp = (Graphics2D) img.getGraphics(); icon.paintIcon(this, temp, 0, 0); temp.dispose(); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.drawImage(img, 0, 0, getWidth(), getHeight(), this); } @Override public Dimension getPreferredSize() { return new Dimension(SIZE, SIZE); } } private class ListPanel extends JPanel { private static final int N = 5; private DefaultListModel dlm = new DefaultListModel(); private JList list = new JList(dlm); publ…
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25167235
has comment: http://stackoverflow.com/comment/39205548
downvote count: 0
answers question: http://stackoverflow.com/q/25167235
score: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/39244010
type: QuestionComment
has text: Analyze your query: `WHERE r.name='ADMIN' AND r.name='EMPLOYEE'` Is it possible, for a field, to have two values at the same time?
score: 1
comment on: http://stackoverflow.com/q/25199846
type: Comment

http://stackoverflow.com/q/25208160
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/39259802
has body: I am currently trying to make a naming convention. The idea behind this is parsing. Lets say I obtain an xml doc. Everything can be used once, but these 2 in the code below can be submitted several times within the xml document. It could be 1, or simply 100. This states that ItemNumber and ReceiptType will be grabbed for the first element. ItemNumber1 = eElement.getElementsByTagName("ItemNumber").item(0).getTextContent(); ReceiptType1 = eElement.getElementsByTagName("ReceiptType").item(0).getTextContent(); This one states that it will grab the second submission if they were in their twice. ItemNumber2 = eElement.getElementsByTagName("ItemNumber").item(1).getTextContent(); ReceiptType2 = eElement.getElementsByTagName("ReceiptType").item(1).getTextContent(); ItemNumber and ReceiptType must both be submitted together. So if there is 30 ItemNumbers, there must be 30 Receipt Types. However now I would like to set this in an IF statement to create variables. I was thinking something along the lines of: int cnt = 2; if (eElement.getElementsByTagName("ItemNumber").item(cnt).getTextContent();) **MAKE VARIABLE** Then make a loop which adds one to count to see if their is a third or 4th. Now here comes the tricky part..I need them set to a generated variable. Example if ItemNumber 2 existed, it would set it to String ItemNumber2 = eElement.getElementsByTagName("ItemNumber").item(cnt).getTextContent(); I do not wish to make pre-made variable names as I don't want to code a possible 1000 variables if that 1000 were to happen. KUDOS for anyone who can help or give tips on just small parts of this as in the naming convention etc. Thanks!
has answer: http://stackoverflow.com/a/25208566
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39259795
type: Question
has title: String naming convention in java
has comment: http://stackoverflow.com/comment/39259864

http://stackoverflow.com/a/25203371
answers question: http://stackoverflow.com/q/25187947
type: Answer
has body: You can always get a satisfying width using getWidth() * scale;
score: 0

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

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/25079071
tags question: http://stackoverflow.com/q/25136234
tags question: http://stackoverflow.com/q/25163950
tag name: jfreechart

http://stackoverflow.com/comment/39189522
has text: Look at the camel JMX methods. This will allow you to call stop directly on the routes etc.
comment on: http://stackoverflow.com/q/25136142
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25106425
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has title: Why is this simple jsp program is NOT running?
has comment: http://stackoverflow.com/comment/39070199
downvote count: 0
accepted answer: http://stackoverflow.com/a/25106450
tagged with: servlets
answer count: 1
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/39070176
upvote count: 2
tagged with: jsp-tags
has body: As we know every jsp program there is a servlet behind the jsp page. I have used a jsp page to make a form (its a very small form), and in the same jsp i used scriptlet tags and made a way to get the inserted form data, and display it using out.print(). but the problem is it when i run it, the form is displayed., but when i submit is, it doesn't recognize the servlet page (error coming as "The requested resource is not available"). i will put the code below., please help me friends to solve this problem. thank you. i did this in netbeans. jsp page name is- "hello.jsp" the servlet page name behind the jsp page is: "hello_jsp.java". IF...ELSE Example <% if(request.getParameter("y")!=null) { String s = request.getParameter("y"); if(s.equals("hello")){ out.print("welcome"+s); }else{ out.print("not welcome"); }} %>
has comment: http://stackoverflow.com/comment/39070243
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/39070219
has answer: http://stackoverflow.com/a/25106450

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

http://stackoverflow.com/comment/39254408
score: 0
has text: When you read a Properties file there is no need to escape the contents. Your JSON array doesn't contain numbers. Post relevant code and the Exception.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25205405

http://stackoverflow.com/q/25207581
tagged with: frequency
type: UnansweredQuestion
score: 2
tagged with: java
has title: how to get my band frequency in android with java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40056437
tagged with: gsm
has body: i'm working on a apk where i want to get the band frequency of my network, for example if my telephone is gsm i want to know if is on 850 band. I was reading in android develop but i cant find anything. Also, i was reading the android.telephony library, but i dont know if that library can help me. For now im only obtain cell id and lac. TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); GsmCellLocation cellLocation = (GsmCellLocation)telephonyManager.getCellLocation(); int cid = cellLocation.getCid(); int lac = cellLocation.getLac(); textGsmCellLocation.setText(cellLocation.toString()); textCID.setText("gsm cell id: " + String.valueOf(cid)); textLAC.setText("gsm location area code: " + String.valueOf(lac)); Thanks for your help.
tagged with: android
favorite count: 0
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/39155794
has text: Your description does not make much sense. Post your relevant code and explain what's wrong with it.
score: 0
comment on: http://stackoverflow.com/q/25152250
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25102043
has answer: http://stackoverflow.com/a/25102138
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39062093
type: Question
linked to: http://stackoverflow.com/q/6494627
has comment: http://stackoverflow.com/comment/39062268
has comment: http://stackoverflow.com/comment/39062117
answer count: 1
score: 0
has body: 08-03 11:07:48.814: I/System.out(25283): DOWNLOAD LOCATION: /Podcasts/NikolaiBegg_2013X.mp4 08-03 11:13:27.657: I/System.out(25283): CHECKED LOCATION: /Podcasts/NikolaiBegg_2013X.mp4 08-03 11:14:46.830: I/System.out(27324): Does Not Exist Locally This is an unusual situation that I find myself in. I am downloading some video file from the internet in my app, the name of which is extracted from the URL. Somehow, it always tells me that the file does not exist despite me having downloaded the file. I am downloading the file as follows, using DownloadManager.Request: // This put the download in the same Download dir the browser uses r.setDestinationInExternalPublicDir(Environment.DIRECTORY_PODCASTS, fileName); // TODO delete later System.out.println("DOWNLOAD LOCATION: " + new File(Environment.DIRECTORY_PODCASTS,fileName).getAbsolutePath()); and I check the existence of the file as existsLocally(): File f = new File(Environment.DIRECTORY_PODCASTS, fileName); System.out.println("CHECKED LOCATION: " + f.getAbsolutePath()); return f.exists(); Then why does it return false all the time? Here is my checking logic: if(existsLocally(getFileNameFromEnclosure(enclosure))){ System.out.println("Exists Locally"); }else{ System.out.println("Does Not Exist Locally"); }
tagged with: android
has title: Why does existing file does not exist?
accepted answer: http://stackoverflow.com/a/25102138
has comment: http://stackoverflow.com/comment/39062090
tagged with: file
has comment: http://stackoverflow.com/comment/39062114

http://stackoverflow.com/comment/39045711
has text: The other "let down" of JavaFX, for is, the lack of support for system look and feels. One of the greatest challenges of developing an application is use acceptance, sure, you're app might look "cool", but if all the users won't use it, what's it worth? Presenting something to use the looks familiar and functions like other applications they are use to using immediately puts you over this hump. I did this to the application I'm working (switch from metal to windows) and saw an increase of 75% of existing users and an immediate increase sales for sales (not a lot, but it was noticed)
comment on: http://stackoverflow.com/q/25092306
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25224527
has comment: http://stackoverflow.com/comment/39291180
has comment: http://stackoverflow.com/comment/39291546
has comment: http://stackoverflow.com/comment/39291020
answers question: http://stackoverflow.com/q/25224226
has comment: http://stackoverflow.com/comment/39291052
has comment: http://stackoverflow.com/comment/39290978
has comment: http://stackoverflow.com/comment/39291553
downvote count: 0
has comment: http://stackoverflow.com/comment/39291029
type: Answer
has comment: http://stackoverflow.com/comment/39291370
has comment: http://stackoverflow.com/comment/39291223
score: 1
upvote count: 1
has body: change the code to startActivity(new Intent("android.intent.action.MAIN")); In manifest file in action you have written &lt; action android:name="android.intent.action.MAIN" /> while calling the new Intent(String Action), you need to put the same action name. or you can use different signature of constructor, change the code to startActivity(new Intent(this, Main.class); in place of "this" you can use the appropriate context.

http://stackoverflow.com/comment/39114189
comment on: http://stackoverflow.com/a/25126035
score: 0
type: Comment
has text: Luke Woodward, Man you Rock.
type: AnswerComment

http://stackoverflow.com/q/25178989
score: 1
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25259689
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/37036591
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/25259689
tagged with: flying-saucer
answer count: 3
tagged with: itext
has answer: http://stackoverflow.com/a/25186696
upvote count: 1
has title: content from html missing in pdf created by iTextrenderer
linked to: http://stackoverflow.com/q/21397331
tagged with: java
has body: I am trying to create pdf from one html which has chinese char. in this i have got weird prob. the line from html which has chinese char is not completely shown in pdf generated from it. Below is my html: some title. LLTRN,DEBIT,,,6841,FXW,,CNY,PAY,C,,,,DD,,ord par nm,,,,,,,CN,百威英博雪津(三明)啤酒有限公司,,,,,,,CN,20140617,,CNY,647438.24,OUR,,,,,,,,SHANGHAI,CN,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, RDF,FTX,TEXT below is my itext renderer code: StringWriter writer = new StringWriter(); Tidy tidy = new Tidy(); tidy.setTidyMark(false); tidy.setDocType("omit"); tidy.setXHTML(true); tidy.setInputEncoding("utf-8"); tidy.setOutputEncoding("utf-8"); //tidy.parse(new StringReader(documentJsoup.toString()), writer); tidy.parse(new StringReader(inputFileString), writer); writer.close(); String pdfContent = writer.toString(); // Creating an instance of iText renderer which will be used to generate the pdf from the html document. ITextRenderer renderer = new ITextRenderer(); /*renderer.setDocument(doc, baseurl); renderer.layout(); renderer.createPDF(os); os.flush(); // close all the streams //fis.close(); //os.close(); //instream.close(); */ ITextFontResolver resolver = renderer.getFontResolver(); //renderer.getFontResolver().addFont("C:\\Windows\\Fonts\\arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); resolver.addFont("C:\\Windows\\Fonts\\arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); renderer.setDocumentFromString(pdfContent); renderer.layout(); renderer.createPDF(os); since i used font resolver and add font, chinese char are shown.... but pdf shows missing content.... last characters of that line (thats :"AI" from "shanghai" and next ",CN,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,") is not visible.... its seen something like: i tried a lot to see whats wrong but couldnt find solution. can anybody from u help me in resolving this issue pls ?? TIA!
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25186696
downvote count: 0

http://stackoverflow.com/a/28993680
has body: You can find a (non-compiling) example at easywayprogramming. I have simplified it and fixed the errors, I hope that this is a useful answer to your question. Run the server first, then run the client as often as you want. The example will take a screenshot of the upper left 200x100 pixels of your screen, send them to the server which will open a new window and display the screenshot. GreetingServer.java import java.awt.image.BufferedImage; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import java.net.SocketTimeoutException; import java.sql.SQLException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; public class GreetingServer extends Thread { private ServerSocket serverSocket; Socket server; public GreetingServer(int port) throws IOException, SQLException, ClassNotFoundException, Exception { serverSocket = new ServerSocket(port); serverSocket.setSoTimeout(180000); } public void run() { while(true) { try { server = serverSocket.accept(); BufferedImage img=ImageIO.read(ImageIO.createImageInputStream(server.getInputStream())); JFrame frame = new JFrame(); frame.getContentPane().add(new JLabel(new ImageIcon(img))); frame.pack(); frame.setVisible(true); } catch(SocketTimeoutException st) { System.out.println("Socket timed out!"); break; } catch(IOException e) { e.printStackTrace(); break; } catch(Exception ex) { System.out.println(ex); } } } public static void main(String [] args) throws IOException, SQLException, ClassNotFoundException, Exception { Thread t = new GreetingServer(6066); t.start(); } } GreetingClient.java import java.awt.AWTException; import java.awt.Image; import java.awt.Rectangle; import java.awt.Robot; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.Socket; import javax.imageio.ImageIO; public class GreetingClient { Image newimg; static BufferedImage bimg; byte[] bytes; public static void main(String [] args) { Strin…
has comment: http://stackoverflow.com/comment/82735655
answers question: http://stackoverflow.com/q/25086868
downvote count: 0
has comment: http://stackoverflow.com/comment/82757456
type: Answer
score: 6
upvote count: 6

http://stackoverflow.com/a/25168779
has comment: http://stackoverflow.com/comment/39187005
type: Answer
has comment: http://stackoverflow.com/comment/39186554
has body: If this code wasn't written by you and declares a non-public static class (side-note: it defaults to package-protected, which is very different to protected), chances are the writer intends to hide the class from your use. In short, there is no way to access the class from outside the package, and you probably shouldn't be trying to.
answers question: http://stackoverflow.com/q/25168690
score: 0
has comment: http://stackoverflow.com/comment/39186668

http://stackoverflow.com/comment/39179464
comment on: http://stackoverflow.com/q/25165047
has text: Like setting an attribute when the user logs in (removing it when he logs out) and then indeed check it on the homepage. There are a bunch of frameworks (shiro, spring security) that can do this for you by the way.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25197454
type: Answer
has comment: http://stackoverflow.com/comment/39240136
score: 1
answers question: http://stackoverflow.com/q/25197345
upvote count: 1
has comment: http://stackoverflow.com/comment/39239634
downvote count: 0
has comment: http://stackoverflow.com/comment/39252303
has comment: http://stackoverflow.com/comment/39239757
has body: This problem also happened if you have multiple version of libraries included in your build path physically. Removing the unused libraries from libs path, clean and save the project, restarts Eclipse and recompile it again. Right click on your project > go to properties > Build Path Check android-support-v4 library
has comment: http://stackoverflow.com/comment/39239912
has comment: http://stackoverflow.com/comment/39242418
has comment: http://stackoverflow.com/comment/39240001

http://stackoverflow.com/comment/39011193
has text: This question appears to be off-topic because OP's minimum effort of solving.
comment on: http://stackoverflow.com/q/25074893
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25211201
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25210596
answers question: http://stackoverflow.com/q/25210596
has comment: http://stackoverflow.com/comment/39271138
has body: Personally I think your question is too broad for a good answer especially as the format of the delimited files is possibly the most bizarre I've ever seen. The only way I can suggest is to do something similar to the way I use CSV files and simply add the column names to the file as the very first line. Example... Suppose you want to have a CSV file of contacts with uniquie id, first and last name and telephone number, you would create the file as follows... _id,first_name,last_name,phone_num 1,John,Smith,12345678 2,Bill,Jones,23456789 When processing the CSV file you would then simply treat the first line separately, split it into the column names and add those as columns in your SQLite DB table. From then on you treat each line as the data for each row. CSV traditionally stood for comma-separated variable which is what I've shown, but these days it is often used to refer to character-separated variable with any character possible for the delimiter. This is what you have with fields (columns) separated by carets (^). When adding the first line for the column names it is usual to use the same delimiter character so it can be parsed with the same code.
type: Answer
has comment: http://stackoverflow.com/comment/39265598
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39265519

http://stackoverflow.com/q/25195128
has title: How do Jetty and other containers leverage NIO while sticking to the Servlet specification?
type: AnsweredQuestion
tagged with: nonblocking
tagged with: java
tagged with: nio
tagged with: servlets
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25195392
accepted answer: http://stackoverflow.com/a/25195392
tagged with: jetty
score: 25
has body: I'm new to NIO, and I am trying to figure out how Jetty leverages NIO. My understanding of how traditional servlet containers that use Blocking IO service a request is as follows: A request arrives A thread is allocated to process the request and the servlet method (doGet etc) is invoked Servlet method is handed an InputStream and OutputStream The servlet method reads from the InputStream and writes to the OutputStream The InputStream and OutputStream are basically tied to the respective streams of the underlying Socket What is different when an NIO connector is used? My guess is along the following lines: A request arrives Jetty uses NIO connector and buffers the entire request asynchronously Once request has been read completely wrap the buffer in an InputStream Create an empty response buffer (wrapped in an OutputStream) Allocate a thread and invoke the servlet method (doGet etc) handing the above wrapper streams Servlet method writes to the wrapped (buffered) response stream and returns from the servlet method Jetty uses NIO to write the response buffer contents to the underlying SocketChannel From the Jetty documentation, I found the following: SelectChannelConnector - This connector uses efficient NIO buffers with a non-blocking threading model. Jetty uses Direct NIO buffers, and allocates threads only to connections with requests. Synchronization simulates blocking for the servlet API, and any unflushed content at the end of request handling is written asynchronously. I'm not sure I understand what Synchronization simulates blocking for the servlet API means?
upvote count: 25

http://stackoverflow.com/comment/39249788
comment on: http://stackoverflow.com/q/25203133
has text: Your class and the interface are in same package. You need not import that.
score: 0
type: Comment
type: QuestionComment

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

http://stackoverflow.com/q/25125059
favorite count: 0
has title: Java: Mocking http/https calls in unit test
tagged with: powermock
tagged with: wiremock
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25144866
score: 1
has body: I am trying to set up unit-tests in my code wherein I would like to mock the rest calls going to an external web service. I know a couple of ways to do so: Stub the methods that make the call to external webservice using PowerMock to return mock response objects. For unit tests, change the host address of the web service to point to localhost and then use the WireMock to attach to localhost and send out responses. What I want to do is not change the host address in (2) and let WireMock (or any other third party library) intercept the call to a given host and based on the call send out the response. In other words, I would like to configure WireMock in such a way that if my code is calling for instance http://www.google.com then WireMock will intercept that call and respond with something I configure. (Basically stub www.google.com).
tagged with: java
upvote count: 1
tagged with: unit-testing
type: Question
answer count: 1
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/25144866

http://stackoverflow.com/q/25137332
has comment: http://stackoverflow.com/comment/39127445
type: Question
has answer: http://stackoverflow.com/a/25137358
has answer: http://stackoverflow.com/a/25137374
has answer: http://stackoverflow.com/a/25137360
has body: I can't seem to insert my old table into the new table. Very weird Code: INSERT INTO 'newhawk_playewadwds' (`player_id`,'player') SELECT `player_id`,'player' FROM 'hawk_playewadwds'; Error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQ L server version for the right syntax to use near ''newhawk_playewadwds' (`playe r_id`,'player') SELECT `player_id`,'player' FROM 'h' at line 1 Extra info: Both tables exist and have slightly diffrent column structors (One has a varchar(50), while the other doesn't). Which is why i included the direct columns in the statement.
score: -1
has comment: http://stackoverflow.com/comment/39127468
answer count: 3
tagged with: sql
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has title: MySQL + JAVA - Can't insert a table into another
upvote count: 0
tagged with: java
tagged with: mysql

oracle-database
tags question: http://stackoverflow.com/q/25104028
tags question: http://stackoverflow.com/q/25122419
tags question: http://stackoverflow.com/q/25210540
tags question: http://stackoverflow.com/q/25115232
tags question: http://stackoverflow.com/q/25139637
tag name: oracle-database
tags question: http://stackoverflow.com/q/25208239
tags question: http://stackoverflow.com/q/25152875
tags question: http://stackoverflow.com/q/25226741
tags question: http://stackoverflow.com/q/25117318
tags question: http://stackoverflow.com/q/25197664
type: Tag
tags question: http://stackoverflow.com/q/25190219
tags question: http://stackoverflow.com/q/25214477
tags question: http://stackoverflow.com/q/25186725
tags question: http://stackoverflow.com/q/25200410
tags question: http://stackoverflow.com/q/25077423
tags question: http://stackoverflow.com/q/25160297
tags question: http://stackoverflow.com/q/25118947
tags question: http://stackoverflow.com/q/25180697
tags question: http://stackoverflow.com/q/25151472
tags question: http://stackoverflow.com/q/25141321
tags question: http://stackoverflow.com/q/25097957
tags question: http://stackoverflow.com/q/25134851
tags question: http://stackoverflow.com/q/25177460
tags question: http://stackoverflow.com/q/25104784

http://stackoverflow.com/q/25146945
has answer: http://stackoverflow.com/a/25147000
has answer: http://stackoverflow.com/a/25146996
tagged with: linked-list
has body: I am using a LinkedList and I want to get the previous (and the next) element, but not sure how to approach that. My linked list: LinkedList&lt;Transaction&gt; transactions = transactionRepository.findAll(); I am searching for this transaction: Transaction targetTransaction = new Transaction("admin", new Date(), 5); What I want to do: for (Transaction transaction : transactions) { if (transaction.equals(targetTransaction)) { System.out.println("Previous transaction: " + transaction.getPrev()); } } The transaction.getPrev() part does not work, because my Transaction object does not have such method. Question: how to correctly obtain the "previous" object from the LinkedList?
possible better answer: http://stackoverflow.com/a/25146993
has comment: http://stackoverflow.com/comment/39147522
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25146993
tagged with: java
accepted answer: http://stackoverflow.com/a/25146996
has comment: http://stackoverflow.com/comment/39146062
has comment: http://stackoverflow.com/comment/39146125
type: Question
answer count: 3
downvote count: 0
has title: How to get previous element in a LinkedList?
score: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/39146081
upvote count: 6

http://stackoverflow.com/a/25083505
accepted answer of: http://stackoverflow.com/q/25076718
has body: PROPAGATION_REQUIRED class Service { @Transactional(propagation=Propagation.REQUIRED) public void doSomething() { // access a database using a DAO } } When doSomething() is called it will start a new transaction if the caller has not already started a transaction. If the caller of this method has already started a transaction then the callers' transaction is used and no new transaction is created (i.e. there is one transaction in play). If an exception is thrown inside doSomething() then it will be rolled back, meaning that the caller will also see the transaction rolled back. When doSomething() returns the transaction will not have been commited yet. It is the caller that will commit the transaction (or possibly rolled-back). PROPAGATION_REQUIRES_NEW class Service { @Transactional(propagation=Propagation.REQUIRES_NEW) public void doSomething() { // access a database using a DAO } } When doSomething() is called it will always start a new transaction. If the caller of this method has already started a transaction (TxnOuter) then the callers' transaction is suspended and a new transaction (TxnInner) is created (i.e. there are two transactions in play). If an exception is thrown inside doSomething() then TxnInner will be rolled back, but the "suspended" transaction from the caller (TxnOuter) is unaffected. When doSomething() returns without an Exception it will commit the transaction (TxnInner). The caller's transaction (TxnOuter) will be resumed and be unaware that another transaction was commited. The caller can then commit or roll-back TxnOuter as it sees fit. The important point to note is that the Database views TxnOuter and TxnInner as completely independant transactions, and therefore two independant commits. PROPAGATION_NESTED class Service { @Transactional(propagation=Propagation.NESTED) public void doSomething() { // access a database using a DAO } } NESTED can only be used if your JDBC driver and/or database supports JDBC savepoints When doSomething() is cal…
answers question: http://stackoverflow.com/q/25076718
has comment: http://stackoverflow.com/comment/40561488
has comment: http://stackoverflow.com/comment/39039683
has comment: http://stackoverflow.com/comment/48630784
has comment: http://stackoverflow.com/comment/55117896
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/55134505
has comment: http://stackoverflow.com/comment/46077146
type: Answer
score: 115
upvote count: 115
has comment: http://stackoverflow.com/comment/55135172
has comment: http://stackoverflow.com/comment/104600005

http://stackoverflow.com/q/25101778
tagged with: binary-search-tree
tagged with: linked-list
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/39560726
has title: Convert Binary Search Tree to Doubly Linked List - not working
type: Question
has answer: http://stackoverflow.com/a/33428946
has comment: http://stackoverflow.com/comment/39061613
tagged with: algorithm
has answer: http://stackoverflow.com/a/31401069
answer count: 6
has comment: http://stackoverflow.com/comment/39061624
has body: Solution i am pasting comes from this Geek URL Its written in C, so i tried converting it in JAVA as below - (please do correct me if m wrong, i am not c/c++ person) Program // A simple recursive function to convert a given Binary tree to Doubly // Linked List // root --&gt; Root of Binary Tree // head --&gt; Pointer to head node of created doubly linked list public void BinaryTree2DoubleLinkedList(BTNodes root, BTNodes head) { if(root == null) return; // Initialize previously visited node as NULL. This is // declared outside the recursive function so that the same value // is accessible in all recursive calls prev = null; // Recursively convert left subtree BinaryTree2DoubleLinkedList(root.getLeft(), head); //set head of LL if not set if(orgHead == null) orgHead = root; // Now convert this node if (prev == null) head = root; else { root.setLeft(prev); prev.setRight(root); } prev = root; // Finally convert right subtree BinaryTree2DoubleLinkedList(root.getRight(), head); } Tree In Consideration 10 / \ 5 15 / \ / \ 2 7 12 18 / 1 / 0 Problem This program returns output : 0 1 2 5 7 10 15 18 As you can see, 12 is missing from the code.I tried to dry run it many times but still not able to find out the real issue.....I tried searching for different solutions but most of them traverse in the part-converted-LL which increases the time complexity.
has answer: http://stackoverflow.com/a/25102137
upvote count: 3
downvote count: 2
accepted answer: http://stackoverflow.com/a/25101858
has answer: http://stackoverflow.com/a/44618408
favorite count: 0
has comment: http://stackoverflow.com/comment/39061622
possible better answer: http://stackoverflow.com/a/31401069
has comment: http://stackoverflow.com/comment/39061629
has answer: http://stackoverflow.com/a/25101858
type: AnsweredQuestion

sdk
tags question: http://stackoverflow.com/q/25098990
tags question: http://stackoverflow.com/q/25149844
tags question: http://stackoverflow.com/q/25221250
tags question: http://stackoverflow.com/q/25128854
tag name: sdk
tags question: http://stackoverflow.com/q/25084066
type: Tag
tags question: http://stackoverflow.com/q/25227332
tags question: http://stackoverflow.com/q/25150168
tags question: http://stackoverflow.com/q/25073429

record
type: Tag
tag name: record
tags question: http://stackoverflow.com/q/25131656

http://stackoverflow.com/a/25132546
answers question: http://stackoverflow.com/q/25132499
type: Answer
has body: The method is parameterized with the generic parameters T and N. It takes an argument of type T and returns a reference of type N. The return type is not &lt;T,N&gt;, it is just N.
score: 0

http://stackoverflow.com/a/25084706
has body: // how can I get a Set&lt;&gt; of object of type A that implements I? You cannot guarantee both in a single generic statement. You can do something like public void addToSet(I iInstance) { if(iInstance instanceof A){ //logic to add to your set } }
upvote count: 0
answers question: http://stackoverflow.com/q/25084586
has comment: http://stackoverflow.com/comment/39030269
type: Answer
has comment: http://stackoverflow.com/comment/39029893
downvote count: 1
has comment: http://stackoverflow.com/comment/39034242
has comment: http://stackoverflow.com/comment/39029853
score: -1

http://stackoverflow.com/a/25128938
has comment: http://stackoverflow.com/comment/39116039
type: Answer
has comment: http://stackoverflow.com/comment/39113379
answers question: http://stackoverflow.com/q/25128542
has comment: http://stackoverflow.com/comment/39113305
upvote count: 1
has body: A combination of regex replace to clean up the input, then split can get the whole task done in just one line: String[] terms = input.replaceAll("(?s)^.*?:|:[^:]*$", "").split("(?s):([^:]*\\s[^:]*:)?"); This works for all your edge cases, by: removing input from head and tail (including the leading/trailing colons) splitting on a colon, optionally followed by junk and another colon the "dotall" flag (?s) makes it work over multiple lines Here's some test code: String[] inputs = { "foo:target1:bar", "foo:target1:target2:bar", "foo:target1:target2:target3:bar", "foo:target1:junk junk:target2:bar" , }; for (String input : inputs) { String[] terms = input.replaceAll("(?s)^.*?:|:[^:]*$", "").split("(?s):([^:]*\\s[^:]*:)?"); System.out.println(Arrays.toString(terms)); } Output: [target1] [target1, target2] [target1, target2, target3] [target1, target2]
score: 1
has comment: http://stackoverflow.com/comment/39113331
downvote count: 0

http://stackoverflow.com/a/25096922
has body: You have to add a getter for the price in the Drink enum. public double getPrice() { return type.getPrice(); } And then you can do: Drink cola = Drink.COLA; double price = cola.getPrice();
downvote count: 0
answers question: http://stackoverflow.com/q/25096898
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/39266380
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25211497
has text: @HotLicks what do you mean by javac compiler fakes the static reference??
score: 0

http://stackoverflow.com/a/25171436
type: Answer
has body: The code you posted is not jumping unpredictably to the default case, here is a simple proof: public class SO { public static boolean caseTest(int id) { switch (id) { case 0: System.out.println("Case 0:"); return true; default: System.out.println("Default Case:"); return false; } } public static void main(String[] args) { System.out.println("Returned:"+caseTest(0)); //Prints: //Case 0: //Returned:true System.out.println("Returned:"+caseTest(1)); //Prints: //Default Case: //Returned:false } } Now for things that could be the issue, take a look at the values of R.id.action_search and R.id.action_settings, they may not be what you think.
answers question: http://stackoverflow.com/q/25168024
score: 0

http://stackoverflow.com/comment/39092153
type: QuestionComment
comment on: http://stackoverflow.com/q/25117760
has text: @forgivenson I don't want an exact code, I just want the approach or sources to start with, as ORC is quite new to me. Thanks.
score: 0
type: Comment

http://stackoverflow.com/a/25161231
type: Answer
answers question: http://stackoverflow.com/q/25161036
has body: What you are really looking for is a multi-thread implementation. That is what will allow you to continue interacting with one area of the application while waiting for another to finish processing. Edit Ok, after further clarification in the comments, sounds like this is not what you are looking for. Perhaps you can register each child in a HashMap with the time that they started. Then monitor the map to see when time is up.
score: 0

http://stackoverflow.com/comment/39198312
has text: isnt the issue lies with factory?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25175289

http://stackoverflow.com/q/25219768
type: Question
has body: I am developing a 4 players multiplayer game (some kind of multiplayer piano-like game ;) for tablets and I would liek to use libgdx framework. However, I am not sure if it supports more than 10 fingers recognition. Ideally, I need 5 fingers/buttons for each player that can be pressed at the same time plus menu and pause button, so, let's say 20 - 25 or 30 pointers to recognize. Is this possible with libgdx. As far as I know Android can recognize up to 256 fingers at once, but what about libgdx? Btw. even though I am currently not developing for iOS, if somebody has the knowledge about the iPad side of 20 - 30 fingers recognition at the same time in libgdx, I am interested in that too.
tagged with: libgdx
tagged with: ios
has comment: http://stackoverflow.com/comment/39281441
tagged with: touch
upvote count: 1
has title: Is libgdx capable of recognizing 20 - 30 fingers at the same time?
answer count: 1
has comment: http://stackoverflow.com/comment/39281555
favorite count: 0
has answer: http://stackoverflow.com/a/25219829
type: UnansweredQuestion
tagged with: android
downvote count: 0
score: 1
tagged with: java

apache-poi
tags question: http://stackoverflow.com/q/25193045
tags question: http://stackoverflow.com/q/25130419
tags question: http://stackoverflow.com/q/25101559
tags question: http://stackoverflow.com/q/25092460
tags question: http://stackoverflow.com/q/25197874
type: Tag
tags question: http://stackoverflow.com/q/25216462
tags question: http://stackoverflow.com/q/25216403
tags question: http://stackoverflow.com/q/25093304
tags question: http://stackoverflow.com/q/25119178
tags question: http://stackoverflow.com/q/25221428
tag name: apache-poi
tags question: http://stackoverflow.com/q/25092384
tags question: http://stackoverflow.com/q/25184134
tags question: http://stackoverflow.com/q/25209613
tags question: http://stackoverflow.com/q/25230028
tags question: http://stackoverflow.com/q/25093512
tags question: http://stackoverflow.com/q/25206765
tags question: http://stackoverflow.com/q/25083958
tags question: http://stackoverflow.com/q/25225421
tags question: http://stackoverflow.com/q/25092771
tags question: http://stackoverflow.com/q/25133658
tags question: http://stackoverflow.com/q/25182090

http://stackoverflow.com/q/25149607
has title: How to get the InputStream of a file that has an absolute path and add it to a StreamedContent object in order to use it in a p:fileDownload?
has body: I have a pdf in C:/Reports/report.pdf and I need to download it using primefaces. As I have read I need to first get the InputStream of the file and use DefaultStreamedContent to get the StreamedContent but everything I tried failed. Help me please it is supposed to be easy and have had lots of problems with this. The info here uses the /resources/ web directory. I need to do that with the absolute path of the file.
type: AnsweredQuestion
tagged with: jsf
has comment: http://stackoverflow.com/comment/39156436
score: 1
tagged with: java
type: Question
tagged with: primefaces
has answer: http://stackoverflow.com/a/25159580
accepted answer: http://stackoverflow.com/a/25159580
upvote count: 2
downvote count: 1
answer count: 1
favorite count: 0
tagged with: download
has comment: http://stackoverflow.com/comment/39167567

regex
tags question: http://stackoverflow.com/q/25111268
tags question: http://stackoverflow.com/q/25120178
tags question: http://stackoverflow.com/q/25177733
tags question: http://stackoverflow.com/q/25168286
tags question: http://stackoverflow.com/q/25136496
tags question: http://stackoverflow.com/q/25129245
tags question: http://stackoverflow.com/q/25221430
tags question: http://stackoverflow.com/q/25129916
tags question: http://stackoverflow.com/q/25166449
tags question: http://stackoverflow.com/q/25138778
tags question: http://stackoverflow.com/q/25154660
tags question: http://stackoverflow.com/q/25145793
tag name: regex
tags question: http://stackoverflow.com/q/25178318
tags question: http://stackoverflow.com/q/25071344
tags question: http://stackoverflow.com/q/25184900
tags question: http://stackoverflow.com/q/25134348
tags question: http://stackoverflow.com/q/25085150
tags question: http://stackoverflow.com/q/25218161
tags question: http://stackoverflow.com/q/25124301
tags question: http://stackoverflow.com/q/25175168
tags question: http://stackoverflow.com/q/25225321
tags question: http://stackoverflow.com/q/25074313
tags question: http://stackoverflow.com/q/25177082
tags question: http://stackoverflow.com/q/25160787
tags question: http://stackoverflow.com/q/25140019
tags question: http://stackoverflow.com/q/25157553
tags question: http://stackoverflow.com/q/25210193
tags question: http://stackoverflow.com/q/25111371
tags question: http://stackoverflow.com/q/25149428
tags question: http://stackoverflow.com/q/25092339
tags question: http://stackoverflow.com/q/25190914
tags question: http://stackoverflow.com/q/25119310
tags question: http://stackoverflow.com/q/25120078
tags question: http://stackoverflow.com/q/25141475
tags question: http://stackoverflow.com/q/25228415
tags question: http://stackoverflow.com/q/25071955
tags question: http://stackoverflow.com/q/25139615
tags question: http://stackoverflow.com/q/25174420
tags question: http://stackoverflow.com/q/25127259
tags question: http://stackoverflow.com/q/25125381
tags question: http://stackoverflow.com/q/25123413
tags question: http://stackoverflow.com/q/25129084
tags question: http://stackoverflow.com/q/25098416
tags question: http://stackoverflow.com/q/25083153
tags question: http://stackoverflow.com/q/25119673
tags question: http://stackoverflow.com/q/25186625
tags question: http://stackoverflow.com/q/25212468
tags question: http://stackoverflow.com/q/25096815
tags question: http://stackoverflow.com/q/25211906
tags question: http://stackoverflow.com/q/25192517
tags question: http://stackoverflow.com/q/25081668
tags question: http://stackoverflow.com/q/25127492
tags question: http://stackoverflow.com/q/25188091
tags question: http://stackoverflow.com/q/25071159
tags question: http://stackoverflow.com/q/25228976
tags question: http://stackoverflow.com/q/25073336
tags question: http://stackoverflow.com/q/25191349
tags question: http://stackoverflow.com/q/25086492
tags question: http://stackoverflow.com/q/25224277
tags question: http://stackoverflow.com/q/25209696
tags question: http://stackoverflow.com/q/25103572
tags question: http://stackoverflow.com/q/25157053
tags question: http://stackoverflow.com/q/25104486
tags question: http://stackoverflow.com/q/25125233
tags question: http://stackoverflow.com/q/25107008
tags question: http://stackoverflow.com/q/25149293
tags question: http://stackoverflow.com/q/25179366
tags question: http://stackoverflow.com/q/25105117
tags question: http://stackoverflow.com/q/25089362
tags question: http://stackoverflow.com/q/25137483
tags question: http://stackoverflow.com/q/25228829
tags question: http://stackoverflow.com/q/25225781
tags question: http://stackoverflow.com/q/25179462
tags question: http://stackoverflow.com/q/25192324
tags question: http://stackoverflow.com/q/25128542
tags question: http://stackoverflow.com/q/25124001
tags question: http://stackoverflow.com/q/25218675
tags question: http://stackoverflow.com/q/25140910
tags question: http://stackoverflow.com/q/25190024

java
tags question: http://stackoverflow.com/q/25191804
tags question: http://stackoverflow.com/q/25165128
tags question: http://stackoverflow.com/q/25211253
tags question: http://stackoverflow.com/q/25092280
tags question: http://stackoverflow.com/q/25190956
tags question: http://stackoverflow.com/q/25092306
tags question: http://stackoverflow.com/q/25220097
tags question: http://stackoverflow.com/q/25214905
tags question: http://stackoverflow.com/q/25157153
tags question: http://stackoverflow.com/q/25148923
tags question: http://stackoverflow.com/q/25187161
tags question: http://stackoverflow.com/q/25083543
tags question: http://stackoverflow.com/q/25184553
tags question: http://stackoverflow.com/q/25188182
tags question: http://stackoverflow.com/q/25128786
tags question: http://stackoverflow.com/q/25221883
tags question: http://stackoverflow.com/q/25075432
tags question: http://stackoverflow.com/q/25096457
tags question: http://stackoverflow.com/q/25159186
tags question: http://stackoverflow.com/q/25089294
tags question: http://stackoverflow.com/q/25102316
tags question: http://stackoverflow.com/q/25228079
tags question: http://stackoverflow.com/q/25188939
tags question: http://stackoverflow.com/q/25165567
tags question: http://stackoverflow.com/q/25148316
tags question: http://stackoverflow.com/q/25210882
tags question: http://stackoverflow.com/q/25223122
tags question: http://stackoverflow.com/q/25112652
tags question: http://stackoverflow.com/q/25138037
tags question: http://stackoverflow.com/q/25196766
tags question: http://stackoverflow.com/q/25201482
tags question: http://stackoverflow.com/q/25177303
tags question: http://stackoverflow.com/q/25163480
tags question: http://stackoverflow.com/q/25093304
tags question: http://stackoverflow.com/q/25160703
tags question: http://stackoverflow.com/q/25214786
tags question: http://stackoverflow.com/q/25196198
tags question: http://stackoverflow.com/q/25129508
tags question: http://stackoverflow.com/q/25071948
tags question: http://stackoverflow.com/q/25096473
tags question: http://stackoverflow.com/q/25181937
tags question: http://stackoverflow.com/q/25179723
tags question: http://stackoverflow.com/q/25105175
tags question: http://stackoverflow.com/q/25220151
tags question: http://stackoverflow.com/q/25161323
tags question: http://stackoverflow.com/q/25091861
tags question: http://stackoverflow.com/q/25227543
tags question: http://stackoverflow.com/q/25213086
tags question: http://stackoverflow.com/q/25182560
tags question: http://stackoverflow.com/q/25131587
tags question: http://stackoverflow.com/q/25154660
tags question: http://stackoverflow.com/q/25118892
tags question: http://stackoverflow.com/q/25204889
tags question: http://stackoverflow.com/q/25179417
tags question: http://stackoverflow.com/q/25147096
tags question: http://stackoverflow.com/q/25207834
tags question: http://stackoverflow.com/q/25202304
tags question: http://stackoverflow.com/q/25079753
tags question: http://stackoverflow.com/q/25114987
tags question: http://stackoverflow.com/q/25120751
tags question: http://stackoverflow.com/q/25215359
tags question: http://stackoverflow.com/q/25087694
tags question: http://stackoverflow.com/q/25187749
tags question: http://stackoverflow.com/q/25123936
tags question: http://stackoverflow.com/q/25186216
tags question: http://stackoverflow.com/q/25213111
tags question: http://stackoverflow.com/q/25075842
tags question: http://stackoverflow.com/q/25187532
tags question: http://stackoverflow.com/q/25072540
tags question: http://stackoverflow.com/q/25152295
tags question: http://stackoverflow.com/q/25208904
tags question: http://stackoverflow.com/q/25102156
tags question: http://stackoverflow.com/q/25081829
tags question: http://stackoverflow.com/q/25181018
tags question: http://stackoverflow.com/q/25098829
tags question: http://stackoverflow.com/q/25081343
tags question: http://stackoverflow.com/q/25228233
tags question: http://stackoverflow.com/q/25204226
tags question: http://stackoverflow.com/q/25204901
tags question: http://stackoverflow.com/q/25176499

http://stackoverflow.com/q/25112923
has answer: http://stackoverflow.com/a/25124146
accepted answer: http://stackoverflow.com/a/25124146
possible better answer: http://stackoverflow.com/a/25113206
type: Question
has title: How to configure Struts 2.3 to accept both GET and POST parameters?
tagged with: struts2
score: 0
answer count: 2
tagged with: http-post
has body: We have migrated from 2.0 to 2.3. In Struts 2.0, we were able to send an AJAX request that contained both post and get parameters. But after migrating to Struts 2.3, were are not able to do such requests. Here is what a sample AJAX request made using Prototype.js looks like : var url = '/security/userdetails.action?mode=edit&amp;userid=5'; var params = Form.serialize(form); new Ajax.Request(url, { parameters: params, onSuccess: function(trans) { console.debug('success', trans); }, onFailure: function(trans) { console.debug('failure', trans); }, onException:function(trans) { console.debug('exception', trans); } }); As you can see, the above AJAX request contains both GET and POST requests. This worked fine with 2.0 but in 2.3, it seems the request is validated and the request is forwarded to result type "input", but for that we have no JSP configured, and in the end all we get is a 404 Not Found Error. But if we change the code to the following, it works in Struts 2.3 as well var url = '/security/userdetails.action?mode=edit'; // ------ The Changes are here var params = Form.serialize(form); params.userid = 5; // ----- And here new Ajax.Request(url, { parameters: params, onSuccess: function(trans) { console.debug('success', trans); }, onFailure: function(trans) { console.debug('failure', trans); }, onException:function(trans) { console.debug('exception', trans); } }); What is wrong with the first method ? Is there a configuration in Struts 2.3 to allow that request to be made ?
tagged with: ajax
has comment: http://stackoverflow.com/comment/39082813
has comment: http://stackoverflow.com/comment/39099114
has answer: http://stackoverflow.com/a/25113206
tagged with: url-parameters
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39082567

http://stackoverflow.com/a/25229737
has comment: http://stackoverflow.com/comment/39299966
has body: You are not getting exception even you are not passing command line arguments, why because JVM will create an empty array with no elements even there are no command line arguments. In your for loop you have given condition such that the loop will execute only if the args array size is greater that 1. So first time your args size is zero so for loop won't be executed so args[x] won't be executed that's why there is no exception at run time. consider the below images to get good idea what is happening. java Yippee will results in below diagram java Yippee 1 2 3 4 will results in below diagram
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25229179
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25229179

http://stackoverflow.com/q/25226353
score: 1
favorite count: 0
has title: Difference between String[] with and without single quotation marks in debugger?
upvote count: 2
has answer: http://stackoverflow.com/a/25226365
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39293508
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25226365
has comment: http://stackoverflow.com/comment/39293498
has body: I'm debugging an application and realized that the debugger displays String[] in two different ways, namely these two: ['test'] and [test]. Those displayed in the second way work for my purpose and the other doesn't. What's the difference between these two?
answer count: 1

http://stackoverflow.com/q/25163335
tagged with: java
has comment: http://stackoverflow.com/comment/39176338
type: Question
has comment: http://stackoverflow.com/comment/39176908
has comment: http://stackoverflow.com/comment/39179800
has answer: http://stackoverflow.com/a/25164659
tagged with: spring-el
answer count: 1
downvote count: 0
has body: I am looking for a neat way of injecting values from environment variables to pojo, but with default values for not set env variables. I know about this syntax: @Value("#{systemProperties['JDBC_CONNECTION_STRING'] ?: \"jdbc:mysql://localhost:3306/mydb?user=root\"}") But it means that I have to hardcode defaults in java files. And I would prefer to have it in properties file. Is it possible? I need this because on AWS EBS env variables are only way to pass properties but we don't deploy only there. On other places I want to read props from file.
favorite count: 0
accepted answer: http://stackoverflow.com/a/25164659
tagged with: spring
has title: Spring value injection - if no env variable then default to system property from file
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39176643
has comment: http://stackoverflow.com/comment/39176204
upvote count: 2

http://stackoverflow.com/a/25134314
has body: Use this : String s = "35/6"; s = s.replace('/', '.'); double d = Double.parseDouble(s);
type: Answer
answers question: http://stackoverflow.com/q/25134178
has comment: http://stackoverflow.com/comment/39122184
has comment: http://stackoverflow.com/comment/39122104
score: 0

http://stackoverflow.com/a/25147125
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/130015229
has comment: http://stackoverflow.com/comment/59681807
type: Answer
downvote count: 0
score: 1519
has comment: http://stackoverflow.com/comment/69763119
has comment: http://stackoverflow.com/comment/75457693
upvote count: 1519
has comment: http://stackoverflow.com/comment/39146554
accepted answer of: http://stackoverflow.com/q/25147094
has body: You can use flatMap to flatten the internal lists (after converting them to Streams) into a single Stream, and then collect the result into a list: List&lt;List&lt;Object&gt;&gt; list = ... List&lt;Object&gt; flat = list.stream() .flatMap(List::stream) .collect(Collectors.toList());
answers question: http://stackoverflow.com/q/25147094

http://stackoverflow.com/q/25176153
downvote count: 0
has title: How to write a batch file to set classpath and execute java programs
favorite count: 0
has answer: http://stackoverflow.com/a/61890178
type: UnansweredQuestion
score: 3
has body: Some of my java programs need so many jar files to execute. For executing this, I may have to add all of those jar files in classpath variable of environment variables or else have to set classpath manually at command prompt each and every time when I open a new cmd prompt. I do not want to add all jar files at classpath variable in environment variables and also set manually each and every time when I open new cmd prompt. I would like to write a script in batch file to set classpath and there it self need to run java programs. So that, when ever I want to run my programs, I will just run batch file and run my programs one by one. I have written a batch file to set classpath. But, when I run this batch file, it automatically get closed. So, Am not able to utilize the classpath I set by batch file.Again I had to open new cmd prompt, set classpath and run my java programs. To achieve this with batch file, how could I proceed. Appreciate any help. Thank you.
upvote count: 3
has answer: http://stackoverflow.com/a/58299412
tagged with: java
linked to: http://stackoverflow.com/q/138511
tagged with: classpath
type: Question
has comment: http://stackoverflow.com/comment/39199924
tagged with: batch-file
answer count: 3
has answer: http://stackoverflow.com/a/25218188
tagged with: batch-processing

http://stackoverflow.com/q/25220854
answer count: 1
has comment: http://stackoverflow.com/comment/39283602
favorite count: 0
upvote count: 2
downvote count: 2
has body: My app is crashing over and over again. Here is the code and logcat. MainActivity: public class MainActivity extends FragmentActivity { GoogleMap map; private static LatLng ZAGREB_CENTAR = new LatLng(45.813096, 15.977259); List&lt;Ruta&gt; ruta = null; ArrayList&lt;LatLng&gt; markerPoints; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MapsInitializer.initialize(this.getApplicationContext()); setUpMapIfNeeded(); setMarkers(); } private void setUpMapIfNeeded() { // Do a null check to confirm that we have not already instantiated the // map. if (map == null) { MapsInitializer.initialize(this.getApplicationContext()); map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); // Check if we were successful in obtaining the map. if (map != null) { // The Map is verified. It is now safe to manipulate the map. map.setMapType(GoogleMap.MAP_TYPE_NORMAL); map.setMyLocationEnabled(true); map.moveCamera(CameraUpdateFactory.newLatLngZoom(ZAGREB_CENTAR, 14)); } } } private void setMarkers() { try { markerPoints.clear(); ruta = SAXXMLParser.parse(getAssets().open("linija109.xml")); for (int i = 0; i &lt; ruta.size(); i++) { //Log.e("tag", ruta.get(i).toString()); final LatLng lokacija = new LatLng(Double.parseDouble(ruta.get( i).getLat()), Double.parseDouble(ruta.get(i).getLng())); map.addMarker(new MarkerOptions() .position(lokacija) .title(ruta.get(i).getName()) .snippet(ruta.get(i).getAddress()) .icon(BitmapDescriptorFactory.fromResource(R.drawable.busstop))); markerPoints.add(lokacija); if(markerPoints.size() == ruta.size()) { for(int j = 0; j &lt; markerPoints.size(); j++) { LatLng origin = markerPoints.get(j); LatLng dest = markerPoints.get(j+1); // Getting URL to the Google Directions API String url = getDirectionsUrl(origin, dest); DownloadTask downloadTask = new DownloadTask(); // Start downloading json data from Google Directions API downloadTask.execute(url); }…
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25220868
accepted answer: http://stackoverflow.com/a/25220868
type: Question
has title: Unable to start activity ComponentInfo Google maps android program crashes
tagged with: google-maps
has comment: http://stackoverflow.com/comment/39285109
score: 0
tagged with: android

http://stackoverflow.com/comment/39094389
has text: Better use a simple `String.contains()`.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25119310

http://stackoverflow.com/comment/39173550
score: 0
type: Comment
type: QuestionComment
has text: @Rowland Shaw Sorry I forgot to mention that. I am using Java.
comment on: http://stackoverflow.com/q/25162041

http://stackoverflow.com/a/25165902
score: 0
has body: Sure, you can use Properties class for that. A good example from mkyong website: package com.mkyong.properties; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Properties; public class App { public static void main(String[] args) { Properties prop = new Properties(); OutputStream output = null; try { output = new FileOutputStream("config.properties"); // set the properties value prop.setProperty("database", "localhost"); prop.setProperty("dbuser", "mkyong"); prop.setProperty("dbpassword", "password"); // save properties to project root folder prop.store(output, null); } catch (IOException io) { io.printStackTrace(); } finally { if (output != null) { try { output.close(); } catch (IOException e) { e.printStackTrace(); } } } } }
answers question: http://stackoverflow.com/q/25165800
type: Answer

http://stackoverflow.com/comment/39054002
has text: Just check below thread http://stackoverflow.com/questions/21283052/com-thoughtworks-xstream-mapper-cannotresolveclassexception
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25097549
type: Comment

http://stackoverflow.com/comment/39202533
comment on: http://stackoverflow.com/a/25174903
score: 0
type: Comment
has text: Then accept the answer as correct. For content size use http://java-sl.com/tip_text_height_measuring.html
type: AnswerComment

http://stackoverflow.com/q/25218086
has body: I have an error in SQL syntax when saving data record into the database: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option, createdBy, createdDate, updatedBy, updatedDate, description) values ('QU' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.Util.getInstance(Util.java:381) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1031) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2362) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2280) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2265) at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:94) at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57) ... 86 more In Get Session Method getSession Struts code: public T saveOrUpdate(T entity) { try { getSessionTx().save(entity); commit(); } catch (Exception e) { rollback(); e.printStackTrace(); } finally { getSession().close(); } return entity; } for(int i = 0;i&lt;appendT…
has comment: http://stackoverflow.com/comment/39278998
has comment: http://stackoverflow.com/comment/39278930
has comment: http://stackoverflow.com/comment/39279439
tagged with: struts
has title: An error in SQL syntax when saving data record into the database
has answer: http://stackoverflow.com/a/25220469
accepted answer: http://stackoverflow.com/a/25220469
tagged with: sql
has comment: http://stackoverflow.com/comment/39279591
answer count: 1
has comment: http://stackoverflow.com/comment/39278973
favorite count: 0
has comment: http://stackoverflow.com/comment/39278565
has comment: http://stackoverflow.com/comment/39279404
has comment: http://stackoverflow.com/comment/39279546
has comment: http://stackoverflow.com/comment/39278950
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39279447
upvote count: 2
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39279567
tagged with: mysql
has comment: http://stackoverflow.com/comment/39279505
downvote count: 1
has comment: http://stackoverflow.com/comment/39278964
type: Question

http://stackoverflow.com/comment/39084663
type: QuestionComment
comment on: http://stackoverflow.com/q/25114054
type: Comment
score: 1
has text: As far as I know, the first version of CodePro was made for 3.4. It is not possible to use plugins in earlier version then they were made for.

http://stackoverflow.com/q/25190791
tagged with: bukkit
upvote count: 1
has answer: http://stackoverflow.com/a/25190814
type: Question
has body: I am trying to create a Bukkit plugin and I keep getting an ArrayIndexOutOfBounds exception when I try to check if an argument exists. Here is what I have tried if(args[4].equals(null)) Why is this happening?
tagged with: minecraft
tagged with: javascript
downvote count: 4
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: -3
has title: Bukkit ArrayIndexOutOfBoundsException on Checking for an Argument
has comment: http://stackoverflow.com/comment/39228413
tagged with: java
tagged with: indexoutofboundsexception

http://stackoverflow.com/comment/39299395
has text: If i remove the setter, jaxb cannot read and set the object from xml file
comment on: http://stackoverflow.com/q/25229342
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25150915
has comment: http://stackoverflow.com/comment/39178020
tagged with: user-interface
type: UnansweredQuestion
tagged with: java-8
has comment: http://stackoverflow.com/comment/39175304
has title: TableView With An Embedded ListView
answer count: 0
tagged with: java
tagged with: javafx
score: 0
has comment: http://stackoverflow.com/comment/39177191
type: Question
has comment: http://stackoverflow.com/comment/39164974
has body: I'm trying to make a TableView with an embedded ListView, but I'm not exactly sure what to do, I've been researching how to embed Buttons into a TableColumn and I've seen that I should create a custom class that extends TableColumn and overrides updateItem(). I have a: @FXML private TableColumn&lt;FoodModel, ObservableSet&lt;Food&gt;&gt; storeFood; for the tableColumn, set by the FXML editor. It's value is set by this.storeFood.setCellValueFactory(val -&gt; val.getValue().getFood); and this.storeFood.setCellFactory(value -&gt; new ListViewCell&lt;&gt;()); upon initialization. I've been encountering a problem in which the list on screen is not being populated. Can I have a checklist of things to do to embed a list into a TableColumn? Cell: private static final class ListViewCell&lt;T, V&gt; extends TableCell&lt;T, V&gt; { private ListView&lt;T&gt; list; ListViewCell() { this.list = new ListView&lt;&gt;(); this.list.setPrefHeight(60); } @Override protected void updateItem(V item, boolean empty) { super.updateItem(item, empty); if (!empty) { setContentDisplay(ContentDisplay.GRAPHIC_ONLY); setGraphic(this.list); } } }
tagged with: listview

http://stackoverflow.com/q/25222738
possible better answer: http://stackoverflow.com/a/25224392
has answer: http://stackoverflow.com/a/25224392
favorite count: 0
tagged with: cassandra
has title: CassandraTemplate.execute Batch statements help needed in Spring
has body: I am having difficult time in finding a sample program that uses the execute of batch statement as argument for org.springframework.data.cassandra.core.CassandraTemplate; Basically I am trying to do multiple insert as a batch. CqlTemplate cqltemplate = new CqlTemplate(session); cqltemplate.execute(Batch arg0); How does it all come together? Also batch has issues in dealing with inserting multiple records to any unknown table (not linked to entity class). My project requires a method to do multiple insert for a given table and hashmap of key and values (row data) - which does not have an equivalent POJO Class. Any suggestions on how to achieve this?
tagged with: spring
accepted answer: http://stackoverflow.com/a/25677094
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/39288693
upvote count: 1
type: Question
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/25677094
tagged with: datastax
downvote count: 0

http://stackoverflow.com/comment/39019976
has text: @Bart That is the reason. We should always habituate to use `this` , so you need not to remember any cases :)
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/25079643

http://stackoverflow.com/a/25206074
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/39256199
has comment: http://stackoverflow.com/comment/39256117
answers question: http://stackoverflow.com/q/25205685
has comment: http://stackoverflow.com/comment/39264345
downvote count: 0
has body: You can do something like this ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); int hour = calendar.get(Calendar.HOUR_OF_DAY); int delay = hour &lt; 18 ? 18-hour : 18- (hour-18); System.out.println("Current Hour : "+hour+"\t"+"Delay For Next Mail: "+delay); executor.scheduleAtFixedRate(new Runnable() { @Override public void run() { System.out.println("run invoked"); //do something } }, delay , 24, TimeUnit.HOURS); Provided the server is up and running. First create an instance of ScheduledExecutorService which provides the method public ScheduledFuture&lt;?&gt; scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit); Accordingly calculate the delay ,period and the TimeUnit and the task to be executed
has comment: http://stackoverflow.com/comment/39256058
has comment: http://stackoverflow.com/comment/39255753
has comment: http://stackoverflow.com/comment/39256235
upvote count: 2

http://stackoverflow.com/q/25173573
has body: Today, I encountered a problem when I tried to combine multiple "variables" or objects, like the following example code: String stuff = "blah blah" + amazingness.getName() + " fantabulous code: " + address. The above example works fine normally, but it does not work in my case. So basically, I have a server which receives data via UDP means. Now, in order to use UDP, I have to create many threads, so the application does not hang. I don't know if the problem has anything to do with multiple threading, since the processor randomly runs the threads in a random order. I am using java version 1.8 update 05. Here is the code in my method. String message = "Client" + c.name + "(" + c.getID() + ") @" + c.address.toString() + ":" + c.port + "disconnected"; Where:c.name is "Classic", c.getID() returns a random number, c.address.toString() returns the client's ip address, and c.port is the client's port. When I run the code, I get a message of "Client Classic" and nothing else. The expected message is: "Client Classic(1932) @ 70.40.423.110:8112 disconnected" Here is a screen shot: Where has the other values gone? Now I start to think it may be because referencing other classes messes up the process of adding more values to the string. So I try to get the values before setting the message string String message = ""; String name = c.name; int cID = c.getID(); String address = c.address.toString(); int port = c.port; message = "Client " + name + "(" + cID + ") @ " + address + ":" + port + "disconnected"; System.out.println(message); Where:String name is Classic, cIDis a random number, address is an ip address, and port is a port number. All of the variables are not static. Still does not output the desired message: NOW, I test it again without the threads, just a standalone class: IT WORKS PERFECTLY! Now, my question is why does the above result occur and what did I do wrong? I appreciate the time you have spent reading my question and I hope you can understand it. Edit 1: I not…
favorite count: 0
has comment: http://stackoverflow.com/comment/39197651
accepted answer: http://stackoverflow.com/a/25175609
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39197445
has comment: http://stackoverflow.com/comment/39199333
upvote count: 3
tagged with: java
tagged with: multithreading
has title: Why does creating a string from multiple objects fail after joining the first two objects
has comment: http://stackoverflow.com/comment/39197455
type: Question
score: 3
has comment: http://stackoverflow.com/comment/39197400
has answer: http://stackoverflow.com/a/25175609
answer count: 2
possible better answer: http://stackoverflow.com/a/25175005
has comment: http://stackoverflow.com/comment/39197434
has answer: http://stackoverflow.com/a/25175005
downvote count: 0

http://stackoverflow.com/comment/39004430
score: 0
type: Comment
has text: Thanks! This works. Although I'm not sure if you can do `Double res = null`. I just set `Double res = 0` before my switch statement.
comment on: http://stackoverflow.com/a/25070185
type: AnswerComment

http://stackoverflow.com/q/25185634
has comment: http://stackoverflow.com/comment/39223777
has body: When compiling a project in Eclipse, I get below error: Fatal error compiling: tools.jar not found: How is this caused and how can I solve it?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25185831
tagged with: java
has comment: http://stackoverflow.com/comment/102851687
tagged with: eclipse
upvote count: 25
has comment: http://stackoverflow.com/comment/39224455
type: Question
tagged with: tools.jar
answer count: 2
has title: Fatal error compiling: tools.jar not found:
score: 22
downvote count: 3
has comment: http://stackoverflow.com/comment/60003166
favorite count: 0
has answer: http://stackoverflow.com/a/25186430
accepted answer: http://stackoverflow.com/a/25186430
tagged with: compiler-errors
has answer: http://stackoverflow.com/a/25185831

http://stackoverflow.com/comment/39302852
type: AnswerComment
has text: I was able to go through some of the material here:[martin fowler -injection](http://martinfowler.com/articles/injection.html) and [java tutorials](http://docs.oracle.com/javase/tutorial/ext/basics/spi.html)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25226892

http://stackoverflow.com/a/27680155
upvote count: 3
answers question: http://stackoverflow.com/q/25104028
downvote count: 0
has body: In such cases, I've found out the tricky part is to make sure you commit the transaction only if all inserts succeed, but rollback all updates if any insert fails. I've used a savepoint stack to handle such situations. The highly simplified code is as follows: A connection wrapper class: public class MyConnection { Connection conn; static DataSource ds; Stack&lt;Savepoint&gt; savePoints = null; static { //... stuff to initialize datasource. } public MyConnection() { conn = ds.getConnection(); } public void beginTransaction() { if (savePoints == null) { savePoints = new Stack&lt;Savepoint&gt;(); conn.setAutoCommit(false); conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); } else { savePoints.push(conn.setSavepoint()); } } public void commit() throws SQLException { if (savePoints == null || savePoints.empty()) { conn.commit(); } else { Savepoint sp = savePoints.pop(); conn.releaseSavepoint(sp); } } public void rollback() throws SQLException { if (savePoints == null || savePoints.empty()) { conn.rollback(); } else { Savepoint sp = savePoints.pop(); conn.rollback(sp); } } public void releaseConnection() { conn.close(); } } Then you can have various methods that may be called independently or in combination. In the example below, methodA may be called on its own, or as a result of calling methodB. public class AccessDb { public void methodA(MyConnection myConn) throws Exception { myConn.beginTransaction(); try { // update table A // update table B myConn.commit(); } catch (Exception e) { myConn.rollback(); throw e; } finally { } } public void methodB(MyConnection myConn) throws Exception { myConn.beginTransaction(); try { methodA(myConn); // update table C myConn.commit(); } catch (Exception e) { myConn.rollback(); throw e; } finally { } } } This way, if anything goes wrong, it rolls back fully (as a result of the exception handling), but it will only commit the entire transaction instead of committing a partially completed transaction.
type: Answer
score: 3

http://stackoverflow.com/q/25188503
accepted answer: http://stackoverflow.com/a/25188530
answer count: 1
has body: I made a library in java to make calling maps from google maps easier and faster but I can't seem to import the jar file correctly. I followed the answer I found on this page How to create my own java library(API)? but it seems I am still doing something wrong. I named the package in the library com.googleMaps and then I exported the .jar file and then added that .jar file into my build path of another project. I then made a class, imported com.googleMaps.StaticMap; Which gave me an unused library warning. Finally inside my main method I called DisplayMaps("string"); which is a method inside of StaticMap; But it gives me an error saying the Method does not exist but the unused warning on the import went away. Error is: The method DisplayMap(String) is undefined for the type MapTest1 Code: import com.googleMap.StaticMap; public class MapTest1 { public static void main(String[] args) { DisplayMap("A Url Goes here"); // This is where im getting the error } }
has answer: http://stackoverflow.com/a/25188530
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39222724
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/3612567
has title: Why can't I call a function from my custom library?
type: Question

pojo
tags question: http://stackoverflow.com/q/25188939
tags question: http://stackoverflow.com/q/25208049
tag name: pojo
type: Tag
tags question: http://stackoverflow.com/q/25149595
tags question: http://stackoverflow.com/q/25080491
tags question: http://stackoverflow.com/q/25194138

http://stackoverflow.com/a/25083268
has body: How can I convert an int into a char datatype in java? Your question isn't entirely clear, int i = 2; Assuming you want '2', you could use int i = 2; char ch = (char) ('0' + i); System.out.println(ch); Edit I have to check whether it is an digit before proceeding to the subsequents steps to prevent errors. Then you could use Character.isDigit(char) - char ch = '0'; if (Character.isDigit(ch)) { System.out.println("is digit"); } else { System.out.println("is NOT digit"); }
score: 0
answers question: http://stackoverflow.com/q/25083208
type: Answer

http://stackoverflow.com/q/25208799
possible better answer: http://stackoverflow.com/a/42361848
has comment: http://stackoverflow.com/comment/39278210
has comment: http://stackoverflow.com/comment/39278520
has comment: http://stackoverflow.com/comment/39272492
has comment: http://stackoverflow.com/comment/39330857
has comment: http://stackoverflow.com/comment/39278835
type: Question
accepted answer: http://stackoverflow.com/a/25249177
has comment: http://stackoverflow.com/comment/39332191
answer count: 2
linked to: http://stackoverflow.com/q/12895031
downvote count: 0
favorite count: 0
tagged with: cryptography
tagged with: aes
tagged with: bouncycastle
has answer: http://stackoverflow.com/a/25249177
tagged with: encryption
has comment: http://stackoverflow.com/comment/39278561
has body: I have to get rid of JCE jars and should be replaced with bouncy castle jar for AES encryption and decryption. I am getting invalid key size exception when i replace JCE policy jars with BC jars for AES 256 algorithm. But it works well with key size 128. How can i make use of BC jars in case of AES 256 algorithm. Thanks.
upvote count: 1
has answer: http://stackoverflow.com/a/42361848
has title: replace JCE with Bouncycastle jar
has comment: http://stackoverflow.com/comment/39278594
has comment: http://stackoverflow.com/comment/39328840
has comment: http://stackoverflow.com/comment/39270738
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39331806
score: 1
tagged with: java

http://stackoverflow.com/q/25223602
has comment: http://stackoverflow.com/comment/39289669
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/25223649
answer count: 1
type: UnansweredQuestion
score: -3
linked to: http://stackoverflow.com/q/23168805
has body: I'm currently trying to figure out what time of the day it is. If I use: cal.HOUR_OF_DAY and it is currently 11PM, will the method return as 11 or 23? Or, would I have to use something along these lines: if (cal.HOUR_OF_DAY == 11 &amp;&amp; (cal.AM_PM == cal.PM)) { // do something }
upvote count: 0
has title: cal.HOUR_OF_DAY, based on 12 or 24?
favorite count: 0
has comment: http://stackoverflow.com/comment/39289394
type: Question
has comment: http://stackoverflow.com/comment/39288441
has comment: http://stackoverflow.com/comment/39288472

http://stackoverflow.com/q/25121116
tagged with: java
tagged with: mysql
has title: Class not Found MySQL connector in Servlet
tagged with: servlets
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/25121322
has comment: http://stackoverflow.com/comment/39097897
score: 0
has comment: http://stackoverflow.com/comment/39097813
has body: I have a question about MySQL connector - In my servlet i use connector- mysql-connector-java-5.1.18-bin.jar as String driver = "com.mysql.jdbc.Driver"; than in try block i create new Instance using Class.forName(driver).newInstance(); but after click on my "Search" button - i have an error: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver I have my Mysql Connector in My Project WebContent\WEB-INF\lib\ folder and I have it in Projects build Path as well, but I still have an exception. What shall i check or how can i get rid of this? Thanks
has answer: http://stackoverflow.com/a/25121322
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39097730

http://stackoverflow.com/comment/39012057
type: AnswerComment
comment on: http://stackoverflow.com/a/25075078
type: Comment
has text: ,i'm not using double, but transforming right from the string i get from the inputstream
score: 0

http://stackoverflow.com/q/25147645
has comment: http://stackoverflow.com/comment/39149459
type: Question
linked to: http://stackoverflow.com/q/13059997
tagged with: android-mediaplayer
score: 0
has title: onCompletion Listener for between switches
tagged with: android
answer count: 1
type: UnansweredQuestion
has body: I've got an issue which I think I can see the solution to but I just can't work out how to implement it. I'm quite new to this whole game. I'm building an app which will "read" any number which is entered into it. So far I've got the app to take an inputed number and turn it into a 4 digit string which is then added to an array. The plan is to use this to run switch events for each digit, so if the first digit is 1 it will play the "one" sound clip followed by the "thousand" sound clip. I've got this bit working but when I try to get the second digit to run through a switch (e.g. "one" followed by "hundred") I just get the second lot of sound clips playing over the first. What I need to do is get the onCompletionListener working between these two switches; I've seen this question which seems to be asking the same thing but I can't work out how to use the answer... How to get an onCompletion handler from other class? Here is my code if you want to see what I've been doing. import android.media.MediaPlayer; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.widget.TextView; public class Number_Reader extends Activity { TextView readNumberTV; TextView numberLengthTV; int currentLength; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_number__reader); readNumberTV = (TextView) findViewById(R.id.read_input); numberLengthTV = (TextView) findViewById(R.id.number_length); } public void btn_zero_click(View view) { add("0");} public void btn_one_click(View view) { add("1");} public void btn_two_click(View view) { add("2");} public void btn_three_click(View view) { add("3");} public void btn_four_click(View view) { add("4");} public void btn_five_click(View view) { add("5");} public void btn_six_click(View view) { add("6");} public void btn_seven_click(View view) { add("7");} public void btn_eight_click(View view) { add("8");…
tagged with: java
has answer: http://stackoverflow.com/a/25167633
has comment: http://stackoverflow.com/comment/39147741

arrays
tags question: http://stackoverflow.com/q/25107335
tags question: http://stackoverflow.com/q/25115108
tags question: http://stackoverflow.com/q/25198417
tags question: http://stackoverflow.com/q/25079434
tags question: http://stackoverflow.com/q/25173177
type: Tag
tags question: http://stackoverflow.com/q/25153390
tags question: http://stackoverflow.com/q/25218512
tags question: http://stackoverflow.com/q/25077948
tags question: http://stackoverflow.com/q/25112495
tags question: http://stackoverflow.com/q/25223297
tags question: http://stackoverflow.com/q/25133274
tags question: http://stackoverflow.com/q/25174021
tags question: http://stackoverflow.com/q/25176880
tags question: http://stackoverflow.com/q/25089755
tags question: http://stackoverflow.com/q/25220097
tags question: http://stackoverflow.com/q/25184589
tags question: http://stackoverflow.com/q/25181618
tags question: http://stackoverflow.com/q/25172423
tags question: http://stackoverflow.com/q/25103434
tags question: http://stackoverflow.com/q/25224530
tags question: http://stackoverflow.com/q/25126020
tags question: http://stackoverflow.com/q/25072356
tags question: http://stackoverflow.com/q/25092090
tags question: http://stackoverflow.com/q/25217404
tags question: http://stackoverflow.com/q/25191893
tags question: http://stackoverflow.com/q/25085910
tags question: http://stackoverflow.com/q/25195551
tags question: http://stackoverflow.com/q/25213636
tags question: http://stackoverflow.com/q/25080038
tags question: http://stackoverflow.com/q/25125413
tags question: http://stackoverflow.com/q/25111632
tags question: http://stackoverflow.com/q/25207802
tags question: http://stackoverflow.com/q/25171790
tags question: http://stackoverflow.com/q/25153419
tags question: http://stackoverflow.com/q/25125890
tags question: http://stackoverflow.com/q/25077282
tags question: http://stackoverflow.com/q/25127958
tags question: http://stackoverflow.com/q/25109595
tags question: http://stackoverflow.com/q/25217815
tags question: http://stackoverflow.com/q/25122279
tags question: http://stackoverflow.com/q/25200737
tag name: arrays
tags question: http://stackoverflow.com/q/25073497
tags question: http://stackoverflow.com/q/25134011
tags question: http://stackoverflow.com/q/25134424
tags question: http://stackoverflow.com/q/25093512
tags question: http://stackoverflow.com/q/25119308
tags question: http://stackoverflow.com/q/25099406
tags question: http://stackoverflow.com/q/25078149
tags question: http://stackoverflow.com/q/25104346
tags question: http://stackoverflow.com/q/25149412
tags question: http://stackoverflow.com/q/25125776
tags question: http://stackoverflow.com/q/25130042
tags question: http://stackoverflow.com/q/25107840
tags question: http://stackoverflow.com/q/25139171
tags question: http://stackoverflow.com/q/25085054
tags question: http://stackoverflow.com/q/25125299
tags question: http://stackoverflow.com/q/25207823
tags question: http://stackoverflow.com/q/25212740
tags question: http://stackoverflow.com/q/25087391
tags question: http://stackoverflow.com/q/25101659
tags question: http://stackoverflow.com/q/25145332
tags question: http://stackoverflow.com/q/25073015
tags question: http://stackoverflow.com/q/25095314
tags question: http://stackoverflow.com/q/25144703
tags question: http://stackoverflow.com/q/25127933
tags question: http://stackoverflow.com/q/25225839
tags question: http://stackoverflow.com/q/25188223
tags question: http://stackoverflow.com/q/25097350
tags question: http://stackoverflow.com/q/25220215
tags question: http://stackoverflow.com/q/25084710
tags question: http://stackoverflow.com/q/25170816
tags question: http://stackoverflow.com/q/25165576
tags question: http://stackoverflow.com/q/25090645
tags question: http://stackoverflow.com/q/25194047
tags question: http://stackoverflow.com/q/25117839
tags question: http://stackoverflow.com/q/25204938
tags question: http://stackoverflow.com/q/25084990
tags question: http://stackoverflow.com/q/25150199

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

http://stackoverflow.com/a/26994186
has comment: http://stackoverflow.com/comment/42521393
answers question: http://stackoverflow.com/q/25194854
has body: Two solutions: repackaging your content directly under /META-INF/resources voting for this Spring issue: SPR-12323
score: 0
has comment: http://stackoverflow.com/comment/42523639
type: Answer

http://stackoverflow.com/comment/39178586
type: Comment
type: QuestionComment
has text: What about Z instead of XXX? or XXXX?
comment on: http://stackoverflow.com/q/25164601
score: 1

http://stackoverflow.com/comment/39110071
comment on: http://stackoverflow.com/q/25127174
has text: "Clean the project and rebuild it" is a standard answer for every problem with R.java. From my own experience I can add: check your project's dependancies - I once imported one library twice and that was the source of my problems.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25087773
answer count: 2
possible better answer: http://stackoverflow.com/a/25087830
accepted answer: http://stackoverflow.com/a/25087997
score: 0
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/25087997
has comment: http://stackoverflow.com/comment/39035930
favorite count: 0
has comment: http://stackoverflow.com/comment/39035904
has answer: http://stackoverflow.com/a/25087830
has title: Java Login Function
type: AnsweredQuestion
tagged with: java
upvote count: 1
has body: Hey I need some help with my code.. I want it to say 'logged on' when the 'Pass' and 'getPass' is the same. and if its not its says 'logged off'.. but it says that all the time even if its correct. :/. Can Someone Help Me :( p.s sorry For My Bad English xd package ca.sidez.main; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.border.EmptyBorder; public class Main extends JFrame { private static final long serialVersionUID = 1L; private JPanel contentPane; private static JTextField txtName; private static JTextField txtPass; public static String Pass; public static String Pass2; public static String getPass; public static String getName; public static String File; public Main() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e1) { e1.printStackTrace(); } setResizable(false); setTitle("Login"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(380, 380); setLocation(100, 100); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); txtName = new JTextField(); txtName.setBounds(67, 50, 165, 28); contentPane.add(txtName); txtName.setColumns(10); txtPass = new JTextField(); txtPass.setBounds(67, 100, 165, 28); contentPane.add(txtPass); txtPass.setColumns(20); JLabel lblName = new JLabel("Login"); lblName.setBounds(127, 20, 100, 30); contentPane.add(lblName); JButton btnLogin = new JButton("Login"); btnLogin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { File = txtName.getText(); Share(); } }); btnLogin.setBounds(60, 311, 1…
downvote count: 1
type: Question

http://stackoverflow.com/comment/39282880
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25220463
has text: provide 2 table views. one for the first column and the other for the rest
score: 1

http://stackoverflow.com/comment/94166359
has text: I'm converting a server application from Play Framework to pure JavaEE and had a DELETE resource that took a JSON body. I can't just break the old API so this helped me!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/31096841
type: AnswerComment

http://stackoverflow.com/a/25128627
score: 0
has comment: http://stackoverflow.com/comment/39112698
type: Answer
has comment: http://stackoverflow.com/comment/39112352
answers question: http://stackoverflow.com/q/25127484
has body: I think I understand what you mean, but I might be wrong. You cannot have 2 ActionListeners. What you will have to do is make another JButton and add the same listener to it. SOO: JButton BUTTON2 = new JButton(BUTTON2); BUTTON2.addActionListenter(this); Public void actionPerformed(ActionEvent e){ if(e.getSource() == BUTTON2){ System.exit(0); }else if(e.getSource() == BUTTON1){ //Whatever you want in here } }

http://stackoverflow.com/a/25098905
has comment: http://stackoverflow.com/comment/39069221
has comment: http://stackoverflow.com/comment/39064379
has comment: http://stackoverflow.com/comment/39084687
has comment: http://stackoverflow.com/comment/39069303
has body: I have added the below dependency and run your test. It works. Have you tried with this dependency? org.glassfish.jersey.test-framework.providers jersey-test-framework-provider-jetty 2.11
has comment: http://stackoverflow.com/comment/39070372
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25097995

http://stackoverflow.com/a/25263282
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25101534
has body: There are two things I can point out from experience. If you use eclipse to create apk file then the resources are duplicated (atleast it happened in my case), you can try using ant and build.xml to create the apk and compare the size. Also look into aliasing the resources.

http://stackoverflow.com/q/25128246
has answer: http://stackoverflow.com/a/25128339
type: Question
has title: Android: Adapter not updating data
score: 0
answer count: 2
has body: Here is my code: public class ForecastFragment extends Fragment { private ArrayAdapter&lt;String&gt; mforecastAdapter; public ForecastFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); } @Override public void onCreateOptionsMenu(Menu menu,MenuInflater inflater){ inflater.inflate(R.menu.forecastfragment, menu); } @Override public boolean onOptionsItemSelected(MenuItem item){ int id = item.getItemId(); if(id == R.id.action_refresh){ FetchWeatherTask weatherTask= new FetchWeatherTask(); weatherTask.execute("94043"); return true; } return true; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { String[] forecastArray = { "Mon 6/23 - Sunny - 31/17", "Tue 6/24 - Foggy - 21/8", "Wed 6/25 - Cloudy - 22/17", "Thurs 6/26 - Rainy - 18/11", "Fri 6/27 - Foggy - 21/10", "Sat 6/28 - TRAPPED IN WEATHERSTATION - 23/18", "Sun 6/29 - Sunny - 20/7" }; List&lt;String&gt; weekForecast = new ArrayList&lt;String&gt;(Arrays.asList(forecastArray)); mforecastAdapter = new ArrayAdapter&lt;String&gt;( getActivity(), // The current context (this activity) R.layout.list_item_forecast, // The name of the layout ID. R.id.list_item_forecast_textview, // The ID of the textview to populate. weekForecast); View rootView = inflater.inflate(R.layout.fragment_main, container, false); ListView listView = (ListView) rootView.findViewById(R.id.listview_forecast); listView.setAdapter(mforecastAdapter); return rootView; } public class FetchWeatherTask extends AsyncTask&lt;String, Void, String[]&gt; { private final String LOG_TAG = FetchWeatherTask.class.getSimpleName(); //GIST /* The date/time conversion code is going to be moved outside the asynctask later, * so for convenience we're breaking it out into its own method now. */ private String getReadableDateString(long time){ // Because the API returns a unix timestamp (measured in seconds), // it must be converted t…
tagged with: android
has answer: http://stackoverflow.com/a/25128412
type: UnansweredQuestion
tagged with: android-arrayadapter
tagged with: java

http://stackoverflow.com/a/25101348
score: 1
answers question: http://stackoverflow.com/q/25101314
has body: Looking at your code, this String postType = newArray.get(i).get("type"); Should be String postType = newArray.get(i).get("post_type"); Because ... I have an ArrayList of HashMaps ... Here is an example of the contents inside my HashMap&lt;String, String&gt;: post_type="Facebook" post_type="Facebook" post_type="Twitter" And, type is not post_type.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/25231396
has comment: http://stackoverflow.com/comment/83288048
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/45700652
type: Answer
score: 29
upvote count: 29
accepted answer of: http://stackoverflow.com/q/25148517
answers question: http://stackoverflow.com/q/25148517
has body: go to Settings -> Processing -> CVV, enable CVV verification rules, and renew the client token. In this way the CVV field will appear in the Drop-in UI.
has comment: http://stackoverflow.com/comment/45656520
downvote count: 0
has comment: http://stackoverflow.com/comment/117673007

http://stackoverflow.com/comment/39064298
type: Comment
type: QuestionComment
has text: hey tim_yates. thank you for helping me. I noticed that the groovy-all-2.2.1-indy.jar is found in eucalyptus/clc/lib, and it is occurring as a result of building the eucalyptus. how can we prevent that? how to unable it . I can show you the build.xml if that would help.
comment on: http://stackoverflow.com/q/25096189
score: 0

http://stackoverflow.com/comment/39314799
has text: 500 Internal server error is usually associated with some exception on the server side. Try to examine the server logs and find the root cause of the error.
score: 0
comment on: http://stackoverflow.com/q/25199485
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25116952
has comment: http://stackoverflow.com/comment/39093572
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 0
answer count: 2
tagged with: jersey
has answer: http://stackoverflow.com/a/25117123
has comment: http://stackoverflow.com/comment/39217275
has body: I have migrated my application from Jersey 1.x to 2.x and I am trying to replace the following entry from the web.xml com.sun.jersey.api.json.POJOMappingFeature true in order to be able to get entities as json. I have read in the official documentation that I have to use the Jackson provider by adding jersey-media-json-jackson dependency and thne register the JacksonFeature. I added the following dependency: com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider 2.4.1 but now I don't know what I have to add in my web.xml file as a value in the jersey.config.server.provider.packages Any ideas ? I wan't to do it via a configuration file like web.xml and not inside my code.
has title: How to add JSON Support in Jersey 2.x
has comment: http://stackoverflow.com/comment/53486786
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25186031
type: Question

http://stackoverflow.com/q/25180597
possible better answer: http://stackoverflow.com/a/25180794
tagged with: ejb-3.0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25182331
accepted answer: http://stackoverflow.com/a/25181145
type: Question
tagged with: java
answer count: 6
has answer: http://stackoverflow.com/a/70953117
has title: Named Query Or Native Query or Query Which one is better in performance point of view?
upvote count: 22
has answer: http://stackoverflow.com/a/64277798
has answer: http://stackoverflow.com/a/25182754
downvote count: 0
score: 22
favorite count: 0
has answer: http://stackoverflow.com/a/25180794
has answer: http://stackoverflow.com/a/25181145
has body: Which one is better among following(EJB 3 JPA) //Query a). getEntityManager().createQuery("select o from User o"); //Named Query where findAllUser is defined at Entity level b). getEntityManager().createNamedQuery("User.findAllUser");** //Native Query c). getEntityManager().createNativeQuery("SELECT * FROM TBLMUSER "); Please explain me which approach is better in which case?.

http://stackoverflow.com/comment/39152799
score: 6
has text: Have a look here: http://stackoverflow.com/questions/2223386/why-doesnt-java-allow-overriding-of-static-methods
type: Comment
comment on: http://stackoverflow.com/q/25150597
type: QuestionComment

http://stackoverflow.com/comment/44315831
type: Comment
score: 0
type: AnswerComment
has text: @golimar Yes (if the uploaded file is not image).
comment on: http://stackoverflow.com/a/26431969

http://stackoverflow.com/q/25152110
tagged with: applet
has body: I'm working in NetBeans, and have two projects. One is a JavaApplication project. This consists of an applet and some other classes. A couple of the classes make MySQL connections. When I run the Applet in this project, it works fine. The second is a WebApplication project. It contains some html files, as well as a .jar of my JavaApplication project, so I can run the applet from the html files. When I run the WebApplication project, I get the ClassNotFoundException for com.mysql.jdbc.Driver at the line in my code reading "Class.forName("com.mysql.jdbc.Driver");" I can only assume it's something wrong with where I'm adding the Driver, since when I don't run the web project and only run the applet, it works fine. Here is my Services and Projects tabs, please let me know if you detect something wrong: The database connection is alive and well, I can look into the tables from this view. Note that I placed the MySQL jar in the Libraries folder for both the JavaApplication and the WebApplication. I get the same result as when I only placed it in the Libraries folder for the JavaApplication. Any ideas about what to look into?
tagged with: jdbc
has answer: http://stackoverflow.com/a/25152169
has answer: http://stackoverflow.com/a/25155880
tagged with: netbeans
score: 0
possible better answer: http://stackoverflow.com/a/25152169
accepted answer: http://stackoverflow.com/a/25155880
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: mysql
has title: Where in Netbeans should I put my "mysql-connector-java-5.1.31-bin.jar" file?
answer count: 2

hiveql
tag name: hiveql
type: Tag
tags question: http://stackoverflow.com/q/25159277

http://stackoverflow.com/comment/39341340
comment on: http://stackoverflow.com/q/25217815
score: 0
has text: I'm somewhat confused: The question already implies that you noticed that the intention here was to *enforce* a certain number of parameters. So A and B are the same, *except* for the fact that in B1, at least one parameter is enforced - but in B2 and B3 this is not the case, so why have B1 at all? (And if you leave B1 out, then A and B basically *are* the same...).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/111733472
type: Comment
comment on: http://stackoverflow.com/a/25091028
score: 4
type: AnswerComment
has text: This won’t work for phone numbers that contain a plus sign, i.e. that use `+` as the international call prefix.

http://stackoverflow.com/comment/39271082
type: Comment
comment on: http://stackoverflow.com/a/25195230
has text: Interesting, because the solution I provided is using a DOM parser ;)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39020621
type: AnswerComment
has text: I would like to not have this options "hardcoded" in build file. It would be great to have possibility to specify proxy settings. I.e. - using command-line arguments.
type: Comment
score: 5
comment on: http://stackoverflow.com/a/25079415

http://stackoverflow.com/a/25093639
has comment: http://stackoverflow.com/comment/39046649
score: 0
type: Answer
has body: Because your if condition is never valid. May be you want to you use equalsignorecase
has comment: http://stackoverflow.com/comment/39046668
answers question: http://stackoverflow.com/q/25093596
has comment: http://stackoverflow.com/comment/39046697

http://stackoverflow.com/comment/39187605
type: Comment
has text: I don't need to split the file, I only need to copy a part of it into a new one. The rest of the file can be thrown away
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25169059

http://stackoverflow.com/comment/39292924
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25225970
has text: You should consider using a `JTable` for this, have a look at [How to Use Tables](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html) for more details

http://stackoverflow.com/q/25097378
answer count: 4
has answer: http://stackoverflow.com/a/47106660
type: AnsweredQuestion
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/59389762
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25097400
has answer: http://stackoverflow.com/a/59389762
linked to: http://stackoverflow.com/q/535004
accepted answer: http://stackoverflow.com/a/25097400
has answer: http://stackoverflow.com/a/47140404
tagged with: date
score: 0
has title: Convert linux timestamp to android date
has body: I must convert a linux timestamp to android date. i get this number from server 1386889262 I have written a small code snippet. Date d = new Date(jsonProductData.getLong(MTIME)); SimpleDateFormat f = new SimpleDateFormat("dd.MM.yyyy"); .setTimeZone(TimeZone.getTimeZone("GMT")); formatTime = f.format(d); but it doesen't convert right, this is my result 17.01.1970 EDIT: Normally i must get this here 12.12.2013 Is there an another method to get the right date???
favorite count: 0
has comment: http://stackoverflow.com/comment/39061350
tagged with: android

http://stackoverflow.com/comment/39107396
type: Comment
comment on: http://stackoverflow.com/a/25124738
score: 0
type: AnswerComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58639/discussion-between-biscuit128-and-jtahlborn).

http://stackoverflow.com/a/25165060
answers question: http://stackoverflow.com/q/25164515
has comment: http://stackoverflow.com/comment/39179682
has body: I suggest you following tutorial on deploying a web-service using JAX-WS on Tomcat. http://www.mkyong.com/webservices/jax-ws/deploy-jax-ws-web-services-on-tomcat/ http://docs.oracle.com/cd/E17802_01/webservices/webservices/reference/tutorials/wsit/doc/Examples_glassfish5.html#wp106350
has comment: http://stackoverflow.com/comment/39180934
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/39181383
has comment: http://stackoverflow.com/comment/39179762

http://stackoverflow.com/a/25122057
answers question: http://stackoverflow.com/q/25120951
has body: Here is another approach, but others gave a quite detailed response. The first example: List&lt;? extends Object&gt; ls0 = new LinkedList&lt;Number&gt;(); addandDisp(ls0, new Object()); Here ls0 may be of any type that is a subclass of Object, like a Number as your example shows. Now what if this could work? It would mean that if you can put an Object into any of the collections. Imagine I want to iterate your previous list of Number objects: for (Number n : numbers) { ... } If I could put an Object here, then Plaff! I would get a class cast exception immediately. The second example List&lt;? super String&gt; ls1 = ...; addandDisp(ls1,new String()); Let's play a bit with the object hierarchy: String is a subclass of CharSequence which is a subclass of Object. You get ls1 here which is an unknown supertype of String (e.g., a CharSequence). Is it all right to put a String into a list of character sequences? Yup, it's okay, since they share the same interface for sure! You can handle them through it in the same way. The third example List&lt;? super String&gt; ls1 = ...; addandDisp(ls1,new Object()); Let's suppose the previous situation: you assign ls1 a list of CharSequences. Can you add an object to a List&lt;CharSequence&gt;? Nope, for the same reason as the first example fails. Hope that helps clarifying your issues a bit :-)
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/39069881
comment on: http://stackoverflow.com/a/25106001
score: 0
type: AnswerComment
type: Comment
has text: @WaseemSwaileh: why do you want that?

http://stackoverflow.com/q/25226391
tagged with: tomcat
favorite count: 0
has body: I'm building two java applications which have to communicate using SSL two way authentication, I used instructions from here to create client and server certificates. then I built a webService in the server application like this: @RequestMapping(value="/testssl", method = RequestMethod.POST, produces="application/json", consumes="application/json") @ResponseBody public String testSSl(@RequestBody String name) { return = successfully tested; } and I edited tomcat server.xml file to enable SSL like this: &lt;Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="true" sslProtocol="TLS" keystoreFile="keyStore/server.jks" keystorePass="server123" /&gt; and put server.jks in Tomcat/Jenkins-Tomcat/keystore/server.jks then I built the client application to invoke this web service through SSL using spring RestTemplate like this: Properties props = new Properties(); props.put("javax.net.ssl.trustStore", "D:\\test\\server.jks"); props.put("javax.net.ssl.trustStoreType", "jks"); props.put("javax.net.ssl.trustStorePassword", "server123"); props.put("javax.net.ssl.keyStore", "D:\\test\\client.jks"); props.put("javax.net.ssl.keyStoreType", "jks"); props.put("javax.net.ssl.keyStorePassword", "client123"); props.put("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); props.put("ws.ssl.loose.disableHostnameVerification", "true"); System.setProperties(props); SSLContext sslcontext = SSLContexts.createDefault(); SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, new String[] { "TLSv1" }, null, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); HttpsURLConnection.setDefaultSSLSocketFactory(sslcontext.getSocketFactory()); CloseableHttpClient httpClient = HttpClientBuilder.create() .setSSLSocketFactory(sslsf).build(); org.springframework.http.client.HttpComponentsClientHttpRequestFactory cc = new HttpComponentsClientHttpRequestFactory(httpClient); RestTemplate rest = new Re…
type: Question
has title: how to write java client and server applications that uses mutual ssl authentication between them?
upvote count: 2
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/25621171
downvote count: 1
tagged with: jsse
tagged with: ssl
possible better answer: http://stackoverflow.com/a/40065395
accepted answer: http://stackoverflow.com/a/25621171
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/40065395
score: 1

http://stackoverflow.com/comment/39231923
type: AnswerComment
comment on: http://stackoverflow.com/a/25193241
score: 0
type: Comment
has text: @InnerOrchestra I'm not entirely sure, but it may be possible to select all intended elements and convert them. I would only do this for elements that *need* this, due to code- and debugging-bloat that may be possible.

http://stackoverflow.com/comment/39102774
type: Comment
type: QuestionComment
has text: When I click on the next button, nothing happends
comment on: http://stackoverflow.com/q/25123695
score: 0

http://stackoverflow.com/comment/39005491
type: AnswerComment
comment on: http://stackoverflow.com/a/25071243
score: 0
type: Comment
has text: @Ricky Considering that the only way to actually implement this stuff using that class was introduced with 1.8, linking the 1.7 documentation won't do much good ;)

http://stackoverflow.com/q/25192193
has comment: http://stackoverflow.com/comment/39238489
has comment: http://stackoverflow.com/comment/39268396
score: 0
has comment: http://stackoverflow.com/comment/39230084
answer count: 1
has title: why does my listView is set to default images only?
has answer: http://stackoverflow.com/a/25213282
tagged with: android-listview
tagged with: android
has comment: http://stackoverflow.com/comment/39267734
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39267606
has body: I have an android listView which I fill with images. I load the list from the server by silent paging. I use async download task to download the images and a cache layer to persist them. Whenever my adapter execute getView it sets the image tag to be its url. Then before I load the drawable to the image view, I check it's still relevant (as it's async task and the scroll might move already and the item has been recycled by then) by comparing the downloaded url to the url kept in the tag. However I see only the default image is seen usually, What is missing in my logic? private final LruCache&lt;String, Bitmap&gt; imageCache = new LruCache&lt;String, Bitmap&gt;( 100); @Override public View getView(final int position, View convertView, ViewGroup parent) { if (position != 0 &amp;&amp; (PublicMacros.OFFERS_PAGE_SIZE / 2 == position) &amp;&amp; ((position / PublicMacros.OFFERS_PAGE_SIZE + 1) * PublicMacros.OFFERS_PAGE_SIZE + 1) &gt; mOffersList .size() &amp;&amp; lastTriggeringPosition != position) // ask next page // maybe add loader { lastTriggeringPosition = position; mOffersListActivity.getOffersFromServer(++pageNumber, PublicMacros.OFFERS_PAGE_SIZE); } if (convertView == null) { LayoutInflater inflater = (LayoutInflater) mOffersListActivity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.offer_list_item, null); } else { // fetch existing data } initLayout(position, convertView); setChangeableViews(convertView); return convertView; } //called in setChangeableViews private void setItemBgImage(View convertView) { String imageUrl = getImageUrlFromOffer(convertView); Bitmap bitmap = imageCache.get(imageUrl); // anyhow set to default image Drawable dr = mOffersListActivity.getResources().getDrawable( R.drawable.lock_closed); ImageView offerImage = ((ImageView) convertView .findViewById(R.id.offerImage)); if (bitmap != null) { dr = new BitmapDrawable( // bitmap compression code mOffersListActivity.getResources(), bitmap); } else …
tagged with: java
has comment: http://stackoverflow.com/comment/39255171
tagged with: caching
tagged with: listview
type: Question

http://stackoverflow.com/q/25094873
has title: Springframework : Neither BindingResult nor plain target object for bean name
tagged with: spring
has body: I'm trying to run the project bellow and as a matter of fact I'm writing something wrong. In my opinion the problem is situated somewhere between the successView.jsp and CarController.java. Thank you in advance for your help. Code has been updated successView.jsp <%-- Document : successView Created on : May 2, 2010, 2:06:51 PM Author : nbuser --%> <%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <%@page contentType="text/html" pageEncoding="UTF-8"%> Enter Your Name Enter Your Name! <form:form commandName="car" method="POST"> Brand: <form:input path="brand.name"/> <form:input path="brand.country"/> Price: <form:input path="price"/> </form:form> carView.jsp <%-- Document : carView Created on : May 2, 2010, 2:06:25 PM Author : nbuser --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> Hello ${name} ${country} ${price} applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"> <bean name="carService" class="Service.CarService" /> <!--bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" p:location="/WEB-INF/jdbc.properties" /> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}" p:username="${jdbc.username}" p:password="${jdbc.password}" /--> </beans> web.xml <?xml version="1.0" encoding="UT…
score: 1
tagged with: java
upvote count: 1
type: Question
answer count: 1
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/25096140
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/39228776
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25191536
has text: Ok but what is the benefit of using cachecontrol if i have to specify the string values ? Should me more simple to use `reponseBuilder.header("cache-control", "public, max-age=...")` right ?. The javadoc of the class says that it respect the cache specification so it's weird to not have this feature.

http://stackoverflow.com/q/25182440
has comment: http://stackoverflow.com/comment/39212860
tagged with: android
has comment: http://stackoverflow.com/comment/39215420
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25184029
downvote count: 1
type: Question
has title: Why my listview duplicate the screen instead show the sqlite registers
score: -1
tagged with: listview
has comment: http://stackoverflow.com/comment/39210821
has body: I have a problem with my listview, I want it to display the data from sqlite, but the app duplicate the screen This is the layout.xml <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/tVArea" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Area Code" /> <TextView android:id="@+id/tVSupervisor" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Worker Code" /> <TextView android:id="@+id/tVdate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Date" /> <TextView android:id="@+id/tVTrackRecord" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Track Record" /> <requestFocus /> <ToggleButton android:id="@+id/TBBowl" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <ToggleButton android:id="@+id/ToggleButton03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ToggleButton" /> <ToggleButton android:id="@+id/ToggleButton02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ToggleButton" /> <ToggleButton android:id="@+id/ToggleButton01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ToggleButton" /> <ToggleButton android:id="@+id/toggleButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ToggleButton" /> <TextView android:id="@+id/tVPattern" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_weight="1" android:text="Pattern" /> <TextView android:id="@+id/tVColor" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/eTColor" android:layout_alignParentTop="true" android:layout_weight="1" android…
upvote count: 0
tagged with: sqlite
answer count: 1
favorite count: 0

recursion
tags question: http://stackoverflow.com/q/25215345
type: Tag
tags question: http://stackoverflow.com/q/25195028
tags question: http://stackoverflow.com/q/25151268
tags question: http://stackoverflow.com/q/25109793
tags question: http://stackoverflow.com/q/25152899
tags question: http://stackoverflow.com/q/25107279
tags question: http://stackoverflow.com/q/25109050
tag name: recursion
tags question: http://stackoverflow.com/q/25195626
tags question: http://stackoverflow.com/q/25121668
tags question: http://stackoverflow.com/q/25215225
tags question: http://stackoverflow.com/q/25172495
tags question: http://stackoverflow.com/q/25100383
tags question: http://stackoverflow.com/q/25093443
tags question: http://stackoverflow.com/q/25095198
tags question: http://stackoverflow.com/q/25196203
tags question: http://stackoverflow.com/q/25134882
tags question: http://stackoverflow.com/q/25126340
tags question: http://stackoverflow.com/q/25120054
tags question: http://stackoverflow.com/q/25151991

http://stackoverflow.com/comment/39029689
has text: They wont have the same size, each quiz question will have 20 buttons and the answer array will fill however many buttons and then the remaining buttons will be filled with other random characters, then the user has to try find the correct letters from the 20 buttons, guess the emoji, logo quiz etc has this feature if you have played any of them
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25084601
type: Comment

http://stackoverflow.com/q/25197352
has comment: http://stackoverflow.com/comment/39239679
tagged with: java
has answer: http://stackoverflow.com/a/25198035
type: Question
answer count: 2
tagged with: arrays
has title: How to switch to another activity after the last element in an array is displayed?
tagged with: android
has answer: http://stackoverflow.com/a/25197551
has body: Im new in programming and im having difficulties with my program..I want to switch from main activity to result activity after the last element in array is displayed but seems like my if else statement is wrong..ive tried other references but its not working..Help please.. private int currentQuestion; private String [] questions; private String [] answers; private Button answerButton; private Button questionButton; private TextView questionView; private TextView answerView; private EditText answerText; int score=0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); } public void init() { questions = new String[]{"What is my dog name?", "Who is my Crush?"}; answers = new String[]{"Butchick","Michael"}; currentQuestion = -1; answerButton=(Button)findViewById(R.id.button1); questionButton=(Button)findViewById(R.id.button2); questionView=(TextView)findViewById(R.id.textView1); answerView=(TextView)findViewById(R.id.textView2); answerText=(EditText)findViewById(R.id.editText1); answerButton.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { checkAnswer(); }}); questionButton.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { if(currentQuestion&lt;2){ currentQuestion++; if(currentQuestion==questions.length) currentQuestion=0; questionView.setText(questions[currentQuestion]); answerView.setText(""); answerText.setText(""); return; }else{ Intent intent = new Intent(MainActivity.this, ResultActivity.class); Bundle b = new Bundle(); b.putInt("score", score); //Your score intent.putExtras(b); //Put your score to your next Intent startActivity(intent); finish(); } }}); } public boolean isCorrect(String answer){ return(answer.equalsIgnoreCase(answers[currentQuestion])); } public void checkAnswer(){ String answer = answerText.getText().toString(); if(isCorrect(answer)){ answerView.setText("Youre Right!!"); score++; } else { …
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39239694

http://stackoverflow.com/comment/39120356
type: AnswerComment
has text: Maybe SHIFT+Space and SHIFT+CTRL+Space is reserved in your OS or in Swing. Try it with a different key like SHIFT+CTRL+E.
type: Comment
comment on: http://stackoverflow.com/a/25120372
score: 0

http://stackoverflow.com/comment/39235184
comment on: http://stackoverflow.com/q/25195108
has text: The "best way" is a matter of opinion. If you are just wanting us to write code for you, that is off topic.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25200611
has comment: http://stackoverflow.com/comment/39245583
score: 3
has body: In addition to my comment, try to replace "Java" %CW_CMD% with call %CW_CMD% since you already set the path to java.exe in CW_CMD there is no need for the first "Java"
has comment: http://stackoverflow.com/comment/39245691
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25200450
answers question: http://stackoverflow.com/q/25200450
upvote count: 3

http://stackoverflow.com/a/25124350
has comment: http://stackoverflow.com/comment/39109379
score: 1
has body: problem: public interface ItemClickListener { You are wrapping your method call to setOnItemClickListener which is completely on different scope thus giving you those errors, I dont know why you put interface within onCreate method, that is really a bad design. solution: just remove the public interface ItemClickListener { to use the reference of the class instead of ItemClickListener. EDIT: ListView s = (ListView) findViewById(R.id.id_to_list_view); EDIT 2: setOnItemClickListener(new OnItemClickListener(){ @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { } });
has comment: http://stackoverflow.com/comment/39104777
answers question: http://stackoverflow.com/q/25124188
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39104636
type: Answer
has comment: http://stackoverflow.com/comment/39104282
accepted answer of: http://stackoverflow.com/q/25124188
has comment: http://stackoverflow.com/comment/39109352
has comment: http://stackoverflow.com/comment/39104363
upvote count: 1

http://stackoverflow.com/comment/39148493
type: Comment
type: QuestionComment
score: 0
has text: @joshuar500 So, like a JPanel with BorderLayout that contains a textfield and button on the south position (both are added to the same JPanel with a FlowLayout), and a JPanel with a GridLayout(0, 1) in the main panel's center position that you add components to routinely everytime someone interacts with the bottom input components? I think you just need to nest your containers and mix and match layouts as needed.
comment on: http://stackoverflow.com/q/25147384

listview
tags question: http://stackoverflow.com/q/25150915
tags question: http://stackoverflow.com/q/25105751
tags question: http://stackoverflow.com/q/25133274
tags question: http://stackoverflow.com/q/25159768
tags question: http://stackoverflow.com/q/25072547
tags question: http://stackoverflow.com/q/25139532
tags question: http://stackoverflow.com/q/25134132
tags question: http://stackoverflow.com/q/25071656
tags question: http://stackoverflow.com/q/25217404
tags question: http://stackoverflow.com/q/25101379
tags question: http://stackoverflow.com/q/25192193
tag name: listview
tags question: http://stackoverflow.com/q/25105194
tags question: http://stackoverflow.com/q/25213360
tags question: http://stackoverflow.com/q/25202304
tags question: http://stackoverflow.com/q/25074846
tags question: http://stackoverflow.com/q/25086248
tags question: http://stackoverflow.com/q/25099187
tags question: http://stackoverflow.com/q/25195988
tags question: http://stackoverflow.com/q/25162458
tags question: http://stackoverflow.com/q/25140531
tags question: http://stackoverflow.com/q/25175585
tags question: http://stackoverflow.com/q/25082631
tags question: http://stackoverflow.com/q/25223545
tags question: http://stackoverflow.com/q/25182440
tags question: http://stackoverflow.com/q/25122279
tags question: http://stackoverflow.com/q/25108925
tags question: http://stackoverflow.com/q/25096603
tags question: http://stackoverflow.com/q/25197345
tags question: http://stackoverflow.com/q/25088247
tags question: http://stackoverflow.com/q/25175463
tags question: http://stackoverflow.com/q/25086268
type: Tag
tags question: http://stackoverflow.com/q/25129695

http://stackoverflow.com/comment/39165533
score: 0
type: Comment
has text: I want to avoid any of those requirements. I want to use dart just the way I would use js. Put it anywhere in the project, let the server serve the right file and done. I have updated the original question to provide further information.
type: AnswerComment
comment on: http://stackoverflow.com/a/25156624

http://stackoverflow.com/comment/39131239
type: AnswerComment
score: 0
has text: Exactly, the java code would be server side and give you the server's time, so what you could do is get it from javascript which runs client side. Take a look at this: http://stackoverflow.com/questions/1091372/getting-the-clients-timezone-in-javascript
type: Comment
comment on: http://stackoverflow.com/a/25123590

http://stackoverflow.com/q/25097801
downvote count: 1
has body: I am using spring security in my project and configuring custom FilterSecurityInterceptor to have url from database. When i am trying to use security tag in jsp than it throwing me following error. org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'hasRole' cannot be found on object of type 'org.springframework.security.web.access.expression.WebSecurityExpressionRoot' at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:246) at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:112) at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:107) at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:48) at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:81) at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:102) at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:98) at org.springframework.security.access.expression.ExpressionUtils.evaluateAsBoolean(ExpressionUtils.java:11) at org.springframework.security.taglibs.authz.AbstractAuthorizeTag.authorizeUsingAccessExpression(AbstractAuthorizeTag.java:184) at org.springframework.security.taglibs.authz.AbstractAuthorizeTag.authorize(AbstractAuthorizeTag.java:105) at org.springframework.security.taglibs.authz.JspAuthorizeTag.doStartTag(JspAuthorizeTag.java:54) at org.apache.jsp.WEB_002dINF.template.header_jsp._jspx_meth_sec_005fauthorize_005f1(header_jsp.java:292) at org.apache.jsp.WEB_002dINF.template.header_jsp._jspx_meth_sec_005fauthorize_005f0(header_jsp.java:227) at org.apache.jsp.WEB_002dINF.template.header_jsp._jspService(header_jsp.java:137) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.htt…
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25143908
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/39086569
type: Question
tagged with: spring-security
has title: Enable Spring Expression Language when using custom FilterSecurityInterceptor
has comment: http://stackoverflow.com/comment/39135954
answer count: 1

http://stackoverflow.com/comment/90850358
has text: Please describe what was broken and how you fixed it.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/51949869

http://stackoverflow.com/comment/39108569
score: 0
has text: You can add an additional attribute in your JSON response.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25126787

http://stackoverflow.com/comment/39103935
has text: hey yes to detect move left or right finger must be on bottom right thirds of the screen , to detect jumps, throwstar or punch swipe motion must be made anywhere on sreen other then that bottom left third
comment on: http://stackoverflow.com/q/25091411
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39104531
comment on: http://stackoverflow.com/a/25124667
type: Comment
score: 2
has text: Nope, exiting a sync block doesn't perform an automatic notify().
type: AnswerComment

http://stackoverflow.com/a/25077872
answers question: http://stackoverflow.com/q/25074851
type: Answer
score: 2
upvote count: 2
has body: You have to ask yourself the question: From whom do i want to protect the password? As @Martin already said, the sysadmin will always have access, and he should as he is the one maintaining the system. You can not hide anything from the admin of a server. So i would go with configuration files. The one who will set up the database for your application will also configure a password (and username) for the database in the configuration file. Just make sure that not everyone can read the configuration file, so that only privileged users can read the file, that is the best you can do.
downvote count: 0

http://stackoverflow.com/comment/39054617
type: Comment
has text: and if there are f.e. 3 String[][][] saved. How to get the 3 normal Strings? String[][] new1 = future.??; String[][] new2 = future.??; String[][] new3 = future.??;
comment on: http://stackoverflow.com/a/25094450
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39196308
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25173966
has text: Similar question [here](http://stackoverflow.com/questions/9436074/scala-trait-companion-object-is-not-visible-in-java) but it about *methods* **not** about interfaces.

http://stackoverflow.com/comment/39086572
type: QuestionComment
comment on: http://stackoverflow.com/q/25115059
has text: ah, found it, I'll post an answer
score: 0
type: Comment

http://stackoverflow.com/a/25195392
type: Answer
has body: You don't have it exactly correct. When jetty uses an NIO connector (and 9 only supports NIO) it works as follows: Idle state as a few threads (1-4 depending on # cores) calling the selector, looking for IO activity. This has been scaled to over 1,000,000 connections on Jetty. When selector sees IO activity, it calls a handle method on the connection, which either: something else has registered that it is blocked waiting for IO for this connection, so in that case the selector just wakes up whoever was blocked. otherwise a thread is dispatched to handle the connection. If a thread is dispatched, then it will attempt to read the connection and parse it. What happens now depends on if the connection is http, spdy, http2 or websocket. for http, if the request headers are complete, the thread goes on to call the handling of the request (eventually this gets to the servlet) without waiting for any content. for http2/spdy another dispatch is required, but see the discussion about Eat-What-You-Kill strategy on the list: http://dev.eclipse.org/mhonarc/lists/jetty-dev/msg02166.html for websocket the message handling is called. Once a thread is dispatched to a servlet, it looks to it like the servlet IO is blocking, but underneath the level of HttpInputStream and HttpOutputStream all the IO is async with callbacks. The blocking API uses a special blocking callback to achieve blocking. This means that if the servlet chooses to use async IO, then it is just bypassing the blocking callback and using the async API more or less directly. A servlet can suspend using request.startAsync, in which case the dispatched thread is returned to the thread pool, but the associated connection is not marked as interested in IO. Async IO can be performed, but a AsyncContext event is need to either reallocate a thread or to re-enroll the connection for IO activity once the async cycle is complete. This view is slightly complicated by http2 and spdy, which are multiplexed, so they can involve an …
downvote count: 0
score: 40
has comment: http://stackoverflow.com/comment/56110727
accepted answer of: http://stackoverflow.com/q/25195128
answers question: http://stackoverflow.com/q/25195128
type: AcceptedAnswer
upvote count: 40

http://stackoverflow.com/a/25194041
answers question: http://stackoverflow.com/q/25193147
has comment: http://stackoverflow.com/comment/39234306
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/39309538
score: 1
has body: Your configuration explicitly preserves all classes, fields, and methods, except the ones in the specified packages. That should be what you want. You can check the effect of your configuration with -printseeds seeds.txt The generated file contains a list of the explicitly preserved classes, fields, and methods. If some classes seem to disappear, you should double-check the input directories or input jars. You can also check if the -injars or -outjars options in your configuration have filters.
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25193147

http://stackoverflow.com/comment/39065093
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25103492
has text: Currently I'm just removing them after the result has been provided. I'm wondering if there's any sort of special cases posed by the unary operator. I can post the code solution otherwise, if that's what you're referring to.
score: 0

http://stackoverflow.com/a/25132562
has body: It is an application context . Same one that you get with method getApplicationContext() But: This instance is a ReceiverRestrictedContext with two main functions disabled; calling registerReceiver() and bindService(). These two functions are not allowed from within an existing BroadcastReceiver.onReceive(). Each time a receiver processes a broadcast, the Context handed to it is a new instance.
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25132399

http://stackoverflow.com/q/25208016
has answer: http://stackoverflow.com/a/34366055
has comment: http://stackoverflow.com/comment/39259601
upvote count: 2
has body: I am attempting to Debug a simple Java Server Application hosted on localhost on any given port. Within Eclipse I run it in debug mode to wait on an incoming connection. When I run my a browser to retrieve data from the server I get nothing. If I run the Application outside of Eclipse, everything is fine and my pages are served. Is there anything I need to do in Eclipse to enable ports or anything? I saw this post: How does Eclipse debug code in an application server? but that is only informational. Any help would be great.
tagged with: java
linked to: http://stackoverflow.com/q/343947
has answer: http://stackoverflow.com/a/25208177
type: Question
tagged with: eclipse
answer count: 2
has title: How do I Debug Java Application Server in Eclipse?
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 2

http://stackoverflow.com/comment/39258318
score: 0
type: Comment
type: QuestionComment
has text: Ah, of course sorry. I'm so used to javascript these variable types are unfamiliar!
comment on: http://stackoverflow.com/q/25207419

http://stackoverflow.com/q/25218585
has comment: http://stackoverflow.com/comment/39279331
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/39279344
has comment: http://stackoverflow.com/comment/39279578
answer count: 3
tagged with: functional-programming
tagged with: monads
has comment: http://stackoverflow.com/comment/39280084
downvote count: 0
has answer: http://stackoverflow.com/a/25218835
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/29686385
tagged with: java-8
has comment: http://stackoverflow.com/comment/39279643
has title: Logging in functional programming with Java
has answer: http://stackoverflow.com/a/25239296
tagged with: java
has comment: http://stackoverflow.com/comment/39279914
has body: I am fairly new to Functional Programming and I am trying to use Lambda features in Java to try doing FP. I know Java is not a good choice for learning Functional but in my office I am restricted to use Java and would love to apply some of these principles there. I created an Optional monad type thing in Java which looks something like this: public abstract class Optional&lt;T&gt; implements Monad&lt;T&gt; { //unit function public static &lt;T&gt; Optional&lt;T&gt; of(T value) { return value != null ? new Present&lt;T&gt;(value) : Absent.&lt;T&gt;instance(); } @Override public &lt;V&gt; Monad&lt;V&gt; flatMap(Function&lt;T, Monad&lt;V&gt;&gt; function) { return isPresent() ? function.apply(get()) : Absent.&lt;V&gt;instance(); } } I am using this for avoiding nested null checks in my code, a typical use case where I use this is when I need something like firstNonNull. Use: String value = Optional.&lt;String&gt;of(null) .or(Optional.&lt;String&gt;of(null)) //call it some reference .or(Optional.of("Hello")) //other reference .flatMap(s -&gt; { return Optional.of(s.toLowerCase()); }) .get(); This works as a charm. Now the question is that how do I combine logging with this? What if I need to know which of these reference was used? This is useful if there is some semantic attached with those references and I need to log that this reference was not found, trying other option. Log: some reference is not present and some other business case specific log Is this possible to achieve in Java? I tried to read some possible solutions from web and found Writer monad of Haskell, but I got confused and couldn't follow. EDIT Link to the gist
type: Question

http://stackoverflow.com/q/25142342
answer count: 1
has comment: http://stackoverflow.com/comment/39137948
type: UnansweredQuestion
tagged with: mime-types
linked to: http://stackoverflow.com/q/51438
has answer: http://stackoverflow.com/a/30765235
has comment: http://stackoverflow.com/comment/39137000
has title: How to get MIME type of file?
has comment: http://stackoverflow.com/comment/39138622
tagged with: java
has body: I am trying to get MIME type of files in java. Using below code I am getting MIME Type: application/octet-stream Code: MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap(); String mimeType = mimeTypesMap.getContentType(filePath); for PDF but I am expecting application/PDF. Is there any way to get exact MIME type of file?
type: Question
has comment: http://stackoverflow.com/comment/64379675
has comment: http://stackoverflow.com/comment/39138803
duplicate of: http://stackoverflow.com/q/51438
score: 0
has comment: http://stackoverflow.com/comment/39136884

http://stackoverflow.com/q/25130788
has comment: http://stackoverflow.com/comment/39117100
has title: Java String Calculator
has comment: http://stackoverflow.com/comment/39116002
upvote count: 4
has comment: http://stackoverflow.com/comment/39116044
has comment: http://stackoverflow.com/comment/39116054
has comment: http://stackoverflow.com/comment/39115946
has comment: http://stackoverflow.com/comment/39116027
downvote count: 0
has comment: http://stackoverflow.com/comment/39117167
tagged with: java
has comment: http://stackoverflow.com/comment/39115931
has answer: http://stackoverflow.com/a/29760041
has comment: http://stackoverflow.com/comment/39117214
has comment: http://stackoverflow.com/comment/39117216
type: Question
has body: I'm trying to make a simple calculator in Java which takes input in the form of a string and does a simple '+' and '-' operation. Single digit inputs work but my problem is when i try to implement this for double digit input string is: 5+20+5+11 list 1 = [5, 20, 2, 0, 5, 11, 1] list 2 = [+, +, +] Answer:27 I need to find a way where after storing [5] in list1 how i can add [5,20] instead of [5,20,2,0] which the current code is doing. public int calC(String input) { int len = input.length(); ArrayList list1 = new ArrayList(); ArrayList list2 = new ArrayList(); for (int i = 0; i &lt; len; i++) { if ((input.charAt(i) != '+') &amp;&amp; (input.charAt(i) != '-')) { // check if the number is double-digit if ((i + 1 &lt;= len - 1)) { if ((input.charAt(i + 1) != '+')&amp;&amp; (input.charAt(i + 1) != '-')) { String temp = ""; temp = temp + input.charAt(i) + input.charAt(i + 1); int tempToInt = Integer.parseInt(temp); // adding the double digit number list1.add(tempToInt); } // add single digit number list1.add(input.charAt(i) - '0'); } } else { // adding the symbols list2.add(input.charAt(i)); } } int result = 0; result = result + (int) list1.get(0); for (int t = 0; t &lt; list2.size(); t++) { char oper = (char) list2.get(t); if (oper == '+') { result = result + (int) list1.get(t + 1); } else if (oper == '-') { result = result - (int) list1.get(t + 1); } } return result; } Edit: working version @Ker p pag thanks for the updated methods input string is: 5+20+5+11 [5, 20, 5, 11] [+, +, +] Answer:41 I'll need to try to implement this with stack as suggested but the current version works static boolean isDigit(char check) { if (Character.isDigit(check)) { return true; } return false; } public static int calC(String input) { int len = input.length(); ArrayList list1 = new ArrayList(); ArrayList list2 = new ArrayList(); for (int i = 0; i &lt; len; i++) { if ((i + 1 &lt;= len - 1)) { if (isDigit(input.charAt(i)) &amp;&amp; isDigit(input.charAt(i + 1))) { String temp = input.charAt…
has answer: http://stackoverflow.com/a/25130994
score: 4
has comment: http://stackoverflow.com/comment/39116090
has answer: http://stackoverflow.com/a/25131057
has comment: http://stackoverflow.com/comment/39115972
has comment: http://stackoverflow.com/comment/39116139
has answer: http://stackoverflow.com/a/60126134
has comment: http://stackoverflow.com/comment/39115988
has comment: http://stackoverflow.com/comment/39117132
has answer: http://stackoverflow.com/a/25130945
has answer: http://stackoverflow.com/a/25130911
has comment: http://stackoverflow.com/comment/39115982
favorite count: 0
has comment: http://stackoverflow.com/comment/39115923
has comment: http://stackoverflow.com/comment/39115916
answer count: 9
has answer: http://stackoverflow.com/a/66812689
has comment: http://stackoverflow.com/comment/39115953
has answer: http://stackoverflow.com/a/25131878
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/71110608

http://stackoverflow.com/q/25084104
tagged with: https
type: Question
possible better answer: http://stackoverflow.com/a/25084224
tagged with: ssl
answer count: 2
upvote count: 7
has answer: http://stackoverflow.com/a/25084634
accepted answer: http://stackoverflow.com/a/25084634
has title: HTTPS certificate validation fails when using a trustStore
favorite count: 0
has body: I'm getting the following error sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target when connecting to google maps geocoding API. I am able to reproduce the error in a simple Main program. Here's how to reproduce it with this test program: import javax.net.ssl.*; import java.net.*; import java.io.*; public class Main { public static void main(String[] args) { try { String httpsURL = "https://maps.googleapis.com/maps/api/geocode/json?address=49+874%2Cla+plata%2Cbuenos+aires%2Cargentina&amp;sensor=false&amp;key=AIzaSyAJ1QS0C6KjiWajwxx4jUb_Jz0b8lBZyyE"; URL myurl = new URL(httpsURL); HttpsURLConnection con = (HttpsURLConnection) myurl.openConnection(); InputStream ins = con.getInputStream(); InputStreamReader isr = new InputStreamReader(ins); BufferedReader in = new BufferedReader(isr); String inputLine; while ((inputLine = in.readLine()) != null) { System.out.println(inputLine); } in.close(); } catch (IOException ex) { System.err.println(ex.getMessage()); } } } Saved as Main.java Compile it javac Main.java Run it java Main I get the normal result (json response is printed). But if I create a TrustStore with a certificate from here: https://www.clic.gob.ar/ I downloaded the SSL certificate and saved it as an X.509 PEM file named clic.gob.ar Create a new TrustStore named keystorefede.jks keytool -import -file clic.gob.ar -alias clicCert -keystore keystorefede.jks I gave it password tompass. I can list it keytool -list -keystore keystorefede.jks -storepass tompass Tipo de Almacén de Claves: JKS Proveedor de Almacén de Claves: SUN Su almacén de claves contiene 1 entrada cliccert, 01/08/2014, trustedCertEntry, Huella Digital de Certificado (SHA1): 15:3B:67:EE:51:C9:F2:CF:68:7C:24:51:A4:B6:6E:AE:EA:61:D5:B5 Now run the same program using the trustStore java -Djavax.net.ssl.trustStore=/home/fede/keystorefede.jks -Djavax.net.ssl.trustStoreP…
has answer: http://stackoverflow.com/a/25084224
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/51156870
score: 7
tagged with: java

http://stackoverflow.com/a/25186226
downvote count: 0
score: 1
has body: You told JPA cascade all! and passed detached object to save, that is an issue. According to Hibernate doc CascadeType.PERSIST works when you persist department when you persists employee. As per hibernate doc: CascadeType.PERSIST: cascades the persist (create) operation to associated entities persist() is called or if the entity is managed So your options: Pass managed or transient department object attached to employee object. Merge detached one before persisting? Remove cascade all and select only cascade types you need Remove cascade type at all. See hibernate doc
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25185747
answers question: http://stackoverflow.com/q/25185747

http://stackoverflow.com/a/39140526
has body: Mutable &nbsp;&nbsp;&nbsp;&nbsp;:- Changeable Immutable :- Unchangeable String in Java is immutable. However what does it mean to be mutable in programming context is the first question. Consider following class, public class Dimension { private int height; private int width; public Dimenstion() { } public void setSize(int height, int width) { this.height = height; this.width = width; } public getHeight() { return height; } public getWidth() { return width; } } Now after creating the instance of Dimension we can always update it's attributes. Note that if any of the attribute, in other sense state, can be updated for instance of the class then it is said to be mutable. We can always do following, Dimension d = new Dimension(); d.setSize(10, 20);// Dimension changed d.setSize(10, 200);// Dimension changed d.setSize(100, 200);// Dimension changed Let's see in different ways we can create a String in Java. String str1 = "Hey!"; String str2 = "Jack"; String str3 = new String("Hey Jack!"); String str4 = new String(new char[] {'H', 'e', 'y', '!'}); String str5 = str1 + str2; str1 = "Hi !"; // ... So, str1 and str2 are String literals which gets created in String constant pool str3, str4 and str5 are String Objects which are placed in Heap memory str1 = "Hi!"; creates "Hi!" in String constant pool and it's totally different reference than "Hey!" which str1 referencing earlier. Here we are creating the String literal or String Object. Both are different, I would suggest you to read following post to understand more about it. Difference between string object and string literal In any String declaration, one thing is common, that it does not modify but it gets created or shifted to other. String str = "Good"; // Create the String literal in String pool str = str + " Morning"; // Create String with concatenation of str + "Morning" |_____________________| |- Step 1 : Concatenate "Good" and " Morning" with StringBuilder |- Step 2 : assign reference of created "Good Morning" Stri…
downvote count: 0
answers question: http://stackoverflow.com/q/25138587
type: Answer
score: 6
upvote count: 6

http://stackoverflow.com/a/25164511
accepted answer of: http://stackoverflow.com/q/25160879
answers question: http://stackoverflow.com/q/25160879
has body: I don't know if you got it yet, but maybe the @GeneratedValue is a problem for it is different from the Sites' @GeneratedValue but if that is not the case then maybe change @OneToMany(fetch = FetchType.EAGER, mappedBy = "site", cascade = CascadeType.ALL To @OneToMany(cascade= {CascadeType.ALL }, mappedBy="mcrPosTran") @LazyCollection(LazyCollectionOption.FALSE) And change in the sector @ManyToOne @JoinColumn(name = "IDSITE") private Site site; To @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name = "IDSITE") private Site site;
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/25197471
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/39239719
has comment: http://stackoverflow.com/comment/39239686
has body: Scope matters. The List you are accessing is local to the main() method. You can access that only within the main() method. Move that to top level, which should be an instance member( and provide a getter to return that as well) to access.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25197450
answers question: http://stackoverflow.com/q/25197450

http://stackoverflow.com/comment/39297602
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25228385
score: 0
has text: I would a) use a 2D array and b) flip the index values

http://stackoverflow.com/q/25107974
tagged with: java
has answer: http://stackoverflow.com/a/25108080
tagged with: rgb
type: Question
has comment: http://stackoverflow.com/comment/39073259
answer count: 1
has comment: http://stackoverflow.com/comment/39073267
downvote count: 0
favorite count: 0
tagged with: colors
accepted answer: http://stackoverflow.com/a/25108080
has title: Changing color components in Java
upvote count: 1
tagged with: graphics
type: AnsweredQuestion
tagged with: components
has body: Is there a way to change the individual color components in Java graphics programming (apart from the brighter() and darker() methods? For example, if I create a Color object with r,g,b color components and then wish to modify one of them is there a way to do so? Color x = new Color(255,0,0); Is there a way to quickly change one of the individual color components?
score: 1

http://stackoverflow.com/a/25184159
has comment: http://stackoverflow.com/comment/39215238
has comment: http://stackoverflow.com/comment/39214116
answers question: http://stackoverflow.com/q/25183968
has comment: http://stackoverflow.com/comment/57086918
has comment: http://stackoverflow.com/comment/39214987
has comment: http://stackoverflow.com/comment/39214171
score: 7
has comment: http://stackoverflow.com/comment/39214590
has body: Using Webcam Capture project. Example from author for the API usage: Webcam buildin = Webcam.getWebcams().get(0); // build-in laptop camera Webcam usb = Webcam.getWebcams().get(1); // usb camera BufferedImage image1 = buildin.getImage(); BufferedImage image2 = usb.getImage(); // do with image1 and image2 whatever you want
has comment: http://stackoverflow.com/comment/39214648
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41997149
has comment: http://stackoverflow.com/comment/39239304
has comment: http://stackoverflow.com/comment/40212291
has comment: http://stackoverflow.com/comment/39214829
type: Answer
accepted answer of: http://stackoverflow.com/q/25183968
downvote count: 0

http://stackoverflow.com/comment/39084007
comment on: http://stackoverflow.com/q/25113820
has text: "I am having some issues". What issues? Show os the stacktrace of the error.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39053668
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25096332
type: Comment
has text: Run Receive.main (it will wait) and then run Send.main. Does this work?

http://stackoverflow.com/a/25219513
upvote count: 1
has body: I also don't see a really elegant, built-in way to do this, but would like to propose a solution similar to that of Dici: public static &lt;T&gt; Set&lt;T&gt; asSet(Optional&lt;T&gt; opt) { return opt.isPresent() ? Collections.singletonSet(opt.get()) : Collections.emptySet(); } This avoids the creation of a new HashSet instance and the insertion of the optional object. (Note: This is basically the "inlined" version of what Guavas Present and Absent classes do: The Present class returns the singletonSet, and the Absent class returns the emptySet). The usage would be similar to your original pattern: for( final User u : asSet(getUserOptional()) ) { return u.isPermitted(getPermissionRequired()); }
answers question: http://stackoverflow.com/q/25219277
type: Answer
downvote count: 0
score: 1

eclipse-plugin
tags question: http://stackoverflow.com/q/25119484
tags question: http://stackoverflow.com/q/25180291
type: Tag
tags question: http://stackoverflow.com/q/25139423
tags question: http://stackoverflow.com/q/25197134
tags question: http://stackoverflow.com/q/25074113
tags question: http://stackoverflow.com/q/25230136
tags question: http://stackoverflow.com/q/25198704
tags question: http://stackoverflow.com/q/25125130
tags question: http://stackoverflow.com/q/25202596
tags question: http://stackoverflow.com/q/25192604
tags question: http://stackoverflow.com/q/25123849
tags question: http://stackoverflow.com/q/25180834
tags question: http://stackoverflow.com/q/25179865
tags question: http://stackoverflow.com/q/25112078
tags question: http://stackoverflow.com/q/25095221
tags question: http://stackoverflow.com/q/25200319
tags question: http://stackoverflow.com/q/25199447
tags question: http://stackoverflow.com/q/25138623
tags question: http://stackoverflow.com/q/25184185
tags question: http://stackoverflow.com/q/25075867
tags question: http://stackoverflow.com/q/25136607
tags question: http://stackoverflow.com/q/25223188
tags question: http://stackoverflow.com/q/25094583
tags question: http://stackoverflow.com/q/25135880
tags question: http://stackoverflow.com/q/25143338
tags question: http://stackoverflow.com/q/25188182
tags question: http://stackoverflow.com/q/25213086
tags question: http://stackoverflow.com/q/25114054
tags question: http://stackoverflow.com/q/25074839
tag name: eclipse-plugin
tags question: http://stackoverflow.com/q/25204315
tags question: http://stackoverflow.com/q/25164774
tags question: http://stackoverflow.com/q/25205448

http://stackoverflow.com/q/25183754
score: 13
tagged with: switch-statement
type: Question
possible better answer: http://stackoverflow.com/a/25183880
tagged with: enums
answer count: 2
accepted answer: http://stackoverflow.com/a/25183826
downvote count: 0
favorite count: 0
has title: switch over value of enum: case expressions must be constant expressions
has body: I have an enum with the following structure: public enum Friends { Peter("Peter von Reus", "Engineer"), Ian("Ian de Villiers", "Developer"), Sarah("Sarah Roos", "Sandwich-maker"); private String fullName; private String occupation; private Person(String fullName, String occupation) { this.fullName = fullName; this.occupation = occupation; } public String getFullName() { return this.fullName; } public String getOccupation() { return this.occupation; } } I would now like to use switch to determine, if a variable name is associated with a certain enum: //Get a value from some magical input String name = ... switch (name) { case Friends.Peter.getFullName(): //Do some more magical stuff ... break; case Friends.Ian.getFullName(): //Do some more magical stuff ... break; case Friends.Sarah.getFullName(): //Do some more magical stuff ... break; } This seems perfectly legal to me, but I'm getting the error case expressions must be constant expressions in Eclipse. I can get around this with a simple set of if statements but I would like to know the reason for this error and how things might go south if this was allowed. NOTE: I cannot change the structure of Friends
upvote count: 13
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25183880
has answer: http://stackoverflow.com/a/25183826

http://stackoverflow.com/comment/39177186
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25163524
has text: 08-06 16:59:32.237: D/MediaPlayer(5988): Couldn't open file on client side, trying server side 08-06 16:59:32.240: W/dalvikvm(5988): JNI WARNING: received null jstring (GetStringUTFChars) 08-06 16:59:32.241: W/dalvikvm(5988): in Landroid/media/MediaPlayer;.updateProxyConfig:(Landroid/net/ProxyProperties;)V (GetStringUTFChars)
score: 0

http://stackoverflow.com/comment/39012338
comment on: http://stackoverflow.com/a/25075078
score: 0
type: AnswerComment
type: Comment
has text: Uhh, The `8544.38` in `BigDecimal(8544.38)` is a double... But yeah, going from a string is fine.

http://stackoverflow.com/comment/39052288
score: 2
has text: It can't because that isn't valid XML. Why is it in there?
comment on: http://stackoverflow.com/q/25096744
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39168896
score: 0
type: Comment
type: QuestionComment
has text: @OliverWatkins Its an AWT Component!
comment on: http://stackoverflow.com/q/25159712

http://stackoverflow.com/a/26756637
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25212405
has body: You've run into a bug in Selenium: https://code.google.com/p/selenium/issues/detail?id=7977 https://code.google.com/p/selenium/issues/detail?id=3544 (Yes, the two bug reports are related.) There's a problem in Selenium whereby if you try to terminate the driver while an alert is active, you'll get e is null or a number of other error messages. As Lawrence Tierney mentioned, you should make sure that the alert is closed before terminating the driver. Your code should do this whether or not the assert is successful.
downvote count: 0

http://stackoverflow.com/q/25186231
score: 0
has answer: http://stackoverflow.com/a/25186266
tagged with: sqlite
answer count: 1
has title: Android app writing to SQLite database
type: UnansweredQuestion
tagged with: android
tagged with: java
has body: I am trying to write to the local SQLlite database on my android app. I have created a method in the handler that opens the database, but it is crashing the app. I know from using logs that it is the line: db = helper.getWritableDatabase(); That is causing the crash, but I have no idea why. Below is the handler class: public static final String TAG = "TableSubandObAssessment"; public static final String KEY_TABLE = "assessments"; private static final String KEY_APPOINTMENT_ID = "appointmentID"; private static final String KEY_TYPE = "type"; private static final String KEY_ASSESSMENT = "assessment"; private static final String KEY_VARIABLE1 = "variable1"; private static final String KEY_VARIABLE2 = "vriable2"; private static final String KEY_VARIABLE3 = "vriable3"; private static final String KEY_VARIABLE4 = "vriable4"; private static DatabaseHelper helper; private static Context context; public static SQLiteDatabase db; static public void createTable(SQLiteDatabase db) { String createTbl = "CREATE TABLE " + KEY_TABLE + " (" + KEY_APPOINTMENT_ID + " INTEGER PRIMARY KEY NOT NULL, " + KEY_TYPE + " TEXT NOT NULL, " + KEY_ASSESSMENT + " TEXT NOT NULL, " + KEY_VARIABLE1 + " TEXT, " + KEY_VARIABLE2 + " TEXT NOT NULL, " + KEY_VARIABLE3 + " TEXT, " + KEY_VARIABLE4 + " TEXT " + ");"; db.execSQL(createTbl); } public static void dropTable(SQLiteDatabase db) { db.execSQL("DROP TABLE IF EXISTS " + KEY_TABLE); createTable(db); } public TableSubandObAssessment(Context context) { this.context = context; } public static SQLiteDatabase open() throws SQLException { helper = new DatabaseHelper(context); db = helper.getWritableDatabase(); return db; } public static void close() { helper.close(); } public static long insertTableSubandObAssessment(int appointmentID, String type, String assessment, String variable1, String variable2, String variable3, String variable4) { ContentValues values = new ContentValues(); values.put(KEY_APPOINTMENT_ID, appointmentID); values.put(KEY_TYPE, type); va…
type: Question
tagged with: database

http://stackoverflow.com/q/25210690
tagged with: tablecell
has body: I'm trying to add a change listener to my CheckBoxTableCells but it doesn't seem to be working. I took the example for CheckBoxes figuring they would work the same way. However there is no output when i change its value. How would i add one correctly to a checkboxtablecell? current code: tc.setCellFactory(new Callback&lt;TableColumn&lt;Trainee, Boolean&gt;, TableCell&lt;Trainee, Boolean&gt;&gt;() { @Override public TableCell&lt;Trainee, Boolean&gt; call(TableColumn&lt;Trainee, Boolean&gt; p) { final CheckBoxTableCell ctCell = new CheckBoxTableCell&lt;&gt;(); ctCell.selectedProperty().addListener(new ChangeListener&lt;Boolean&gt;() { @Override public void changed(ObservableValue ov, Boolean old_val, Boolean new_val) { System.out.println(new_val); } }); return ctCell; } });
score: 3
upvote count: 3
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/25212097
type: Question
tagged with: tableview
downvote count: 0
has comment: http://stackoverflow.com/comment/39264359
linked to: http://stackoverflow.com/q/24144951
answer count: 1
favorite count: 0
tagged with: listener
has comment: http://stackoverflow.com/comment/39265284
accepted answer: http://stackoverflow.com/a/25212097
has title: CheckBoxTableCell changelistener not working
type: AnsweredQuestion

http://stackoverflow.com/comment/39280625
has text: An other possible fix is to put an "operation pending" flag in the database and if someone tries to run it while another process is already running it, then return an "already running, try again later" message. Deadlock problem solved.
type: Comment
comment on: http://stackoverflow.com/a/25209379
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39089104
type: Comment
comment on: http://stackoverflow.com/q/25116466
type: QuestionComment
has text: Yes, why do you need parsing manifests? Why can't you just put second jar on clasp path and import it?
score: 0

http://stackoverflow.com/q/25123522
has body: I have a table view that is populated with dynamic columns that I create in the controller. The first time I create the table everything works fine, but when I try to redraw the table using new items I get a null pointer exception which seems to be caused by some nested columns I use (from reading the stack trace). When redrawing the table I take the same steps I took when I created it the first time which are: Remove all items (first using clear then using remove all, just to be sure) tableFullTimetable.getItems().clear(); tableFullTimetable.getItems().removeAll(); Remove all columns (same with columns) tableFullTimetable.getColumns().clear(); tableFullTimetable.getColumns().removeAll(); I then add my dynamic nested columns using a for loop and after that, set the new items on the table tableFullTimetable.setItems(myNewItems); I understand that table view has refresh issues but I think this is different, the table gets cleared but when execution gets to the line of setting it throws the null pointer exception, here's the stack trace for the error: Exception in thread "JavaFX Application Thread" java.lang.NullPointerException at com.sun.javafx.scene.control.skin.NestedTableColumnHeader.dispose(NestedTableColumnHeader.java:323) at com.sun.javafx.scene.control.skin.NestedTableColumnHeader.updateTableColumnHeaders(NestedTableColumnHeader.java:265) at com.sun.javafx.scene.control.skin.NestedTableColumnHeader.checkState(NestedTableColumnHeader.java:519) at com.sun.javafx.scene.control.skin.NestedTableColumnHeader.computePrefHeight(NestedTableColumnHeader.java:401) at javafx.scene.Parent.prefHeight(Parent.java:918) at javafx.scene.layout.Region.prefHeight(Region.java:1438) at com.sun.javafx.scene.control.skin.TableHeaderRow.computePrefHeight(TableHeaderRow.java:344) at com.sun.javafx.scene.control.skin.TableHeaderRow.computeMinHeight(TableHeaderRow.java:339) at javafx.scene.Parent.minHeight(Parent.java:946) at javafx.scene.layout.Region.minHeight(Region.java:1404) at java…
has answer: http://stackoverflow.com/a/25125395
tagged with: javafx-8
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39105874
score: 1
favorite count: 0
has title: Java fx tableview throws null pointer exception when setting new items
has comment: http://stackoverflow.com/comment/39105687
accepted answer: http://stackoverflow.com/a/25125395
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39105085
tagged with: java
tagged with: javafx
upvote count: 1
type: Question

http://stackoverflow.com/comment/39266790
type: Comment
type: QuestionComment
has text: Every Json Parsing Api will not work as far as I'm aware, It's because a supplier doesn't return the result in an array even though it generally is an array
comment on: http://stackoverflow.com/q/25211906
score: 0

http://stackoverflow.com/q/25116532
linked to: http://stackoverflow.com/q/5921042
has answer: http://stackoverflow.com/a/25116598
type: Question
favorite count: 0
has answer: http://stackoverflow.com/a/33461442
upvote count: 8
tagged with: javac
answer count: 3
accepted answer: http://stackoverflow.com/a/25116598
has answer: http://stackoverflow.com/a/25116568
possible better answer: http://stackoverflow.com/a/33461442
has body: I've always used an IDE when working with Java so my knowledge on the javac command isn't that great. I want to know this: Does java generate the directories where the .class files should be placed in as specified in the .java files package declarations? Let me clarify, say you have a simple .java file like this on your Desktop: package com.deangrobler.test public class Test { // ... } When running the following from your Desktop: javac Test.java Will it then automatically go and create the com/deangrobler/test directories and place the Test.class file therein?
has title: Does the javac command automatically create directories specified in the package declaration?
downvote count: 1
has comment: http://stackoverflow.com/comment/39089040
type: AnsweredQuestion
score: 7
tagged with: java

http://stackoverflow.com/comment/39188031
comment on: http://stackoverflow.com/a/25169463
score: 0
type: AnswerComment
has text: hey hi erm you were saying i'm passing a reference already but which part is it that i'm passing to? is it the no parameter constructor? sorry i'm still a newbie hoping to learn from everyone and understand more about the whole thing. :)
type: Comment

http://stackoverflow.com/comment/39266963
has text: With an anonymous class, I can't call methods on it from the outside that aren't a part of the Thread class.
type: Comment
comment on: http://stackoverflow.com/q/25211904
type: QuestionComment
score: 0

http://stackoverflow.com/a/25188138
type: AcceptedAnswer
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/39223762
answers question: http://stackoverflow.com/q/25187691
has body: I just reread your question and the answer just hit me. I somehow missed that your custom ViewPager is an inner class of TestActivity. If you want to reference nested classes in XML you have to do it like this: &lt;com.example.android.example.TestActivity$MainMenuViewPager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/tabs" /&gt;
downvote count: 0
has comment: http://stackoverflow.com/comment/39223946
has comment: http://stackoverflow.com/comment/39222369
accepted answer of: http://stackoverflow.com/q/25187691
score: 5

http://stackoverflow.com/a/26073928
has comment: http://stackoverflow.com/comment/40888614
upvote count: 2
answers question: http://stackoverflow.com/q/25176643
has comment: http://stackoverflow.com/comment/51020999
has comment: http://stackoverflow.com/comment/41138505
score: 2
has comment: http://stackoverflow.com/comment/41090893
has comment: http://stackoverflow.com/comment/51199455
downvote count: 0
has body: You can attach MqttCallback listener to MqttAsyncclient . It has callback method connection lost which will get called when connection lost event occured or paho disconnects.
type: Answer

http://stackoverflow.com/comment/39057603
has text: @Sotirios Actually figured out using [this question](http://stackoverflow.com/questions/11294107/how-can-i-send-the-ampersand-character-via-ajax) found via googling. The problem may be somewhere else, so not flagging a dupe. (not that it would be too much of one anyway.)
comment on: http://stackoverflow.com/q/25099498
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25131358
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25131067
has body: The problem is that your input does not only contain the tokens you're looking for, but also commas and spaces, apparently. Thus, you have to tell your Scanner to use a specific delimiter to understand that he has to tokenise your input stream on this String. I'd recommend you to use the following regex as a delimiter for your Scanner: ,\s*|\s+ This would split your input on: any comma, followed by eventually some spaces, or at least one space. Consider this sample code: try (final Scanner s = new Scanner(System.in)) { s.useDelimiter(",\\s*|\\s+"); String dim; do { dim = s.next(); if (dim.equals("r")) { System.out.println(s.nextInt()); System.out.println(s.nextInt()); System.out.println(s.nextInt()); System.out.println(s.nextInt()); } } while (!dim.equals("end")); } Just by entering: r 1, 2, 3, 4, end ... on the console, I got the following output: 1 2 3 4 ... It works! Also, as a side note, I'd like to point out that, in order to compare Strings in Java, you should use the String#equals method, and not the primitive comparators. Thus, you should use (as I did in my sample code) !dim.equals("end") instead of dim != "end".
type: Answer

http://stackoverflow.com/comment/39182919
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25166573
type: Comment
has text: Interesting. It looks like it might work. +1. If the OP confirms it works, I'll delete my answer.

http://stackoverflow.com/comment/39163197
comment on: http://stackoverflow.com/q/25155701
has text: @Orion all enum constants are static. And if they would not be static you would get a compiler error in static block.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39112026
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25128554
has text: @AnubianNoob Ok can u use that to render them then? Any examples?

http://stackoverflow.com/a/25871790
downvote count: 0
has body: You can use a private BroadcastReceiver to update the UI. Here goes the declaration for BroadcastReceiver: public class MyFragment extends Fragment { // Declare UI elements private final BroadcastReceiver receiver = new MyBroadcastReceiver(); // Initialize elements in onCreate @Override public void onResume() { super.onResume(); IntentFilter filter = new IntentFilter("UPDATE_MY_FRAGMENT"); getActivity().registerReceiver(receiver, filter); } @Override public void onPause() { super.onPause(); getActivity().unregisterReceiver(receiver); } private class MyBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // Read data from intent.getExtras() // update UI elements } } } And send an intent from registerUser to the private BrodcastReceiver: public static void registerUser(final Context context) throws JSONException { RestHttpClient.get("?Operation=RegisterUser" , params, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { Intent intent = new Intent("UPDATE_MY_FRAGMENT"); // pass data using intent.putExtra based on response context.sendBroadcast(intent); } @Override public void onFailure(int statusCode, Header[] headers,String responseString, Throwable throwable) { Intent intent = new Intent("UPDATE_MY_FRAGMENT"); // pass data using intent.putExtra based on response context.sendBroadcast(intent); } }); }
answers question: http://stackoverflow.com/q/25112267
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/39202523
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25139716
has text: sure: see SimpleOnScaleGestureListener.onScale
score: 0

http://stackoverflow.com/a/25213560
type: Answer
has comment: http://stackoverflow.com/comment/39337043
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25213416
answers question: http://stackoverflow.com/q/25213416
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39334707
has body: First, you have a different validator for every type of name. You say you have ten names: public interface Name { } public class ShortName implements Name { } public class LongName implements Name { } public class MaidenName implements Name { } and so on. Then you have to validate a name. public interface Name { public void validate(); } which will make your other names throw compiler errors because they don't have the setName(...) method. So add it. public class ShortName implements Name { private String name; public void validate() { // the first pass at validation if (name == null) { throw IllegalStateException("Name cannot be null"); } // the second pass at validation if ("".equals(name)) { throw IllegalStateException("Name has a zero length"); } // ok, the name is valid } } Once you have one of these for every name, you can now do this. List&lt;Name&gt; names = getNames(); for (Name name : names) { names.validate(); } and each type of name will run it's unique validator.
has comment: http://stackoverflow.com/comment/39334930

http://stackoverflow.com/q/25175284
tagged with: android
has body: So I have received a task to develop a prototype software for testing the software/hardware component of android. Example: By using the software I can send a command from my PC to my android to change the color of screen display without interacting with the devices(touch,shake or other possible gestures). I would like to know how do I actually start. The whole idea is actually messed up in my mind. Because after a few days of research I haven't found any topic related to what I am going to do. I am still fresh with java so please go easy on me :) Any help is much appreciated.
score: 0
has title: Android Test Platform Generator using java
answer count: 1
tagged with: java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2203495
has answer: http://stackoverflow.com/a/25175638
has comment: http://stackoverflow.com/comment/39198524
type: Question

http://stackoverflow.com/comment/39287124
has text: Check these for relevancy: http://stackoverflow.com/questions/860187/access-restriction-on-class-due-to-restriction-on-required-library-rt-jar?rq=1 , http://stackoverflow.com/questions/9266632/access-restriction-is-not-accessible-due-to-restriction-on-required-library?rq=1
comment on: http://stackoverflow.com/q/25222811
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25188387
type: Answer
has body: This is because Arrays.asList returns an immutable list. http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#asList(T...) An immutable list will throw an exception when a modification is attempted.
has comment: http://stackoverflow.com/comment/39222474
score: 0
answers question: http://stackoverflow.com/q/25188336

http://stackoverflow.com/comment/39243453
type: AnswerComment
type: Comment
has text: have you changed `user` to `use`
comment on: http://stackoverflow.com/a/25198818
score: 0

http://stackoverflow.com/comment/39274251
has text: Look at the code! It is expecting 2 cmd params.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25215832

http://stackoverflow.com/q/25102023
has answer: http://stackoverflow.com/a/25102136
answer count: 1
has body: I am writing a program which creates objects, referenced in an ArrayList which starts as an empty ArrayList. The user populates it at runtime based on information that they provide. I am attempting to serialize the ArrayList and the classes that build its objects using the standard try { FileOutputStream fs = new FileOutputStream("Foo.ser"); ObjectOutputStream os = new ObjectOutputStream(fs); os.writeObject(barList); os.close(); } catch(IOException ex) { ex.printStackTrace(); When the program runs the first time, the file (foo.ser) has not been created yet, so to attempt to use the corresponding FileInputStream method to retrieve state will, to the best of my knowledge, cause a file not found exception. I considered using an if statement checking for foo.ser, and only implementing the FileInputStream if it was found, but the format for the file check seems to be an absolute path. That doesn't seem to be the candidate for a robust solution. How do you get the ball rolling on Serialization if your program starts off with no object state and no Foo.ser?
score: 0
tagged with: serialization
accepted answer: http://stackoverflow.com/a/25102136
has comment: http://stackoverflow.com/comment/39062173
has title: Catch-22 in serialization
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39062216
tagged with: java
type: Question

http://stackoverflow.com/comment/39048279
has text: No - you should read up on XML. If I just add the corrected XML, that will give very little benefit. Where did this XML come from? Did you copy and paste it from somewhere?
type: Comment
comment on: http://stackoverflow.com/q/25094517
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39059242
type: QuestionComment
has text: YES IT IS COMING FROM TWO DIFFERENT QUERYS AGAINST THE DATABASE
comment on: http://stackoverflow.com/q/25097350
score: 0
type: Comment

http://stackoverflow.com/comment/39277988
comment on: http://stackoverflow.com/q/25217815
type: Comment
type: QuestionComment
score: 1
has text: `void add(T... valueArr)` and `void add(T[] valueArr)` are same but you need to construct the array manually to pass it in second form.

http://stackoverflow.com/comment/127599805
type: Comment
score: 1
type: AnswerComment
has text: I think you meant .setFillPattern(FillPatternType.NO_FILL)
comment on: http://stackoverflow.com/a/25208192

http://stackoverflow.com/comment/39053218
type: Comment
has text: Oh yeah, my bad, you used a ListActivity. So, di dyou pout logs to see where the code goes ?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25088247

http://stackoverflow.com/q/25230136
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: org.eclipse.swt.SWTException: Failed to execute runnable
tagged with: java
has body: I have integrate the JFormDesigner in my eclipse Version: 3.3.2, error that i faced is not completely in the subject as it is restricted with 150 characters. So i have listed below: org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NoSuchMethodError: org.eclipse.jface.internal.text.html.BrowserInformationControl.&lt;init&gt;(Lorg/eclipse/swt/widgets/Shell;IILjava/lang/String;)V) at org.eclipse.swt.SWT.error(SWT.java:4083) at org.eclipse.swt.SWT.error(SWT.java:3998) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) 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.eclip…
score: -1
tagged with: eclipse
downvote count: 1
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/25230379
tagged with: jform-designer
tagged with: eclipse-plugin

http://stackoverflow.com/q/25165178
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25165557
tagged with: java
type: Question
has body: I am using Java(64 bit) and trying to connect with Ms Acess(32 bit) database.I am following this tutorial. I had 2 ODBC Data Source option in my Administrative tool one for 32 bit and other for 64 bit.So i had created my system dsn in ODBC Data Source(32 bit) because i was unable to create in 64 bit. When I executed my java code it gives a runtime error Exception: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application I have searched a bit and found that its because of the bit difference between Ms Acess(32 bit) and Java(64 bit). Is there any way by which i can solve this problem without changing the bit version of java or application or without installing any other drivers? Is it possible? I tried similar stack issues but dint get any solution apart from changing bit version,I also tried MSDN but that dint work. Any help would be appreciated
tagged with: difference
score: 2
downvote count: 0
linked to: http://stackoverflow.com/q/21955256
linked to: http://stackoverflow.com/q/8895823
has answer: http://stackoverflow.com/a/25165557
answer count: 1
tagged with: ms-access
favorite count: 0
has title: how to solve the architecture difference proplem while acessing ms-acess with java without changing the bit version of driver or application
upvote count: 2
tagged with: architecture

http://stackoverflow.com/q/25099642
answer count: 1
tagged with: printing
tagged with: exception
upvote count: 1
has answer: http://stackoverflow.com/a/25099686
accepted answer: http://stackoverflow.com/a/25099686
favorite count: 0
downvote count: 0
type: AnsweredQuestion
has title: Try block starts printing while printStackTrace method is Printing
score: 1
tagged with: java
tagged with: stack-trace
type: Question
has body: public class Argon { public static void main(String[] args) { Basil basil = new Basil(); Scanner in = new Scanner(System.in); do { try { System.out.println("Please enter a number!"); String num1 = in.nextLine(); System.out.println("Please enter another number!"); String num2 = in.nextLine(); basil.numberCruncher(num1, num2); System.out.println(basil.getSum()); break; } catch (NumberException e) { e.printStackTrace(); } } while (true); } } The code above works tries a block of code and catches any errors that occur. I purposefully supplied an error and the code prints the following. Please enter a number! nop Please enter another number! w NumberException: Your Program Went Bananas. Please enter a number! at Basil.numberCruncher(Basil.java:23) at Argon.main(Argon.java:15) The Stack Trace has not been fully printed, but the try block starts executing anyways. Why does this occur and what could I do to fix it?

http://stackoverflow.com/comment/132308322
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/74974442
has text: Nice. Can I upvote again? ;-) If the format is `0001-03-10`, you don’t need a custom formatter. You just need to detect whether the prefix is `0001` (use `"0001-03-10".startsWith("0001")`). Then `MonthDay.parse("0001-03-10", DateTimeFormatter.ISO_LOCAL_DATE)` yields `--03-10`.

http://stackoverflow.com/comment/39195107
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25173165
has text: You should add an explanation.
type: AnswerComment

http://stackoverflow.com/comment/39121982
type: Comment
has text: I am afraid that I entered similar problem to that one: http://stackoverflow.com/questions/15059240/android-httppost-generates-get-response?rq=1
comment on: http://stackoverflow.com/a/25129609
score: 0
type: AnswerComment

swt
tags question: http://stackoverflow.com/q/25164282
tags question: http://stackoverflow.com/q/25188182
tags question: http://stackoverflow.com/q/25105664
tags question: http://stackoverflow.com/q/25107278
tags question: http://stackoverflow.com/q/25073316
tags question: http://stackoverflow.com/q/25197047
tags question: http://stackoverflow.com/q/25103915
tags question: http://stackoverflow.com/q/25202545
tags question: http://stackoverflow.com/q/25128206
tags question: http://stackoverflow.com/q/25192604
tags question: http://stackoverflow.com/q/25190241
tags question: http://stackoverflow.com/q/25181139
tags question: http://stackoverflow.com/q/25116232
tags question: http://stackoverflow.com/q/25223637
tags question: http://stackoverflow.com/q/25188687
tags question: http://stackoverflow.com/q/25074188
tags question: http://stackoverflow.com/q/25198704
tags question: http://stackoverflow.com/q/25161661
tags question: http://stackoverflow.com/q/25112349
tags question: http://stackoverflow.com/q/25227580
tags question: http://stackoverflow.com/q/25201285
tags question: http://stackoverflow.com/q/25179865
tags question: http://stackoverflow.com/q/25134298
tags question: http://stackoverflow.com/q/25155696
type: Tag
tags question: http://stackoverflow.com/q/25213086
tags question: http://stackoverflow.com/q/25226930
tags question: http://stackoverflow.com/q/25076802
tags question: http://stackoverflow.com/q/25092575
tags question: http://stackoverflow.com/q/25114106
tag name: swt
tags question: http://stackoverflow.com/q/25169545

http://stackoverflow.com/comment/39403843
has text: I am able to get the above Json format. I used the following code : value = value.trim(); value = value.substring(1, value.length()-1); value = value.replace("\\", "\"");
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25284238
type: AnswerComment

http://stackoverflow.com/q/25182330
has answer: http://stackoverflow.com/a/25182383
linked to: http://stackoverflow.com/q/787700
answer count: 4
has comment: http://stackoverflow.com/comment/39210614
has comment: http://stackoverflow.com/comment/39210732
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25182496
upvote count: 3
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39210612
has answer: http://stackoverflow.com/a/25182380
has answer: http://stackoverflow.com/a/25182373
has comment: http://stackoverflow.com/comment/39210657
has comment: http://stackoverflow.com/comment/39210689
score: 2
linked to: http://stackoverflow.com/q/3144610
favorite count: 0
possible better answer: http://stackoverflow.com/a/25182383
has title: Double datatype is not returning decimal values (Java)
tagged with: double
has body: I was doing a simple GUI program in NetBeans to find area of a circle. I used double datatype but the answer was not coming properly. Statement: double area = (22/7)*r*r; //r is the radius. When I input the value of r as 4, the answer is 48.0. Why is not coming in proper decimal points ?
accepted answer: http://stackoverflow.com/a/25182373

http://stackoverflow.com/comment/124442887
type: Comment
comment on: http://stackoverflow.com/a/70397949
type: AnswerComment
score: 0
has text: Please, fix the indentation in the code block and explain in the answer why node class should be used. Why do you use a static nested class when it's not meant to be accessed from outside the outer class? Non-static would be ok.

http://stackoverflow.com/a/34685568
has comment: http://stackoverflow.com/comment/59265161
answers question: http://stackoverflow.com/q/25203501
type: Answer
has comment: http://stackoverflow.com/comment/59262132
score: 90
has comment: http://stackoverflow.com/comment/58984834
has body: The typical solution is to define the shape and use it as background but as the number of digits varies it's no more a perfect circle, it looks like a rectangle with round edges or Oval. So I have developed this solution, it's working great. Hope it will help someone. Here is the code of custom TextView import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.util.AttributeSet; import android.widget.TextView; public class CircularTextView extends TextView { private float strokeWidth; int strokeColor,solidColor; public CircularTextView(Context context) { super(context); } public CircularTextView(Context context, AttributeSet attrs) { super(context, attrs); } public CircularTextView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override public void draw(Canvas canvas) { Paint circlePaint = new Paint(); circlePaint.setColor(solidColor); circlePaint.setFlags(Paint.ANTI_ALIAS_FLAG); Paint strokePaint = new Paint(); strokePaint.setColor(strokeColor); strokePaint.setFlags(Paint.ANTI_ALIAS_FLAG); int h = this.getHeight(); int w = this.getWidth(); int diameter = ((h &gt; w) ? h : w); int radius = diameter/2; this.setHeight(diameter); this.setWidth(diameter); canvas.drawCircle(diameter / 2 , diameter / 2, radius, strokePaint); canvas.drawCircle(diameter / 2, diameter / 2, radius-strokeWidth, circlePaint); super.draw(canvas); } public void setStrokeWidth(int dp) { float scale = getContext().getResources().getDisplayMetrics().density; strokeWidth = dp*scale; } public void setStrokeColor(String color) { strokeColor = Color.parseColor(color); } public void setSolidColor(String color) { solidColor = Color.parseColor(color); } } Then in your XML, give some padding and make sure its gravity is center &lt;com.app.tot.customtextview.CircularTextView android:id="@+id/circularTextView" android:layout_width="wrap_content" android:layout_height="wrap_conte…
downvote count: 0
has comment: http://stackoverflow.com/comment/57627882
has comment: http://stackoverflow.com/comment/59265208
has comment: http://stackoverflow.com/comment/87113545
has comment: http://stackoverflow.com/comment/63678106
has comment: http://stackoverflow.com/comment/73700459
upvote count: 90
has comment: http://stackoverflow.com/comment/69146132

http://stackoverflow.com/comment/39053191
comment on: http://stackoverflow.com/q/25097006
type: Comment
has text: I'd try to figure out *why* it was printing a stack trace at the time the thread was suspended. Does part of it show up in the log?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39198988
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25163228
has text: I explained with sample. You can check it above.

http://stackoverflow.com/a/25206358
has comment: http://stackoverflow.com/comment/39256669
answers question: http://stackoverflow.com/q/25206318
type: Answer
has body: This is an infinite loop: for(int i=0;;i++){ Whatever comes after it never get executed (i.e. is unreachable).
upvote count: 10
score: 10
downvote count: 0
has comment: http://stackoverflow.com/comment/39257079

http://stackoverflow.com/q/25159472
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/55862953
has comment: http://stackoverflow.com/comment/39168422
tagged with: jersey-2.0
downvote count: 0
score: 4
accepted answer: http://stackoverflow.com/a/25159618
favorite count: 0
has body: What I am trying to do is that after executing the following REST API the Browser should alert the "Hello World!!" string in the browser. I thought annotating the function with @Produces("text/javascript") will take care of it. But as I am hitting the resource at the following url http://localhost:8080/JAXRS-HelloWorld/rest/script/helloWorld JAXRS-HelloWorld is the name of the App and I have specified the url as /rest* I am getting everything as String. Not as executable Javascript code. package com.bablo.rest; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Response; @Path("script") public class JavaScriptTesting { @GET @Produces("text/javascript") @Path("/helloWorld") public Response helloWorld(){ String responseParam = "alert(Hello World!!)"; return Response.ok(responseParam).build(); } } How to get the Browser to execute the alert function? Can we achieve this just by doing some trick in the Server Side REST API?
tagged with: rest
has answer: http://stackoverflow.com/a/55862953
upvote count: 4
has answer: http://stackoverflow.com/a/25159618
has title: How to return javascript code to be executed by client in Jersey Rest?
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/46033308
comment on: http://stackoverflow.com/a/28885921
has text: What is the purpose of the second `for` loop? It has only one iteration ... _always_. And the value of `j` is _always_ the same as in `i`.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/39263350
type: AnswerComment
score: 0
has text: Can you give me an example of an input that fails? That would be helpful is making sure my solution is accurate. (AKA how many items, their weights/associated values and my knap sack weight. Thanks
type: Comment
comment on: http://stackoverflow.com/a/25209766

http://stackoverflow.com/q/25149528
type: Question
linked to: http://stackoverflow.com/q/2567416
tagged with: java
has answer: http://stackoverflow.com/a/45620995
has body: I want to convert SOAPBody to String. What is the best way to do it? Should i first convert it to xml and then convert it into String or we can jsut convert it into String.
answer count: 3
has comment: http://stackoverflow.com/comment/39150931
upvote count: 21
tagged with: string
has comment: http://stackoverflow.com/comment/39150954
favorite count: 0
type: UnansweredQuestion
tagged with: soap
has answer: http://stackoverflow.com/a/25149671
downvote count: 0
score: 21
has title: How to convert SOAPBody to String
has answer: http://stackoverflow.com/a/48040031

http://stackoverflow.com/q/25212470
has body: This question is very specific to me, so I cannot find related questions on Stack Overflow. So, I'm coding a grep shown below. I am confused on the stringindextoutofboundexception. The reason for that is because I am checking whether it is equals to \0. That means I am handling the out of bound exception, no? Example: grep("hello","llo"); This will return 3. That is because its start matching at original[2] which is position 3. However, I am encountering an out of index error. I've spent hours and I can't figure it out. public static int grep(String ori, String ma){ int toReturn = 0; int oCounter = 0; int i = 0; while (i &lt; ma.length()){ if (ori.charAt(toReturn) == ma.charAt(i)){ i++; if (ma.charAt(i) == '\0'){ // error on this line return toReturn; } toReturn++; if (ori.charAt(toReturn) == '\0'){ // and this line if i delete the section above. return -1; } } else { i = 0; toReturn++; } } return -1; }
score: 0
has comment: http://stackoverflow.com/comment/39268986
has comment: http://stackoverflow.com/comment/39267993
answer count: 1
has title: Recursive grep with good efficiency
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25212556
type: Question

http://stackoverflow.com/comment/39120876
has text: Yes correct but depends what other options you have.
type: AnswerComment
comment on: http://stackoverflow.com/a/25133510
type: Comment
score: 0

http://stackoverflow.com/comment/39274434
has text: How would you enter the parameters? I thought I had to enable "Prompt for main method arguments", but it doesn't work.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25215915
type: Comment

http://stackoverflow.com/a/25110498
upvote count: 3
score: 3
has body: Declare a variable for url: &lt;c:url value='/user' var='userUrl'/&gt; then use it in form: &lt;form action="${userUrl}" method="post" ....
answers question: http://stackoverflow.com/q/25110478
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25110478
type: Answer

http://stackoverflow.com/a/25097822
has comment: http://stackoverflow.com/comment/52195134
has body: You might try calling Camera.release() in your onPause() method.
type: Answer
answers question: http://stackoverflow.com/q/25097771
score: 0
has comment: http://stackoverflow.com/comment/39054408

http://stackoverflow.com/a/25192492
type: AcceptedAnswer
has body: I was reading the wrong config file. When I enabled multicast join to true, the cluster was formed. I will try tcp besides that as well. I should have read the config file being read when I started the hazelcast server
type: Answer
accepted answer of: http://stackoverflow.com/q/25192422
downvote count: 0
answers question: http://stackoverflow.com/q/25192422
score: 1
upvote count: 1

http://stackoverflow.com/comment/39055978
type: QuestionComment
comment on: http://stackoverflow.com/q/25098705
score: 0
has text: Try using handler for delay.
type: Comment

http://stackoverflow.com/comment/39252626
has text: It is still not clear to me what you exact problem is. Do you ask how to submit to the server, which Checkbox was clicked? Or do you want to know how to load the data from the database in the JSP?
comment on: http://stackoverflow.com/q/25204160
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/111367960
comment on: http://stackoverflow.com/a/25092630
type: AnswerComment
type: Comment
has text: I am irritated that this answer was accepted because it answer does not explain why both advisors and aspects exist in Spring, [my answer](https://stackoverflow.com/a/25094033/1082681) does though. What is said about advisors (being combinations of advice + pointcut) is also true for aspects, only an aspect is much more flexible and can contain multiple pointcuts and/or advices.
score: 1

erasure
tag name: erasure
type: Tag
tags question: http://stackoverflow.com/q/25181869

http://stackoverflow.com/q/25177337
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
tagged with: log4j
has answer: http://stackoverflow.com/a/25280785
type: UnansweredQuestion
score: 1
upvote count: 1
has title: Make dependency write to the main log file
type: Question
tagged with: java
has body: I'm developing an Android app that writes to a log file using android-log4j. The android app has a dependency that also needs to write to this log. This dependency (which is also written by our team) is a maven project with these log dependencies required: log4j log4j 1.2.17 test org.slf4j slf4j-api 1.7.5 org.slf4j slf4j-log4j12 1.7.6 test Is there a way to make the dependency jar to write its logs to the main log of the Android app? Thanks!

http://stackoverflow.com/comment/39161394
has text: can you post the logcat error
score: 0
comment on: http://stackoverflow.com/q/25155031
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39102217
comment on: http://stackoverflow.com/q/25123245
has text: Solved. The preferences were missing an option to suggest Java related proposal.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25225802
answers question: http://stackoverflow.com/q/25225771
has body: when we run a java program to command prompt, we can pass some input to our Java program. Those inputs are stored in this String args array.
upvote count: 1
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/a/25135550
has body: private ArrayList results = new ArrayList(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); PackageManager pm = this.getPackageManager(); Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.addCategory(Intent.CATEGORY_LAUNCHER); List&lt;ResolveInfo&gt; list = pm.queryIntentActivities(intent, PackageManager.PERMISSION_GRANTED); for (ResolveInfo rInfo : list) { results.add(rInfo.activityInfo.applicationInfo.packageName); Log.w("Installed Applications", rInfo.activityInfo.applicationInfo .loadLabel(pm).toString()); } This gives list of all package names installed in your device. rInfo.activityInfo.applicationInfo.loadLabel(pm) .toString(); This gives u the app names. rInfo.loadIcon(getPackageManager()); And this gives the appicon.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25134140
has comment: http://stackoverflow.com/comment/39126011

http://stackoverflow.com/q/25101477
has answer: http://stackoverflow.com/a/25101592
answer count: 1
type: UnansweredQuestion
has body: Youtube users write video titles like artistname - songname like Eminem - Soldiers So, if I want to search ARTIST (not song) named Love, I will have to search Love - I tried max-results=1&amp;q=intitle:"Love -"&amp;orderby=viewCount&amp;restriction=US or equivalently max-results=1&amp;q=intitle:%22Love%20-%22&amp;orderby=viewCount&amp;restriction=US But then it gives videos like Eminem - Love The Way You Lie ft. Rihanna which contains - and Love, but doesn't contain Love - Is there any way I can code it? I currently trying Java, but if including - only works in another language, then I am willing to change language. Alternative plan Alternatively, if I can make something like "search video title that has Love and - but - comes later than Love " that will be good too. Then video titles like Love you - blahblah will be also searched, because - appears after Love, but Eminem - Love the way you lie won't be search, because - appears earlier than Love
tagged with: youtube
tagged with: java
tagged with: youtube-data-api
tagged with: youtube-api
has title: Including "-" in Youtue API's phrase search
type: Question
score: 0

http://stackoverflow.com/comment/39077348
score: 0
has text: 'Non-static inner' is a tautology.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25110023

http://stackoverflow.com/q/25134851
has comment: http://stackoverflow.com/comment/39128238
has comment: http://stackoverflow.com/comment/39127624
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/50761971
tagged with: plsql
downvote count: 0
answer count: 1
favorite count: 0
tagged with: oracle-database
tagged with: jdbc
has body: I'm calling a plsql package procedure from Java. This procedure has an type parameter which carries a timestamp. When I'm setting a timestamp parameter directly to a procedure I can specify a Calendar object to declare the time zone to use e. g. Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC")); statement.setTimestamp(1, new Timestamp(calendar.getTimeInMillis()), calendar); Is there a way to declare a timezone when using an oracle.sql.ARRAY or oracle.sql.STRUCT ? The used types are declared as follows: CREATE OR REPLACE TYPE "TY_EVENT_OBJECT" AS OBJECT ( timestamp_event date, state number(15), parameter_name varchar2(248), value number(15) ); CREATE OR REPLACE TYPE "TY_EVENTS" AS TABLE OF TY_EVENT_OBJECT; The Type TY_EVENTS is one parameter of the plsql procedure i have to use.
has title: Setting time zone when passing oracle.sql.ARRAY to PL/SQL procedure
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/39126192

http://stackoverflow.com/a/25122520
score: 0
has comment: http://stackoverflow.com/comment/39108519
has comment: http://stackoverflow.com/comment/39135214
has comment: http://stackoverflow.com/comment/39142107
has comment: http://stackoverflow.com/comment/39102466
answers question: http://stackoverflow.com/q/25121726
has body: Why don't you use ParseQueryAdapter https://www.parse.com/docs/android/api/?com/parse/ParseObject.html? I think it is the best way to fetch data from Parse and display it as a list. If you want to use some simple mappings between data in list and visual representation of a list just create new ParseQueryAdapter and select columns from that you will fetch data to image and to text field of ListView item. ParseQueryAdapter&lt;ParseUser&gt; adapter = new ParseQueryAdapter&lt;&gt;(this, ParseUser.class); adapter.setTextKey("username"); adapter.setImageKey("userpic"); mListView.setAdapter(adapter); Check this tutorial https://www.parse.com/tutorials/mealspotting it will help you
type: Answer
has comment: http://stackoverflow.com/comment/39126614
has comment: http://stackoverflow.com/comment/39119309
has comment: http://stackoverflow.com/comment/39108461
has comment: http://stackoverflow.com/comment/39107983
has comment: http://stackoverflow.com/comment/39133743

http://stackoverflow.com/comment/39019525
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25078363
has text: System.out.println(Arrays.deepToString(result)); and System.out.println(d3); yields same output List<List<List<String>>>

http://stackoverflow.com/comment/39163955
comment on: http://stackoverflow.com/q/25156724
type: Comment
has text: Oh! Do I need to update CounterIncThread and CounterDecThread classes?
score: 0
type: QuestionComment

http://stackoverflow.com/q/25193120
linked to: http://stackoverflow.com/q/17275392
linked to: http://stackoverflow.com/q/20839275
answer count: 0
type: UnansweredQuestion
upvote count: 1
has body: I've been experimenting with Wordnet on Python, and decided to jump to Java because of the apparently better API's. I'm trying to replicate the top answer to this question> Getting all nouns related to a verb in WordNet using JWNL But, I'm using IntelliJ Idea, and it cannot resolve the symbol "proc" in the first line IndexWord indexWord = proc.lookupBaseForm(POS.VERB,"bear"); I'm sure I'm missing something really simple, but I was able to remove the errors by the other symbols with import net.didion.jwnl.data.IndexWord; import net.didion.jwnl.data.POS; import net.didion.jwnl.data.Synset; import net.didion.jwnl.data.Word; I can't seem to contact the person who originally wrote the answer and I can't comment on his answer since I don't have the necessary reputation. Also, I assume I have to specify the Wordnet library location? On http://lyle.smu.edu/~tspell/jaws/ it says to use System.setProperty("wordnet.database.dir", "C:\WordNet-3.0\dict\"); But then again, that's the JAWS library and I'm trying to work with the JWNL library... I hope this isn't confusing, I just recently (in the last few days) started using JAVA... UPDATE I found this previous question and I did the recommendations, but I'm still getting a file not found exception when I do the initialize function, like the one here: Runtime error in using wordnet through JWNL, error in the props file
score: 1
tagged with: java
tagged with: wordnet
has comment: http://stackoverflow.com/comment/39241809
type: Question
has comment: http://stackoverflow.com/comment/39263784
has comment: http://stackoverflow.com/comment/39265063
has title: Wordnet with JWNL, getting it set up
has comment: http://stackoverflow.com/comment/39264115
downvote count: 0
has comment: http://stackoverflow.com/comment/39267560
favorite count: 0
linked to: http://stackoverflow.com/q/25114018

http://stackoverflow.com/a/25170385
score: 2
answers question: http://stackoverflow.com/q/25170278
upvote count: 2
has body: I guess this line can be useful to you: File image = new File(req.getServletContext().getRealPath("/") + "/carrousel/"+ req.getParameter("fileName")); I use it to create a new File in the server.
downvote count: 0
type: Answer

http://stackoverflow.com/a/25184402
has comment: http://stackoverflow.com/comment/39246672
has comment: http://stackoverflow.com/comment/39233872
accepted answer of: http://stackoverflow.com/q/25183571
score: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25183571
type: Answer
upvote count: 3
has body: First of all, save the isSelected() property in onSaveInstanceState() public final String STATE_SELECTED = "state_selected"; @Override public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); savedInstanceState.putBoolean(STATE_SELECTED, button.isSelected()); } Then access and use this value in onRestoreInstanceState() @Override public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); boolean selected = savedInstanceState.getBoolean(STATE_SELECTED); button.setSelected(selected); if (selected) // Do some stuff else //Do some other stuff } Hope this helps! Edit: In response to your comment, here's how you do this for an array of buttons: public final String STATE_SELECTED = "state_selected"; public Button[] buttons; // This is populated elsewhere @Override public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); boolean[] selected = new boolean[buttons.length]; for (int i = 0; i &lt; buttons.length; i++) selected[i] = buttons[i].isSelected(); savedInstanceState.putBooleanArray(STATE_SELECTED, selected); } @Override public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); boolean[] selected = savedInstanceState.getBooleanArray(STATE_SELECTED); for (int i = 0; i &lt; buttons.length; i++) button[i].setSelected(selected[i]); }

http://stackoverflow.com/a/25134396
downvote count: 0
has body: Yes, it is possible to change a CSS class dynamically according to the situation, but not with th:if. This is done with the elvis operator. Lorem Ipsum
has comment: http://stackoverflow.com/comment/90189551
type: Answer
answers question: http://stackoverflow.com/q/25133807
upvote count: 37
score: 37

http://stackoverflow.com/a/25181660
score: 0
answers question: http://stackoverflow.com/q/25178696
type: Answer
has body: try using something like that &lt;http pattern="/data/info**" security="none"/&gt;

http://stackoverflow.com/a/25131624
answers question: http://stackoverflow.com/q/25131556
score: 0
type: Answer
has body: import javax.swing.JOptionPane; public class AvgCalculator { public static void main(String[] args) { double total = 0; double SelectNumber = 0; int a = 0; double calcavgnow = 0; do { try { String UserInput = JOptionPane.showInputDialog("Enter the amount of numbers you would like to average"); SelectNumber = Integer.parseInt(UserInput); } catch (NumberFormatException e) { JOptionPane.showMessageDialog(null, "Value must be an integer!"); } } while (SelectNumber &lt; 1); double Numbers[] = new double[(int) SelectNumber]; for (a = 0; a &lt; Numbers.length; a++) { String EnterNumber = JOptionPane.showInputDialog("Please enter a number."); Numbers[a] = Double.parseDouble(EnterNumber); total += Numbers[a]; } calcavgnow = total / SelectNumber; JOptionPane.showMessageDialog(null, "The average entered is " + calcavgnow); } }

http://stackoverflow.com/comment/39220983
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25187447
type: Comment
has text: But everything works fine when I didn't use this button click

http://stackoverflow.com/comment/39228413
score: 1
has text: Links can go away. Any relevant information should be included as part of your question. If it is too long, you need to create an [MCVE](http://stackoverflow.com/help/mcve).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25190791

http://stackoverflow.com/comment/39280513
type: Comment
has text: @Athmos Thanks, i fixed that. Forgot about grouping 2s to form 8 as per algo.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25219056

http://stackoverflow.com/comment/39340792
score: 0
type: Comment
type: AnswerComment
has text: i replaced $var.month with $!{var.month.replace('"',"")} but it didnt print anything this time now.
comment on: http://stackoverflow.com/a/25243436

http://stackoverflow.com/comment/39270871
has text: Because anyone who knows basic OOP constructs knows that *you can't*. I thought that was inferred. The OP doesn't want to - there is no point, the method doesn't need any state. Also, turing* - and if you're really going to pull out ol' Alan, then there is really no winning this argument now, is there? ;)
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25213817

http://stackoverflow.com/comment/39033920
comment on: http://stackoverflow.com/a/25086632
has text: Is it the serialVersionUID of writer and reader or the actual data? I mean I can see a point in your argument about the data itself. But Why reader and writer should be same. One can implement them differently. Isn't it?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39106141
has text: In that case you will get `someOtherString` returned from above.
type: Comment
comment on: http://stackoverflow.com/a/25125499
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39083298
has text: There are too many questions here for one questions. Moreover, these questions are readily answered by reading about how hashed collections work in general.
comment on: http://stackoverflow.com/q/25113430
type: QuestionComment
type: Comment
score: 3

http://stackoverflow.com/comment/39264359
score: 0
type: Comment
type: QuestionComment
has text: I also made my own CheckBoxTableCell and it worked, but because of the functionality requirements i'd rather do it from within the class i'm currently working in.
comment on: http://stackoverflow.com/q/25210690

http://stackoverflow.com/q/25228571
has body: I'm working on a system for my university and I'm using the play framework to do that. The Admin of this system sets a marker on a google map and I get the coordinates from that point. Now I'm trying to pass this information to the server side, so that I might store these to Strings in a mySQL database. The only problem I have is passing the data from my String in javascript/JQuery to the java function. I tried different solutions on the internet but some of them seemed outdated and I couldn't figure out how to do it. I've only been programming in Java, Javascript, JQuery and PHP and have never used AJAX (like the $.get() methode from JQuery), but I think it might be pretty similar to what I know from PHP. e.g. http://java.dzone.com/articles/jquery-ajax-play-2 I'd like to pass my String with a button click to my java function, so I can store it in my db. I'm really confused about this. I know I can use something like &lt;a href="{@routes.Application.postMethod()}"&gt; Send &lt;/&gt; and then mention the function in the routes like POST /post controllers.Application.post(); but how do I pass my qjuery string? and how do I store my String as a String in a java function like: public static Result post(String Lat, String Lng){ ???????????? EVOLUTION NEEDED ????? } Thanks in advance I really need your help :)!
upvote count: 3
tagged with: playframework-2.3
has title: Sending a String in Javascript to java method in Play Framework
tagged with: java
accepted answer: http://stackoverflow.com/a/25229653
type: Question
type: AnsweredQuestion
score: 3
tagged with: javascript
answer count: 1
downvote count: 0
tagged with: jquery
favorite count: 0
tagged with: ajax
has answer: http://stackoverflow.com/a/25229653

http://stackoverflow.com/a/25140923
type: Answer
has body: First, it is bad practice to call a servlet from a jsp. As you are using @WebServlet("/servletName"), you can directly call it at http://host/context/servletName If you really need to call it from a jsp, you must forward to the servlet instead of including it as Suresh Atta explained. So you should use : &lt;jsp:forward page="/servletName"/&gt;
score: 0
answers question: http://stackoverflow.com/q/25140571

http://stackoverflow.com/comment/39056164
comment on: http://stackoverflow.com/a/25098776
score: 0
type: AnswerComment
type: Comment
has text: Ok, so it is always better to limit extendability of the system where possible? (I just added the third paragraph which asks this actually). I guess that is veering off onto a different topic in itself

http://stackoverflow.com/comment/39056228
has text: No, do not limit extendability. Why would you use an abstract class instead of an interface? Because your subclasses have some common code which you shouldn't duplicate. But if you only use an abstract class you cannot use a strategy that does not use this functionality ( unless you create empty methods, a whole different story).
comment on: http://stackoverflow.com/a/25098776
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39219360
comment on: http://stackoverflow.com/a/25153819
type: Comment
has text: Looks great! I appreciate you breaking it down for me more because I am now realizing that the `service tomcat xyz` bit is just a shell script that runs specific tasks with defined output to console. I probably should have included a disclaimer that I'm fairly new to Linux shell but it didn't occur to me it would matter too much. I feel like I learn more when I struggle through something and I enjoyed this. I ended up mixing your start/stop/restart script and [this one](http://www.excelsior-usa.com/articles/tomcat-amazon-ec2-java-stack.html) to get what I wanted. I'll mark as answered! Thanks
type: AnswerComment
score: 0

http://stackoverflow.com/a/25172276
answers question: http://stackoverflow.com/q/25172195
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25172195
score: 3
has body: I would have a class called ManaCost, which every card needs. enum ManaColor { RED, GREEN, BLUE, BLACK, WHITE; } class ManaCost { private int colorlessCost; private HashMap&lt;ManaColor,Integer&gt; colorCosts; public int getConvertedManaCost(){ int convertedManaCost = 0; for(Integer colorCost : colorCosts.values()){ convertedManaCost = convertedManaCost + colorCost; } convertedManaCost = convertedManaCost + colorlessCost; return convertedManaCost; } public Integer getColorCost(ManaColor color){ return this.colorCosts.get(color); } } class Card { private ManaCost manaCost; ... } Yep, I do play Magic :) ConvertedManaCost = sum of all mana costs.

http://stackoverflow.com/q/25181139
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39210850
has body: I'm having a problem while accessing a file that resides on a mapped network drive. I have a RCP application that runs on a Windows Client and I want to offer the user the possibility to import settings from a file the user can pick with a SWT FileDialog. As long as the file is on the local PC where the application runs there are no problems, but when I want to import the settings from a file that resides on a mapped network drive I get a FileNotFoundException although the file does exist. One thing I could find out is that this is a problem that the drive mapping is only valid for the logged in user, but the application needs the UNC path to access it. So what possibilities do I have to solve this problem? Does SWT offer the possibility to retrieve the UNC path of a file that resides on a mapped network drive? The only solution I found is that I could use the SWING JFileChooser, but I don't like the way this dialog is rendered. It just doesn't suit into my application and SWT uses the Windows native file dialog which looks much better ... Any other suggestion I could try out?
has comment: http://stackoverflow.com/comment/39209552
type: Question
tagged with: filedialog
tagged with: java-io
has comment: http://stackoverflow.com/comment/39210816
has comment: http://stackoverflow.com/comment/39209520
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39209213
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39209667
tagged with: swt
downvote count: 0
has title: Access File on a mapped network drive (Windows)

http://stackoverflow.com/comment/39125823
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25134298
has text: So do you want to actually select the text (to copy it somewhere) or do you want to check for click events?

http://stackoverflow.com/q/25161843
accepted answer: http://stackoverflow.com/a/25161909
tagged with: swing
has comment: http://stackoverflow.com/comment/39173126
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25161909
has body: I am trying to create a BackgroundImage class that has the purpose of creating a background with several image layers, I am using a JLayeredPane to achieve the layers. The background image will hold a permanent base image and will have methods that allows me(hopefully) to fade in and out images upon this base image. Right now i'm stuck at the base image being located wrong. Here is a image that shows the problem: As you can see in the image, there is a slight grey area above the image that is not supposed to be there. I would like the base image to take all the space. Here is a MCVE: BackgroundTest class import java.awt.*; import javax.swing.*; final class BackgroundTest extends JFrame { public static void main(String[] args) { new BackgroundTest(); } BackgroundTest() { JPanel contentPanel = new JPanel(); BackgroundImage bgImage = new BackgroundImage(contentPanel); add(contentPanel); setSize(getScreenDimension()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); setVisible(true); } public static Dimension getScreenDimension() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); Rectangle bounds = ge.getMaximumWindowBounds(); return new Dimension((int) bounds.getWidth(), (int) bounds.getHeight()); } } BackgroundImage class import java.awt.*; import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.*; import org.imgscalr.Scalr; class BackgroundImage { private final BaseImage baseImage; private final JPanel targetPanel; private final JLayeredPane layeredPane; BackgroundImage(JPanel targetPanel) { this.targetPanel = targetPanel; layeredPane = new JLayeredPane(); Dimension screenDimension = BackgroundTest.getScreenDimension(); layeredPane.setPreferredSize(screenDimension); layeredPane.setMaximumSize(screenDimension); layeredPane.setMinimumSize(screenDimension); baseImage = new BaseImage(); layeredPane.add(baseImage, new Integer(0)); targetPanel.add(layeredPane); …
tagged with: java
tagged with: image
type: Question
has title: Location of background image is wrong
tagged with: jlayeredpane
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/39173176
has comment: http://stackoverflow.com/comment/39173591

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/25157262
type: Tag
tags question: http://stackoverflow.com/q/25107974
tags question: http://stackoverflow.com/q/25210516
tags question: http://stackoverflow.com/q/25145454
tags question: http://stackoverflow.com/q/25171382
tags question: http://stackoverflow.com/q/25109068
tags question: http://stackoverflow.com/q/25100798
tags question: http://stackoverflow.com/q/25107747
tags question: http://stackoverflow.com/q/25092992
tags question: http://stackoverflow.com/q/25132895
tags question: http://stackoverflow.com/q/25222713
tags question: http://stackoverflow.com/q/25071307
tags question: http://stackoverflow.com/q/25187947
tags question: http://stackoverflow.com/q/25205130

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

http://stackoverflow.com/comment/39212848
has text: It looks like there's some Scala implicit lookup magic that's failing. Particularly, it looks like there are 2 different implicits for adding functionality (probably the `map` function) to Java `Iterable` to make it work like a Scala `Iterable`. I'm going to add the Scala tag, because that's where things are going wrong.
comment on: http://stackoverflow.com/q/25149833
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/25229736
has comment: http://stackoverflow.com/comment/39303940
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39304960
has comment: http://stackoverflow.com/comment/47677328
accepted answer of: http://stackoverflow.com/q/25229735
type: Answer
answers question: http://stackoverflow.com/q/25229735
has comment: http://stackoverflow.com/comment/39305554
has comment: http://stackoverflow.com/comment/39304206
has comment: http://stackoverflow.com/comment/39305405
has body: To create TableView: BorderPaneBuilder.create() .top(ToolBarBuilder.create() .items(ButtonBuilder.create() .text("Add New Row") .onAction(e -&gt; backendItemList.add(new MyItem("&lt;NEW&gt;", "&lt;NEW&gt;"))) .build()) .build()) .center( TableViewBuilder.&lt;CustomColumnNameMapping&gt; create() .items(backendItemList) .editable(true) .columns( TableColumnBuilder.&lt;CustomColumnNameMapping, String&gt; create() .text("Column1 for property1") .cellValueFactory(new WritablePropertyValueFactory&lt;&gt;("property1")) .cellFactory(TextFieldTableCell.forTableColumn()) .editable(true) .build(), TableColumnBuilder.&lt;CustomColumnNameMapping, String&gt; create() .text("Column2 for property2") .cellValueFactory(new WritablePropertyValueFactory&lt;&gt;("property2")) .cellFactory(TextFieldTableCell.forTableColumn()) .editable(true) .build()) .build()) .build(); WritablePropertyValueFactory.java: import javafx.beans.NamedArg; import javafx.beans.value.ObservableValue; import javafx.scene.control.TableColumn.CellDataFeatures; import javafx.scene.control.cell.PropertyValueFactory; import javafx.util.Callback; import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger.Level; import com.sun.javafx.property.PropertyReference; import com.sun.javafx.scene.control.Logging; // Original code from PropertyValueFactory // Replacing ReadOnlyObjectWrapper with new ReadableWritableObservableValue public class WritablePropertyValueFactory&lt;S, T&gt; implements Callback&lt;CellDataFeatures&lt;S, T&gt;, ObservableValue&lt;T&gt;&gt; { private final String property; private Class&lt;?&gt; columnClass; private String previousProperty; private PropertyReference&lt;T&gt; propertyRef; public WritablePropertyValueFactory(@NamedArg("property") String property) { this.property = property; } @Override @SuppressWarnings("unchecked") public ObservableValue&lt;T&gt; call(CellDataFeatures&lt;S, T&gt; param) { return getCellDataReflectively((T) param.getValue()); } public final String getPr…
score: 0

http://stackoverflow.com/a/25174670
score: 1
answers question: http://stackoverflow.com/q/25174506
downvote count: 0
has body: I believe this is equivalent to your posted code - private static String checkCompound(String symbol) { if (symbol.length() == 5) { return symbol.substring(0, 2); } else if (symbol.length() == 4) { return symbol.substring(0, 1); } return ""; } Then String letter1 = checkCompound(symbol1); String letter2 = checkCompound(symbol2); if (charge1 &gt; 0) { if (charge2 &gt; 0) { return letter1 + letter2; } return letter1 + charge2 + letter2; } else if (charge2 &gt; 0) { return letter1 + letter2 + charge1; } return letter1 + charge2 + letter2 + charge1; Finally, this if (possitive1 == 0) { possitive1 = -(charge1); } was removed because it's -0 which is 0.
has comment: http://stackoverflow.com/comment/39197668
type: Answer
has comment: http://stackoverflow.com/comment/39197402
upvote count: 1

http://stackoverflow.com/q/25136616
upvote count: 0
has answer: http://stackoverflow.com/a/25137775
has comment: http://stackoverflow.com/comment/39127959
favorite count: 0
has comment: http://stackoverflow.com/comment/39128743
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39128407
has comment: http://stackoverflow.com/comment/39128263
has answer: http://stackoverflow.com/a/26361102
tagged with: java
has comment: http://stackoverflow.com/comment/39126634
tagged with: swing
has title: Search DATA in Jtable
has body: I am implementing a search method, i want to search a data in a Jtable ( wich contains 2 columns id and name) based in id and name both. Till now I can search using just one of, id or name but cannot do that using them both. I tried a solution, but it is not working it just search for the last one ( id or name). For example if i start with try and catch by name and then id, it only goes with id search. And if I start with id and the name, it searches just by name. Can u help me please. The code : `private void textField1KeyReleased(java.awt.event.KeyEvent evt) { PreparedStatement pst=null; ResultSet rs=null; if (textField1.getText().length() &gt; 0){ try{ String sql = "select * from compte_utilisateur where nom=?"; pst=maConnexion.ObtenirConnexion().prepareStatement(sql); pst.setString(1, textField1.getText()); rs=pst.executeQuery(); TableUtilisateur.setModel(DbUtils.resultSetToTableModel(rs));} **catch(Exception e){JOptionPane.showMessageDialog(null, e);} try{ String sql = "select * from compte_utilisateur where id_utilisateur=?"; pst=maConnexion.ObtenirConnexion().prepareStatement(sql); pst.setString(1, textField1.getText()); rs=pst.executeQuery(); TableUtilisateur.setModel(DbUtils.resultSetToTableModel(rs));} catch(Exception e){JOptionPane.showMessageDialog(null, e);} } else update_table(); }`**
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/25100297
score: -1
tagged with: search
tagged with: jtable
answer count: 2

http://stackoverflow.com/comment/85000329
comment on: http://stackoverflow.com/q/25109942
type: Comment
type: QuestionComment
has text: @popgalop since this link is dead, is it available somewhere else may be?
score: 0

http://stackoverflow.com/q/25136439
type: UnansweredQuestion
has title: HtmlUnit download file
score: 3
has comment: http://stackoverflow.com/comment/39126110
tagged with: java
has comment: http://stackoverflow.com/comment/39126176
type: Question
has comment: http://stackoverflow.com/comment/39125934
answer count: 2
has answer: http://stackoverflow.com/a/28471835
has comment: http://stackoverflow.com/comment/39126481
tagged with: htmlunit
downvote count: 0
tagged with: javascript
favorite count: 0
has body: I am trying to download file via HTMLUnit. But every time when I use code like this: InputStream stream = anchor.click().getWebResponse().getContentAsStream(); i get website instead file. Download link looks like this: Is there any way to download this?
has answer: http://stackoverflow.com/a/45687835
upvote count: 3

http://stackoverflow.com/comment/39081905
type: Comment
type: QuestionComment
has text: As per my thing Paths to be used to get rid of the string concatenation but here i am doing that.
score: 0
comment on: http://stackoverflow.com/q/25112623

http://stackoverflow.com/comment/39282388
has text: -1 for not reading the javadoc for HashMap.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25220230
type: Comment

http://stackoverflow.com/q/25093627
has comment: http://stackoverflow.com/comment/39046788
has comment: http://stackoverflow.com/comment/39046660
has answer: http://stackoverflow.com/a/25093664
has answer: http://stackoverflow.com/a/25093684
has comment: http://stackoverflow.com/comment/39046659
has answer: http://stackoverflow.com/a/25093692
accepted answer: http://stackoverflow.com/a/25093660
has comment: http://stackoverflow.com/comment/39046763
has comment: http://stackoverflow.com/comment/39046643
answer count: 7
linked to: http://stackoverflow.com/q/7552660
linked to: http://stackoverflow.com/q/649407
favorite count: 0
has comment: http://stackoverflow.com/comment/39046656
possible better answer: http://stackoverflow.com/a/25093656
has answer: http://stackoverflow.com/a/25093656
downvote count: 6
has comment: http://stackoverflow.com/comment/39046646
type: AnsweredQuestion
has body: I'm getting the distance in string like "8.9km". I need to convert it to float. So if the string is "8.9km", the corresponding float will be 8.9 How to achieve this in Java? Note: The value can change to miles/meters also, since it is retrieved from Google Maps
has answer: http://stackoverflow.com/a/25093660
has answer: http://stackoverflow.com/a/25093818
upvote count: 2
has comment: http://stackoverflow.com/comment/39046770
tagged with: java
score: -4
has title: Convert string to float: "8.9km" to float
type: Question
has answer: http://stackoverflow.com/a/25093691

http://stackoverflow.com/comment/39067619
type: Comment
has text: you need to declare the checkboxes as class fields, inside the class yet outside of all methods. then, in onCreateView, set them equal to the findViewByID stuff, and also setOnClickListeners to them in that onCreateView method. i updated my answer to give you a better idea.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25100722

http://stackoverflow.com/comment/39270860
has text: the question is how do i insert values into the foreign key ALUMNUS_ID column in the APP.DUES table that reference the ALUMNUS_ID in the APP.ALUMNUS table
type: QuestionComment
comment on: http://stackoverflow.com/q/25212777
score: 0
type: Comment

http://stackoverflow.com/a/25101705
has comment: http://stackoverflow.com/comment/39061631
answers question: http://stackoverflow.com/q/25101659
has comment: http://stackoverflow.com/comment/39061608
downvote count: 0
has comment: http://stackoverflow.com/comment/39061575
has comment: http://stackoverflow.com/comment/39061680
type: Answer
upvote count: 1
has body: you are calling your method in loop: for(int i=0;i&lt;data.length;i++){ data[i]= read.getData(); } So it is printing multiple time. If you want to put all the values in data[] then you shall do following changes public String[] getData() throws InvalidFormatException, IOException{ String[] data = new String[15]; ... int k =0; ... String cellVal = row.getCell(j).getStringCellValue(); if(cellVal != null){ data[k++] = cellVal; }//if2 .... return data; } And from main method call it only once: String[] excelData = read.getData();
score: 1
has comment: http://stackoverflow.com/comment/39061542
has comment: http://stackoverflow.com/comment/39061557

http://stackoverflow.com/comment/39114837
has text: you might want to take a look at this [tutorial](http://theopentutorials.com/tutorials/android/listview/android-multiple-selection-listview/)
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25130196

http://stackoverflow.com/q/25106909
tagged with: liferay
answer count: 2
score: 0
has body: I'm trying to create new theme plugin in Liferay 6.2.1 in Eclipse with maven. When I followed the official tutorial it creates project with almost empty WEB-INF - no _diffs folder, css, images and others. What do I do wrong?
accepted answer: http://stackoverflow.com/a/26577319
tagged with: maven
possible better answer: http://stackoverflow.com/a/29683141
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26577319
tagged with: java
has answer: http://stackoverflow.com/a/29683141
tagged with: eclipse
has title: Eclipse doesn't generate parent theme files in Liferay maven project
type: Question

http://stackoverflow.com/comment/39125459
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25136116
has text: may b kindly can u give link for v2..
score: 0

http://stackoverflow.com/comment/39340954
comment on: http://stackoverflow.com/a/25243436
score: 0
type: AnswerComment
has text: If var.month is null don't print anything because there is '!'
type: Comment

http://stackoverflow.com/comment/39189615
type: Comment
has text: Turns out I was building with java 8 instead of 7.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25170001

http://stackoverflow.com/comment/39102162
type: Comment
score: 2
comment on: http://stackoverflow.com/q/25123413
has text: Maybe backslash the inner quotes? Something like `String regex = "address = \"...\""`
type: QuestionComment

nullable
tags question: http://stackoverflow.com/q/25172655
tag name: nullable
type: Tag

http://stackoverflow.com/a/25225066
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: The reason there is no getter-method for the member class of an EnumSet nor for the key class of EnumMap is that in order to use these classes effectively, the static type is generally known and used by the programmer, and the type's Class can easily be derived from the type name using a class literal. For example, consider the following enum: enum Direction { NORTH, EAST, SOUTH, WEST } You'd use it like this: Set&lt;Direction&gt; wittsEnd = EnumSet.of(NORTH, EAST, SOUTH); // hint: don't go west To add, remove, or check membership in this set, we generally have a Direction instance. If we want to create a new set or derive one from an existing set, we'd declare a variable of type Set&lt;Direction&gt;. If we want the Class object corresponding to the enum type, we just use Direction.class. Thus there is generally no need to get the Class object out of the EnumSet itself. Similar reasoning applies to EnumMap. I suppose there might be some case out there where one has an instance of an EnumSet&lt;?&gt; and you want to create a set of all or none of the enum values, which requires the Class object for a type not known at compile time. Such a case would seem to be quite contrived. For such cases, though, one could use this equally contrived technique (i.e., hack) to get the enum class for some unknown EnumSet s: Class&lt;? extends Enum&lt;?&gt;&gt; enumClass = EnumSet.copyOf(s).addAll(EnumSet.complementOf(s)).iterator().next().getClass(); A similar technique could probably be used to get the key class of an EnumMap.
answers question: http://stackoverflow.com/q/25219748

http://stackoverflow.com/q/25120786
tagged with: path-finding
upvote count: 5
has answer: http://stackoverflow.com/a/25139387
has title: A star algorithm with image map (android)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25252297
possible better answer: http://stackoverflow.com/a/25133403
has comment: http://stackoverflow.com/comment/39103040
has comment: http://stackoverflow.com/comment/39211569
has answer: http://stackoverflow.com/a/25133403
favorite count: 0
linked to: http://stackoverflow.com/q/23705233
accepted answer: http://stackoverflow.com/a/25252297
type: Question
score: 4
tagged with: a-star
tagged with: java
answer count: 3
has body: i used algorithm a start to find path with array nods. I have image map and nodes like this: Red nodes is obstacle, black used to find path. I dont know why this path is to curve. I used this library https://code.google.com/p/a-star-java/source/browse/AStar/src/aStar/?r=7 and I was changed function registerEdges.: private void registerEdges(ArrayList&lt;Node&gt; nodes) { float currentDistX = 0; float currentDistY = 0; float distance = 0; for(int l = 0 ; l &lt; nodes.size(); l++) { MINDISTN = Integer.MIN_VALUE; MINDISTS = Integer.MAX_VALUE; MINDISTE = Integer.MIN_VALUE; MINDISTW = Integer.MAX_VALUE; MINDISTNE = Integer.MAX_VALUE; MINDISTNW = Integer.MAX_VALUE; MINDISTSE = Integer.MAX_VALUE; MINDISTSW = Integer.MAX_VALUE; Node node = null; currentDistX = 0; currentDistY = 0; //System.out.println("current " + node.x + " " + node.y); for(int j = 0 ; j &lt; map.size() ; j++) { if(l != j) { node = map.get(l); currentDistX = map.get(j).x - node.x; currentDistY = map.get(j).y - node.y; if(currentDistX == 0) { if(currentDistY &lt; 0) { if(currentDistY &gt; MINDISTN) { MINDISTN = currentDistY; node.setNorth(map.get(j)); //System.out.println(currentDist + " n " + map.get(j).x + " " + map.get(j).y); } } else if(currentDistY &gt; 0) { if(currentDistY &lt; MINDISTS) { //System.out.println(currentDist + " south " + map.get(j).x + " " + map.get(j).y); MINDISTS = currentDistY; node.setSouth(map.get(j)); } } } if(currentDistY == 0) { if(currentDistX &lt; 0) { if(currentDistX &gt; MINDISTE) { MINDISTE = currentDistX; node.setEast(map.get(j)); //System.out.println(currentDist + " e " + map.get(j).x + " " + map.get(j).y); } } else if(currentDistX &gt; 0) { //System.out.print("m " + MINDISTRIGHT); if(currentDistX &lt; MINDISTW) { MINDISTW = currentDistX; node.setWest(map.get(j)); //System.out.println(currentDist + " w " + map.get(j).x + " " + map.get(j).y); } } } if(currentDistY != 0 &amp;&amp; currentDistX != 0) { if(currentDistX &gt; 0 &amp;&amp; currentDistY &gt; 0) { distance = node.…
downvote count: 1
tagged with: algorithm

http://stackoverflow.com/comment/39226394
comment on: http://stackoverflow.com/q/25190342
score: 1
has text: Have MySQL use a surrogate key, but let your Java layer have an EmployeeIdFactory class that encapsulates the rules and behavior you want. The Employee class will have both the persistence id and the generated id from the factory.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39147965
type: QuestionComment
comment on: http://stackoverflow.com/q/25147895
has text: You can try parsing...String phrase = "the music made it hard to concentrate"; String delims = "[a]+"; String[] tokens = phrase.split(delims); then do an if(tokens[i]){break}
score: 0
type: Comment

http://stackoverflow.com/comment/39205415
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25178454
score: 0
has text: core_jmsTemplate is not used anywhere - is that right? I don't see the need for mocking. Nevertheless, you can use Spring profiles in order to create one or the other bean depending on the active profile.

http://stackoverflow.com/comment/39049747
score: 0
comment on: http://stackoverflow.com/a/25087119
type: AnswerComment
has text: Im not looking to put an actionlistener on some swing object, im looking how to give code in params from a class of your own
type: Comment

http://stackoverflow.com/comment/68907398
type: Comment
has text: Is there a way to do this without waking up the phone and causing it to buzz, etc.?
type: AnswerComment
comment on: http://stackoverflow.com/a/25208088
score: 0

http://stackoverflow.com/comment/39112985
type: Comment
comment on: http://stackoverflow.com/a/25124517
type: AnswerComment
has text: You could keep track of what line you are on, or you could use `RandomAccessFile`
score: 0

http://stackoverflow.com/comment/39089712
has text: Thank u for ur answers. There is no way doing that using Jframes ??
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25116560

http://stackoverflow.com/q/25145738
has comment: http://stackoverflow.com/comment/39146170
tagged with: android
has body: I have an app with a Navigation Drawer Activity which is calling some fragments on it. In one of them, I have a Google Map integration, where retrieving from SharedPreferences, I show some markers and stuff. On the Activity, I have an AsyncTask to update the data when clicking an action bar button. It takes the new data into the SharedPreferences. I'm having trouble finding a way to call again the paintmap() method from the FragmentMap which is the one that takes the SharedPreferences data and paint the map with the new markers and so on. I have tried OnSharedPreferenceChangeListener with no result. Also tried getting the actual fragment with findFragmentByTag but I'm not able to call the method. So, what's the better way to tell the fragment that the data has been updated and need to redraw the map? Thanks in advance. Edit 1: Some things I have tried: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_map, container, false); txtUpdateInfo = (TextView) view.findViewById(R.id.last_update_info); initilizeMap(); // This one includes paintMap at the end. It creates the map. Check this pastebin for more: http://pastebin.com/DPPB7FiK SharedPreferences.OnSharedPreferenceChangeListener spChanged = new SharedPreferences.OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged( SharedPreferences sharedPreferences, String key) { paintMap(); } }; return view; } Also tried, on MainActivity AsyncTask's postExecute, to retrieve the fragment: FragmentManager fm = getFragmentManager(); Fragment f = fm.findFragmentByTag("MAP"); f.paintMap(); // This gives me error and I cannot compile Also, in the same place: FragmentMap f = new FragmentMap(); f.paintMap(); This last one compiles but gave me NullPointer to everything on the fragment... not working neither.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39143639
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/39143527
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25155978
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39143637
tagged with: google-maps
accepted answer: http://stackoverflow.com/a/25155978
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android-asynctask
has title: Call fragment method when AsyncTask finish on activity

http://stackoverflow.com/a/25176996
has comment: http://stackoverflow.com/comment/39219018
type: Answer
answers question: http://stackoverflow.com/q/25169498
has comment: http://stackoverflow.com/comment/39217517
score: 0
has body: You need to put these jars in WEB-INF/lib folder OR add as Module in JBoss. Easier way is to add these jars in WEB-INF/lib and try.

http://stackoverflow.com/comment/39037663
type: Comment
comment on: http://stackoverflow.com/a/25087785
has text: It is very strange, indeed. Are you sure you have added your JDBC libraries in the lib folder of your tomcat installation? That should work. If not, then try adding in WEB-INF/lib folder of your web application next to all your third party libraries. If that doesn't make it work, then there's an extra problem that we cannot fix.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41639573
has text: I wrote fos = new NullOutputStream() and changed type of fos to OutputStream and it worked
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26431969
score: 3

http://stackoverflow.com/q/25230033
downvote count: 2
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25230162
has comment: http://stackoverflow.com/comment/39300615
answer count: 2
has comment: http://stackoverflow.com/comment/39300736
has title: Cannot set Java 8 on Windows 7
score: -1
has comment: http://stackoverflow.com/comment/39300928
favorite count: 0
has body: I just downloaded and installed Java 8 on Windows 8 (64 bit). I have updated the classpath, java home environment variables to point to the new version. But when I try to use the lambda expression on a code from Intellij (13.0.2) , it says Lambda not supported at this language level. Also when I run this from command prompt: java -version it says the version is 7. Can someone please help me setting the Java 8 as default on my system? Thanks!
has answer: http://stackoverflow.com/a/25230162
has comment: http://stackoverflow.com/comment/39301116
has comment: http://stackoverflow.com/comment/39300718
possible better answer: http://stackoverflow.com/a/55835014
has answer: http://stackoverflow.com/a/55835014
type: AnsweredQuestion
tagged with: java

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

http://stackoverflow.com/comment/104600005
score: 2
type: AnswerComment
type: Comment
has text: I wonder a lot why there isn't more people like @Brad, I mean really, this life would be a lot easier. For me there is a fantastic explanation here : https://youtu.be/zVRO-LELoSw
comment on: http://stackoverflow.com/a/25083505

http://stackoverflow.com/a/25101920
downvote count: 1
score: 3
has comment: http://stackoverflow.com/comment/39063876
upvote count: 4
has body: I didn't understand why you need the CountDownLatch to begin with (judging by the code you posted), so I'm going to skip that in my answer, feel free to add a comment explaining what I'm missing. I'd test it as follows: @Test public void testDoSomethingInterestingAsyncIncrementsParameter() { ILogic logic = new Logic(); ICallback callback = mock(ICallback.class); logic.doSomethingInterestingAsync(SOME_NUMBER, callback); verify(callback, timeout(1000)).response(SOME_NUMBER + 1); }
answers question: http://stackoverflow.com/q/25099500
has comment: http://stackoverflow.com/comment/39063760
type: Answer
has comment: http://stackoverflow.com/comment/39063796
has comment: http://stackoverflow.com/comment/39063945

http://stackoverflow.com/q/25189625
has title: Send "MOTD" to Minecraft client from custom Netty server
tagged with: java
has comment: http://stackoverflow.com/comment/39225134
type: Question
tagged with: minecraft
has comment: http://stackoverflow.com/comment/39225200
upvote count: 2
answer count: 2
favorite count: 0
has body: I have a basic Netty server (From the tutorial) (http://netty.io/wiki/user-guide-for-4.x.html), and it recieves the requests from the client, but how would I go about sending a string to the client? For example, on a normal Minecraft server, you specify the "MOTD" in the configuration file, and when a client pings it from the server list, it will display that string. I need to do the same thing, but from my server code.
type: UnansweredQuestion
tagged with: netty
has answer: http://stackoverflow.com/a/25191839
has answer: http://stackoverflow.com/a/25191630
score: 2
has comment: http://stackoverflow.com/comment/39228410
has comment: http://stackoverflow.com/comment/39226616
downvote count: 0

http://stackoverflow.com/q/25225272
tagged with: osx-mavericks
type: UnansweredQuestion
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39291565
has title: I can't open Eclipse
has comment: http://stackoverflow.com/comment/39291464
has comment: http://stackoverflow.com/comment/39291584
type: Question
tagged with: java-8
has body: I just recently upgraded my MacBook Pro from OSX 10.6.8 (Leopard) to OSX Maverick. I want to use Eclipse as an IDE for Java. But everytime I try to open Eclipse it says: "Version 1.6.0_65 of the JVM is not suitable for this product. Version 1.7 or greater is required." So I went to the Oracle website at http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html and downloaded JDK8.I tried to open Eclipse and it is telling me the same thing. What am I doing wrong? P.S.: I downloaded both Eclipse for both OSX 32 bit and 64 bit and I keep getting the same error message.
has comment: http://stackoverflow.com/comment/39291651
has answer: http://stackoverflow.com/a/25225350
score: 0
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/25225383
has comment: http://stackoverflow.com/comment/39291556

http://stackoverflow.com/a/25079576
has body: Collections.max(Arrays.asList(d)); if would be more efficient if instead of having d as an array. have it as list to begin with.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39020813
answers question: http://stackoverflow.com/q/25079434
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39020139
has comment: http://stackoverflow.com/comment/39021015
has comment: http://stackoverflow.com/comment/39020854
has comment: http://stackoverflow.com/comment/39023270

http://stackoverflow.com/a/25096341
accepted answer of: http://stackoverflow.com/q/25096319
downvote count: 0
has comment: http://stackoverflow.com/comment/39051443
has comment: http://stackoverflow.com/comment/39051524
has comment: http://stackoverflow.com/comment/39051471
type: Answer
has body: Unless your threads are daemon threads I don't see why you should have a while or for that matter any loops which would just eat your CPU. Your main thread will not be killed unless all non daemon threads are completed. Also if you wish to do cleanup you can register a JVM's shutdown hook.
score: 5
has comment: http://stackoverflow.com/comment/39092472
has comment: http://stackoverflow.com/comment/39051415
type: AcceptedAnswer
upvote count: 5
answers question: http://stackoverflow.com/q/25096319

http://stackoverflow.com/comment/39112111
has text: please report the types of all the variables you used.
comment on: http://stackoverflow.com/q/25128545
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/73799264
score: 1
upvote count: 1
downvote count: 0
has body: I have a similar case but both command javac --version show the old version of sdk. It shows "javac 11.0.8" even it should be "javac 19" which is the new version just be installed. Go to search bar > type > env click menu "Edit the system environment variables" Advanced tab > click on button "Environment Variables..." Under "System Variable" > select "Path" > click "Edit" Looking for Java path such as "C:\Program Files\Java\jdk-19\bin" Move the path using "Move Up" or "Move Down" button to the position before "%SystemRoot%\system32" Path OK > OK Try the command agian. Hope this may help you guys.
type: Answer
answers question: http://stackoverflow.com/q/25074017

maven
tags question: http://stackoverflow.com/q/25126238
tags question: http://stackoverflow.com/q/25140259
tags question: http://stackoverflow.com/q/25226665
tags question: http://stackoverflow.com/q/25112880
tags question: http://stackoverflow.com/q/25129731
tags question: http://stackoverflow.com/q/25118016
type: Tag
tags question: http://stackoverflow.com/q/25140250
tags question: http://stackoverflow.com/q/25161075
tags question: http://stackoverflow.com/q/25091251
tags question: http://stackoverflow.com/q/25106909
tags question: http://stackoverflow.com/q/25176104
tags question: http://stackoverflow.com/q/25134177
tags question: http://stackoverflow.com/q/25127982
tags question: http://stackoverflow.com/q/25126734
tags question: http://stackoverflow.com/q/25132528
tags question: http://stackoverflow.com/q/25128185
tags question: http://stackoverflow.com/q/25076864
tags question: http://stackoverflow.com/q/25181780
tags question: http://stackoverflow.com/q/25143995
tags question: http://stackoverflow.com/q/25126406
tags question: http://stackoverflow.com/q/25205952
tags question: http://stackoverflow.com/q/25100097
tags question: http://stackoverflow.com/q/25072857
tags question: http://stackoverflow.com/q/25214211
tags question: http://stackoverflow.com/q/25073500
tags question: http://stackoverflow.com/q/25216687
tags question: http://stackoverflow.com/q/25087694
tags question: http://stackoverflow.com/q/25115190
tags question: http://stackoverflow.com/q/25163853
tags question: http://stackoverflow.com/q/25123790
tags question: http://stackoverflow.com/q/25163172
tags question: http://stackoverflow.com/q/25072797
tags question: http://stackoverflow.com/q/25193970
tags question: http://stackoverflow.com/q/25142688
tags question: http://stackoverflow.com/q/25151396
tags question: http://stackoverflow.com/q/25218174
tags question: http://stackoverflow.com/q/25120485
tags question: http://stackoverflow.com/q/25074146
tags question: http://stackoverflow.com/q/25186661
tags question: http://stackoverflow.com/q/25173966
tags question: http://stackoverflow.com/q/25201430
tags question: http://stackoverflow.com/q/25170372
tags question: http://stackoverflow.com/q/25132539
tags question: http://stackoverflow.com/q/25085648
tags question: http://stackoverflow.com/q/25169474
tags question: http://stackoverflow.com/q/25189560
tags question: http://stackoverflow.com/q/25141713
tags question: http://stackoverflow.com/q/25222150
tags question: http://stackoverflow.com/q/25092955
tags question: http://stackoverflow.com/q/25083318
tags question: http://stackoverflow.com/q/25224864
tags question: http://stackoverflow.com/q/25155222
tags question: http://stackoverflow.com/q/25125236
tags question: http://stackoverflow.com/q/25109884
tags question: http://stackoverflow.com/q/25171795
tags question: http://stackoverflow.com/q/25116172
tags question: http://stackoverflow.com/q/25158100
tags question: http://stackoverflow.com/q/25076110
tags question: http://stackoverflow.com/q/25077850
tags question: http://stackoverflow.com/q/25223393
tags question: http://stackoverflow.com/q/25200599
tags question: http://stackoverflow.com/q/25092808
tags question: http://stackoverflow.com/q/25228201
tags question: http://stackoverflow.com/q/25119902
tags question: http://stackoverflow.com/q/25194267
tags question: http://stackoverflow.com/q/25123918
tags question: http://stackoverflow.com/q/25085141
tags question: http://stackoverflow.com/q/25070699
tags question: http://stackoverflow.com/q/25163837
tags question: http://stackoverflow.com/q/25189281
tags question: http://stackoverflow.com/q/25193563
tags question: http://stackoverflow.com/q/25121392
tags question: http://stackoverflow.com/q/25184099
tags question: http://stackoverflow.com/q/25176698
tags question: http://stackoverflow.com/q/25188627
tags question: http://stackoverflow.com/q/25212944
tags question: http://stackoverflow.com/q/25196337
tags question: http://stackoverflow.com/q/25204183
tags question: http://stackoverflow.com/q/25217895

http://stackoverflow.com/comment/39245313
comment on: http://stackoverflow.com/q/25200245
score: 0
has text: @Kayaman I apologize for any confusion. It was just a way to show how the objects were structured. I updated my original post to not include json. They are just objects of the InformationObject class.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39114106
comment on: http://stackoverflow.com/q/25124485
has text: *"when importing the certificate again using the same command above, it doesn't accept it."* - what was the error?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25114246
tagged with: console
score: 0
tagged with: runnable
has title: Run jar file from the console with this input
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25114540
has answer: http://stackoverflow.com/a/25114538
has body: The input I'm forced to use is like this: java -cp lucene.jar:myjarfile.jar here.my.class.Hello inputFile.gz does anybody know what this mean? 1) lucene.jar:myjarfile.jar = means that you should run "myjarfile.jar" using that library (since Lucene is a library). 2) here.my.class.Hello inputFile.gz = means run the class Hello and with input for the constructor of the class use inputFile.gz. Is that correct? my question is: The class Hello must have a constructor that takes a String as a path (.gz file in my case), but should it contain also a main method? and Where should I call the method run() (in the class Hello) that make the needed changes possible? in the constructor? pretty confused, it works very good on the shell but I have a lot of doubts about the console. e.g. could this work? public class Hello { public static void main(String[] args) throws IOException { FileReader ready = new FileReader(args[0], "destination"); ready.run(); } } args[0] should contain inputFile.gz now right?
tagged with: command-prompt
tagged with: java
type: Question
answer count: 2
tagged with: jar

http://stackoverflow.com/q/25186316
type: AnsweredQuestion
tagged with: constants
accepted answer: http://stackoverflow.com/a/25198218
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39218662
has comment: http://stackoverflow.com/comment/39219533
tagged with: enums
has title: Building XML document in lowercase or TitleCase - flag based
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25198218
has comment: http://stackoverflow.com/comment/39219761
has body: In my current project, we are in the process of re-factoring a java class that constructs an XML document. In previous versions of the product delivered to the customer, the XML document is built with lower case elements and attributes: &lt;rootElement attr = "abc"&gt; &lt;childElement childAttr = "xyz"/&gt; &lt;/rootElement&gt; But now we have a requirement to build the XML document with TitleCase element and attributes. The user will set a flag in a properties file to indicate whether the document should be built in lower case or title case. If the flag is configured to build the document in TitleCase, the resultant document will look like: &lt;RootElement Attr = "abc"&gt; &lt;ChildElement ChildAttr = "xyz"&gt; &lt;/RootElement&gt; Various approaches to solve the problem: 1. Plugging in a transformer to convert lowercase XML document to TitleCase XML document. But this will impact the overall performance, as we deal with huge XML files spanning more than 10,000 lines. 2. Create two separate maps with corr. XML elements and attributes. For eg: lowercase map: rootelement -&gt; rootElement, attr -&gt; attr .... TitelCase map: rootlement -&gt; RootElement, attr -&gt; Attr .... Based on the property set by the user, the corr. map will be chosen and XML element/attributes from this map will be used to build the XML document. 3. Using enum to define constants and its corr. values. public enum XMLConstants { ROOTELEMENT("rootElement", "RootElement"), ATTRIBUTE("attr", "Attr"); private String lowerCase; private String titleCase; private XMLConstants(String aLowerCase, String aTitleCase){ titleCase = aTitleCase; lowerCase = aLowerCase; } public String getValue(boolean isLowerCase){ if(isLowerCase){ return lowerCase; } else { return titleCase; } } } -------------------------------------------------------------- // XML document builder if(propertyFlag){ isLowerCase = false; } else { isLowerCase = true; } .... .... createRootElement(ROOTELEMENT.getValue(isLowerCase)); createAt…
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/39279039
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25218138
has text: Ok, my goal is to make the timer start again automatically when it ends. And this process should repeat 4 times.

http://stackoverflow.com/a/45788155
answers question: http://stackoverflow.com/q/25074623
score: 2
upvote count: 2
has body: Same trusted signed applet (Digicert certificate), works great on some PCs, doesn't work on other. It isn't trusted by those other PCs, and wasn't accepted by the user as trusted when asked. OR This is my manifest.mf Trusted-Library: true Application-Name: MyApp Name: MyName Permissions: all-permissions Created-By: 1.6.0_16 (Sun Microsystems Inc.) Caller-Allowable-Codebase: * Main-Class: MyClass Codebase: * If that's the complete manifest, this JAR isn't signed at all, let alone by a trusted certificate. It should be full of Name: and SHA-256-Digest entries.
downvote count: 0
type: Answer

http://stackoverflow.com/q/25193686
tagged with: java-time
has comment: http://stackoverflow.com/comment/39232816
has comment: http://stackoverflow.com/comment/39232645
tagged with: datetime-format
has comment: http://stackoverflow.com/comment/39232938
answer count: 2
tagged with: localdate
linked to: http://stackoverflow.com/q/40025528
downvote count: 0
has body: I am trying to format date were is given in following format 05051988. I want to use LocalDate to format in next 05 may 1988. I have create private method that i will use later in same class to input formatted date in text. I have already made some code but i at the moment I'm getting 1988-05-05 if I use MM, if I replace it with MMM then it is giving me error message that can not be parsed. private LocalDate parseDate(){ LocalDate dateOfBirth = LocalDate.parse(date, DateTimeFormatter.ofPattern("ddMMyyyy")); return dateOfBirth; } Error: Exception in thread "main" java.time.format.DateTimeParseException: Text '05051988' could not be parsed at index 2
has comment: http://stackoverflow.com/comment/39232608
has comment: http://stackoverflow.com/comment/39232814
favorite count: 0
has comment: http://stackoverflow.com/comment/39234129
tagged with: datetime-parsing
has title: Formatting date in java.time
has answer: http://stackoverflow.com/a/25193793
score: 2
has answer: http://stackoverflow.com/a/79349083
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/46171388
has comment: http://stackoverflow.com/comment/39232733
accepted answer: http://stackoverflow.com/a/25193793
possible better answer: http://stackoverflow.com/a/79349083
type: Question
tagged with: java

http://stackoverflow.com/a/25160021
score: 0
type: Answer
has body: You need to give the date a format first: String da = "1957-01-01" Date date = new SimpleDateFormat("yyyy-MM-dd").parse(da);
answers question: http://stackoverflow.com/q/25159925

http://stackoverflow.com/q/25097668
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39054538
has title: Sending an Object over a Pipe
has body: I'm a beginner in Java and maybe I want to do somting tha does't really works in Java, but I hope someone here can help me. What i want to do: I have two Threads, one Thread creates couple of the same Object and work with it, in the end I want to send these Objects via Pipe to the other Thread, where i want save it in a File. I know, I could use Vector, so the other Thread could get the Objects from there, but in the next step I want to separate this project in Sever and Client, so I need these Pipes where I can send Objects. I already searched the Internet for the right answer, but i did find anything what i need. Here is a idea what I thought could work but it didn't realy: MainThread: public class ControlerThread { public static void main(String[] args) { PipedReader pr = new PipedReader(); PipedWriter pw = new PipedWriter(); PipedOutputStream pos = null; PipedInputStream pis = null; ObjectOutputStream oos =null; ObjectInputStream ois = null; try { pw.connect(pr); pis = new PipedInputStream(); pos = new PipedOutputStream(pis); oos = new ObjectOutputStream(pos); ois = new ObjectInputStream(pis); }catch(IOException ioe) { } ModelThread mt = new ModelThread(ois,pr); ViewThread vt = new ViewThread(oos,pw); vt.start(); mt.start(); } } ViewThread where I creat the Object... public class ViewThread extends Thread{ PipedWriter pw; BufferedWriter bw; ObjectOutputStream oos; public ViewThread(ObjectOutputStream oos,PipedWriter pwr ) { this.oos = oos; this.pw = pwr; bw = new BufferedWriter(pw); } public void run() { int iEingabe = 0; Menu mu = new Menu(); do { iEingabe = 0; System.out.println("\t eine neue Person aufnehmen: &gt; 1"); System.out.println("\t \t Records auflisten: &gt; 2"); System.out.println(" Records in eine Datei sichern: &gt; 3"); System.out.println(" Records aus einer Datei laden: &gt; 4"); System.out.println(" in-memory Records sortieren: &gt; 5"); System.out.println("\t\t Datei löschen: &gt; 6"); System.out.println("\t das Programm verlassen: &gt; 7"); …
type: Question
has comment: http://stackoverflow.com/comment/89699094
accepted answer: http://stackoverflow.com/a/25099196
has comment: http://stackoverflow.com/comment/39054173
score: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25099196
answer count: 1
favorite count: 0
tagged with: objectoutputstream
tagged with: multithreading
downvote count: 1

http://stackoverflow.com/comment/39082973
score: 1
comment on: http://stackoverflow.com/q/25106880
type: Comment
type: QuestionComment
has text: You don't need to call `File.createNewFile()` if you're calling `new FileOutputStream` with the same `File,` in fact it is wasteful.

http://stackoverflow.com/q/25199520
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39246433
has comment: http://stackoverflow.com/comment/39271090
tagged with: java
type: Question
has body: I am reading a file test1.xlsx which has according to Windows: Size: 9,71 KB (9 950 bytes) Size on disk: 12,0 KB (12 288 bytes) InputStream input = this.getClass().getClassLoader().getResourceAsStream("testData/test1.xlsx"); ZipInputStream test = new ZipInputStream(input); ZipEntry entry = test.getNextEntry(); System.out.println(entry.getSize()); But this code prints 3183472384, which is much larger than actual size. /** * Gets the uncompressed size of this {@code ZipEntry}. * * @return the uncompressed size, or {@code -1} if the size has not been * set. */ public long getSize() { return size; } What is the reason of this difference?
has comment: http://stackoverflow.com/comment/39247181
has comment: http://stackoverflow.com/comment/39243607
has comment: http://stackoverflow.com/comment/39243380
score: 0
has title: ZipEntry size is too large
tagged with: http://stackoverflow.com/tag/zip
has comment: http://stackoverflow.com/comment/39243501

http://stackoverflow.com/q/25173708
answer count: 1
has title: How to get url from JSON text
has answer: http://stackoverflow.com/a/25173870
score: 0
has comment: http://stackoverflow.com/comment/39195904
tagged with: android
has comment: http://stackoverflow.com/comment/39196033
tagged with: parsing
accepted answer: http://stackoverflow.com/a/25173870
has body: Wondering if it is possible to get url's from the text, wich I parse from JSON. For example I have some JSON object which is in the JSON array and called "text". This "text" contains strings and images (url's) like a img src=\u0022http:\/\/www.dostup1.ru\/netcat_files\/Image\/2014\/08\/04\/dzd-2.jpg but "img" or "src" are not in quotation marks so how can I get them and then parse this images to show? item.setContent(post.getString("text")); This is how I parse text and when it loads, it show me text with strange green rectangles instead of images (because of method doesn't know about how to parse image from url which just is in the text)
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/q/25136870
has answer: http://stackoverflow.com/a/25137735
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/40277290
tagged with: java
tagged with: selenium
type: Question
tagged with: selenium-grid
has body: Please suggest me how to sent 3 users in 3 browsers for this field driver.findElement(By.id(PropertiesConfiguration.getMyProperty("PinTextfield"))).sendKeys(PropertiesConfiguration.getMyProperty("user")); // main class public class TestHRWW {`main class` protected WebDriver driver; @Parameters("browser")`parameter for browser initialization` @BeforeClass public void setup(String browser) { if (browser.equalsIgnoreCase("firefox")) { driver = new FirefoxDriver(); } else if (browser.equalsIgnoreCase("iexplorer")) { System.setProperty("webdriver.ie.driver","Drivers\\IEDriverServer.exe"); driver = new InternetExplorerDriver(); } else if (browser.equalsIgnoreCase("chrome")) { System.setProperty("webdriver.chrome.driver","Drivers\\chromedriver.exe"); driver = new ChromeDriver(); } else { throw new IllegalArgumentException("The Browser Type is Undefined"); } driver.manage().window().maximize(); } @BeforeMethod public void open() { driver.get("http://www.myhrasiapacific.com/"); } @AfterClass public void teardown() { try { driver.quit(); } catch (Exception e) { driver = null; } } // sub class public class Login extends TestHRWW {`sub class` String x; static Logger logger = Logger.getLogger(Login.class.getName()); @Test public void ClickLogon(WebDriver driver) throws InterruptedException, IOException { driver.findElement(`enter code here` By.id(PropertiesConfiguration.getMyProperty("logonbutton"))) .click(); Thread.sleep(2000); // here i need to sent 3 differt users credentials driver.findElement( By.id(PropertiesConfiguration.getMyProperty("PinTextfield"))) .sendKeys(PropertiesConfiguration.getMyProperty("user")); Thread.sleep(2000); driver.findElement( By.id(PropertiesConfiguration .getMyProperty("passwordTextfield"))).sendKeys( PropertiesConfiguration.getMyProperty("password")); Thread.sleep(2000); driver.findElement( By.id(PropertiesConfiguration.getMyProperty("loginbutton"))) .click(); driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS); } }
score: 0
answer count: 2
has title: How can i send multiple test data using testng in to following
tagged with: testng
type: UnansweredQuestion

http://stackoverflow.com/comment/39378294
has text: Your solution worked fine for me. i couldn't realised that i can extend the replaceFirst method as you did. thanks a lot for your help and time.
type: Comment
comment on: http://stackoverflow.com/a/25201888
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39234203
has text: You pass it in the Thread constructor.
score: 1
comment on: http://stackoverflow.com/q/25194582
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39295906
has text: Not entirely sure what you are asking. Maybe you just want a helper method for wrapping the result into an OK response to get those three lines out of each of the operation methods? Like `return createOkResponse(calculatorService.add(x, y));`?
comment on: http://stackoverflow.com/q/25227558
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25186163
answers question: http://stackoverflow.com/q/25179243
has comment: http://stackoverflow.com/comment/40245987
type: Answer
score: 3
upvote count: 3
downvote count: 0
has body: I have to explain a few things before (partly) answering your question. Restlet Framework provides an API and an implementation, and we try to provide them in multiple environments (classical JVM, servlet container, android, gwt, gae). As these environments supports only parts of the JDKs (GWT hates server code for example), we address this constraint by providing what we call "editions" of the framework (cf http://restlet.com/learn/guide/2.2/editions/). In the context of the ejre, I understand that the internal server connector based on the JDK lightweight server is not supported. In order to help you we can introduce a new edition (cf this ticket https://github.com/restlet/restlet-framework-java/issues/939). As I'm not sure to be able to provide it shortly, I would like to know if you intend to run an HTTP server inside the JVM, or if you just want to issue client requests. In this case, you may try to run these instructions before (not tested): org.restlet.engine.Engine.register(false); Engine.getInstance().getRegisteredClients().add(new org.restlet.engine.connector.HttpClientHelper(null));

http://stackoverflow.com/q/25150465
has comment: http://stackoverflow.com/comment/39152627
has answer: http://stackoverflow.com/a/25150844
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25152080
has body: I'm trying to get a variable, or an enum out of an enum(I'm not sure what to call it). So this is my enum. public enum fruits { //ID 0 banana(0,250, 150f, 400f, "Assassin"), //ID 1 apple(1, 300f, 200f, 600f, "Fighter"); private float atk, def, hp; private final String Style; private int ID; Ship(int id, float attack, float defence, float health, String fightStyle) { atk = attack; def = defence; hp = health; Style = fightStyle; ID = id; } public String getLore() { return Lore; } public float getAtk() { return atk; } public float getPen() { return pen; } public float getDef() { return def; } public float getHp() { return hp; } public String getStyle() { return Style; } public int getID() { return ID; } So in this class I'm trying to use the enum to create a player with certain enum stats. Let's say I make a player and he's aa banana, he would have banana stats and be able to upgrade them. Here is where I try to do that. public class Player implements BaseEntity{ Fruitfruit; //STATS float atk; float def; float hp; public Player(Fruitfruit) { this.fruit = fruit; atk = fruit.getAtk(); def = fruit.getDef(); hp = fruit.getHp(); } @Override public float getHP() { return hp; } @Override public float getDef() { return def; } @Override public float getAtk() { return atk; } @Override public float getPen() { return pen; } @Override public int getFruit() { return fruit.getID(); } @Override public String getFruitType() { return fruit.getStyle(); } @Override public void setFruit() { // TODO Auto-generated method stub } I want the player to have banana stats and be able to level up those stats. I also want the player to have a certain fruit. Let's say you upgrade from banana to apple, your stats are equal to the apple.
has answer: http://stackoverflow.com/a/25156819
has title: Getter for ENUM values
accepted answer: http://stackoverflow.com/a/25152080
type: AnsweredQuestion
tagged with: enums
tagged with: libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/39154568
has comment: http://stackoverflow.com/comment/39154204
type: Question
possible better answer: http://stackoverflow.com/a/25150844

http://stackoverflow.com/a/32889792
has body: I don't know if this is a new link or not, but you can just drag n drop the install icon from the Eclipse Marketplace Subclipse site to your Eclipse Luna workspace to install it.
score: 0
answers question: http://stackoverflow.com/q/25112078
type: Answer

http://stackoverflow.com/q/25208678
has title: Hibernate DuplicateImportMapping Exception: Mapping two classes to 1 table
type: Question
has answer: http://stackoverflow.com/a/25249966
answer count: 1
has body: Have two hbm file named as version1.hbm.xml and version2.hbm.xml. Included in applicationContext.xml like version1.hbm.xml version2.hbm.xml version1.hbm.xml starts with: <hibernate-mapping package="com.entity.v1.domain"> <class name="Entity1" table="Entity"> version2.hbm.xml starts with: <hibernate-mapping package="com.entity.v2.domain"> <class name="Entity2" table="Entity"> Using Hibernate 4
accepted answer: http://stackoverflow.com/a/25249966
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/41109571
has text: @Xabster how come it doesn't? The question is, "why doesn't s1==s4".
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25226029
type: Comment

http://stackoverflow.com/a/25156626
type: Answer
has comment: http://stackoverflow.com/comment/39163545
has body: You should do like this String str = your_editText.getText().toString(); if (str.trim().equals("")) { // display your toast message } // Reverse way if (!str.trim().equals("")) { // here edittext is not empty. Please see ! mark at the beginning of if // your code here }
answers question: http://stackoverflow.com/q/25156543
score: 0

http://stackoverflow.com/q/25154899
answer count: 2
has answer: http://stackoverflow.com/a/25156246
score: 5
has answer: http://stackoverflow.com/a/25154984
has comment: http://stackoverflow.com/comment/39160418
has comment: http://stackoverflow.com/comment/39161055
possible better answer: http://stackoverflow.com/a/25154984
has comment: http://stackoverflow.com/comment/39160599
has comment: http://stackoverflow.com/comment/39160432
accepted answer: http://stackoverflow.com/a/25156246
favorite count: 0
has title: Java 8 bad performance , sorting
upvote count: 6
has body: I solve algorithmic problems on codeforces and I tried pushing the same solution using java 7 and java 8 and to my surprise using java 8 I got much worse solution. On the last test: Java 7: time: 373 ms., memory: 112 KB java 8: time: 623 ms., memory: 3664 KB My code public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); List&lt;Integer&gt; list1 = new ArrayList&lt;&gt;(n); List&lt;Integer&gt; list2 = new ArrayList&lt;&gt;(m); for(int i=0;i&lt;n;i++) { list1.add(in.nextInt()); } for (int i = 0; i &lt; m; i++) { list2.add(in.nextInt()); } Collections.sort(list1); Collections.sort(list2, Collections.reverseOrder()); int max = Math.min(list1.size(), list2.size()); int a,b; long result = 0; for(int i=0;i&lt;max;i++) { a = list1.get(i); b = list2.get(i); if(b &gt; a) result += ( b- a); else break; } System.out.println(result); } Why is that ?
has comment: http://stackoverflow.com/comment/39161137
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39160723
tagged with: java
has comment: http://stackoverflow.com/comment/39161560
downvote count: 1
type: Question

http://stackoverflow.com/a/25197458
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 11
answers question: http://stackoverflow.com/q/25197066
accepted answer of: http://stackoverflow.com/q/25197066
has body: You should have: Predicate&lt;Test&gt; p = Test::isEmpty; and not Predicate&lt;String&gt; p = Test::isEmpty; There is no String in class Test { public boolean isEmpty(){ ... } } so why should there be Predicate&lt;String&gt; ? See the tutorial of method references. What you have here is the 3rd case "Reference to an instance method of an arbitrary object of a particular type". Having Predicate&lt;String&gt; p = String::isEmpty(); String s = ""; Calling p.test(s); is the same as callign s.isEmpty(); so that's why you cannot give as argument a String to call a method from Test. It would have been possible to have a common Predicate if both String and Test would implement an interface Empty with the method boolean isEmpty() and then to have Predicate&lt;Empty&gt;. Then both p.test(string) and p.test(test) would work; otherwise it won't, Java has strong typing and does not support duck typing.
score: 11

http://stackoverflow.com/comment/39093235
score: 0
comment on: http://stackoverflow.com/q/25118771
type: Comment
type: QuestionComment
has text: You mean `int a = Integer.parseInt(split[0]), b = Integer.parseInt(split[1])`?

http://stackoverflow.com/q/25112193
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25112228
has body: It seems to be a silly question at the first sight, but I found that the mechanism isn't trivial. The implementation from JDK 8 (copied from here) is just a few lines: @SafeVarargs @SuppressWarnings("varargs") public static &lt;T&gt; List&lt;T&gt; asList(T... a) { return new ArrayList&lt;&gt;(a); } The point is that there are only 3 constructors in ArrayList: one doesn't take any parameter one takes an int (the initial capacity) one takes a Collection (the elements) as shown below (copied from here): public class ArrayList&lt;E&gt; extends AbstractList&lt;E&gt; implements List&lt;E&gt;, RandomAccess, Cloneable, java.io.Serializable { // ... transient Object[] elementData; // non-private to simplify nested class access private int size; // ... public ArrayList(Collection&lt;? extends E&gt; c) { elementData = c.toArray(); size = elementData.length; // c.toArray might (incorrectly) not return Object[] (see 6260652) if (elementData.getClass() != Object[].class) elementData = Arrays.copyOf(elementData, size, Object[].class); } // ... } Since the only possibility is that the 3rd constructor is called, it seems that the parameter a (the generic vararg) is somehow "casted" to a Collection. But as far as I know, varargs are nothing more than arrays with a shorter syntax, and are not convertible to Collections (so that's why this made me puzzled)... Does anybody know how the magic works? Thank you!
tagged with: arraylist
answer count: 3
has title: How does java.util.Arrays.asList(T...) work?
accepted answer: http://stackoverflow.com/a/25112219
tagged with: variadic-functions
tagged with: collections
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39081124
possible better answer: http://stackoverflow.com/a/25112222
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/25112222
has answer: http://stackoverflow.com/a/25112219
type: Question
score: 5
tagged with: arrays

http://stackoverflow.com/comment/39253126
has text: That wouldn't solve my problem. I'm looking for method, that would for example return map of parameters and those parameter like ```/url?car``` would return ```null``` - ```/url?query=asd&run -> ["query":"asd", "run":null]``` .
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25204709

http://stackoverflow.com/comment/39229267
type: QuestionComment
comment on: http://stackoverflow.com/q/25191812
score: 0
has text: Why wont you scan folder to a *.jar files and open it in loop?
type: Comment

android-canvas
tags question: http://stackoverflow.com/q/25207091
tags question: http://stackoverflow.com/q/25149934
type: Tag
tags question: http://stackoverflow.com/q/25111527
tags question: http://stackoverflow.com/q/25198777
tag name: android-canvas

http://stackoverflow.com/comment/39034790
type: AnswerComment
score: 0
has text: Thanks for your reply. I have checked my project and I don't even have the folder called "railprofile". So basically is it looking for the folder that contains the jar?
type: Comment
comment on: http://stackoverflow.com/a/25086450

http://stackoverflow.com/q/25071401
has answer: http://stackoverflow.com/a/25071735
has title: Sending automatic emails with java
type: Question
has answer: http://stackoverflow.com/a/25071449
score: 0
answer count: 3
tagged with: email
accepted answer: http://stackoverflow.com/a/25071449
has body: I need to send automatic emails every certain time from my spring mvc application. I have been researching some tools like quartz ScheduledExecutorService ScheduledFuture Timer TimerTask My question is that i need to send those emails even if the pc is turned off, i suppose that i have some kind of server in my work if this task cant not be done by only using my application. If that is the case what should i do to my server to make this task? thanks in advance
has answer: http://stackoverflow.com/a/25071882
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25071735
tagged with: java

http://stackoverflow.com/comment/39215619
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25182560
type: Comment
has text: I deleted the main method in the classes. And I can now assume that the problem is due to the code in the external classes DayGUI2.java and OfficaAreaCalculator2.java. It seems like whenever they are initialized it creates a new window for some reason

http://stackoverflow.com/q/25103565
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25106760
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: birt
score: 7
tagged with: java
accepted answer: http://stackoverflow.com/a/25106760
upvote count: 7
has body: I'm using Birt 4.4 and my html report works fine but xls and pdf files throw The output format is not supported error org.eclipse.birt.report.engine.api.EngineException: The output format xsl is not supported. at org.eclipse.birt.report.engine.api.impl.EngineTask.setupRenderOption(EngineTask.java:2031) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:96) I tried setting output format to xls_spudsoft and emitterID but no luck Here is the code EXCELRenderOption xlsOptions = new EXCELRenderOption(options); xlsOptions.setEmitterID("uk.co.spudsoft.birt.emitters.excel.XlsEmitter"); xlsOptions.setOutputFormat("xls_spudsoft"); response.setHeader("Content-Disposition", "attachment; filename=\"" + reportName + "\""); xlsOptions.setOutputStream(response.getOutputStream()); any ideas? Thank you
type: Question
has title: Birt not generating PDF and XLS report

http://stackoverflow.com/a/25220469
downvote count: 0
has body: You have SQL syntax error in the SQL generated by hibernate. The hibernate generates SQL according a dialect used by the configuration settings and it does it right, so there should not be errors if you have used HQL or criteria queries. If you are using MySQL JDBC driver then you are connecting to the MySQL database. HQL uses object mapping to get names for the tables and columns used by the query. If you are using save via hibernate session object then insert SQL statement is generated. The error 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 'option, createdBy, createdDate, updatedBy, updatedDate, description) values ('QU' at line 1 shows you which column name is wrong. You can also check Reserved Words from the MySQL Reference Manual. Usually such names can be used in the SQL if they are backquoted. For example specifying a column name as `option`. But it's MySQL specific, and better rename it to something not reserved.
type: Answer
upvote count: 7
answers question: http://stackoverflow.com/q/25218086
score: 7
accepted answer of: http://stackoverflow.com/q/25218086
type: AcceptedAnswer

http://stackoverflow.com/q/25184769
type: Question
tagged with: graph
has title: NullPointerException while Looping through Edges and Vertices of Graph
has comment: http://stackoverflow.com/comment/39216036
has body: I am trying to loop through the vertices I have in a graph and list their edges as I go. So far I have been able to come up with the following code: public String displayRecords() { String printOut = null; for (ListIterator&lt;Vert&gt; iter = graph.listIterator(); iter.hasNext(); ) { Vert displayVert = iter.next(); boolean cont = true; int floop = 0; Edge tempEdge = null; //extra vars String pname = null; String sname = null; int dist = 0; do { if(floop == 0) { tempEdge = displayVert.firstEdge; pname = displayVert.name; sname = tempEdge.parentNode.name; dist = tempEdge.edgeLen; floop++; }else{ tempEdge = tempEdge.nextEdge; } printOut = printOut + pname + sname + dist + "Plane"; }while(tempEdge.nextEdge.parentNode != null); } return printOut; } However, I keep getting a NullPointerException at this line: }while(tempEdge.nextEdge.parentNode != null); Here is my code for the Vert and Edge classes: class Vert { public Edge firstEdge; public String name; // other node info here public Vert() { firstEdge = null; } public Vert(String n) { firstEdge = null; name = n; } } class Edge { public Vert parentNode = null; public Edge nextEdge = null; // next in adj list // other edge info here public int edgeLen; // edge length public Edge(Vert num, Edge e, int len) { parentNode = num; nextEdge = e; // initialize other edge info here edgeLen = len; } } What am I doing wrong and is there an easier way to do this?
has comment: http://stackoverflow.com/comment/39215470
answer count: 2
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/39215552
has comment: http://stackoverflow.com/comment/39216321
has comment: http://stackoverflow.com/comment/39216217
tagged with: iteration
has comment: http://stackoverflow.com/comment/39216124
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39215550
has comment: http://stackoverflow.com/comment/39216593
has answer: http://stackoverflow.com/a/25184943
has answer: http://stackoverflow.com/a/25185682
has comment: http://stackoverflow.com/comment/39216451
has comment: http://stackoverflow.com/comment/39216668
score: 0
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/39215760

http://stackoverflow.com/comment/39099155
type: AnswerComment
has text: I wasn't ignoring them. Obviously they didn't work like I needed them too. I promise I tried what people gave me and I tried tweaking them to do what I needed. I asked about splitting strings because that is how I was originally told to do this assignment. If you would've just helped me like this to begin with it wouldn't have been a problem. Thank you.
type: Comment
comment on: http://stackoverflow.com/a/25121719
score: 0

jakarta-ee
tags question: http://stackoverflow.com/q/25121375
tags question: http://stackoverflow.com/q/25144912
tags question: http://stackoverflow.com/q/25080002
tags question: http://stackoverflow.com/q/25132563
tags question: http://stackoverflow.com/q/25226665
tags question: http://stackoverflow.com/q/25120962
tags question: http://stackoverflow.com/q/25098044
tags question: http://stackoverflow.com/q/25195907
tags question: http://stackoverflow.com/q/25196092
tags question: http://stackoverflow.com/q/25208450
type: Tag
tags question: http://stackoverflow.com/q/25166287
tags question: http://stackoverflow.com/q/25099811
tags question: http://stackoverflow.com/q/25175015
tags question: http://stackoverflow.com/q/25194805
tags question: http://stackoverflow.com/q/25196867
tags question: http://stackoverflow.com/q/25126256
tags question: http://stackoverflow.com/q/25181780
tags question: http://stackoverflow.com/q/25138915
tags question: http://stackoverflow.com/q/25173029
tags question: http://stackoverflow.com/q/25214211
tags question: http://stackoverflow.com/q/25198913
tags question: http://stackoverflow.com/q/25124896
tags question: http://stackoverflow.com/q/25087965
tags question: http://stackoverflow.com/q/25178772
tags question: http://stackoverflow.com/q/25093645
tags question: http://stackoverflow.com/q/25211252
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/25136834
tags question: http://stackoverflow.com/q/25150537
tags question: http://stackoverflow.com/q/25142779
tags question: http://stackoverflow.com/q/25073074
tags question: http://stackoverflow.com/q/25110240
tags question: http://stackoverflow.com/q/25221843
tags question: http://stackoverflow.com/q/25186616
tags question: http://stackoverflow.com/q/25190776
tags question: http://stackoverflow.com/q/25078828
tags question: http://stackoverflow.com/q/25163040
tags question: http://stackoverflow.com/q/25081281
tags question: http://stackoverflow.com/q/25099849
tags question: http://stackoverflow.com/q/25218693
tags question: http://stackoverflow.com/q/25183272
tags question: http://stackoverflow.com/q/25087417
tags question: http://stackoverflow.com/q/25178052
tags question: http://stackoverflow.com/q/25093088
tags question: http://stackoverflow.com/q/25141321
tags question: http://stackoverflow.com/q/25130475
tags question: http://stackoverflow.com/q/25160435
tags question: http://stackoverflow.com/q/25123373
tags question: http://stackoverflow.com/q/25229539
tags question: http://stackoverflow.com/q/25115067
tags question: http://stackoverflow.com/q/25091736
tags question: http://stackoverflow.com/q/25185668
tags question: http://stackoverflow.com/q/25120884
tags question: http://stackoverflow.com/q/25096730
tags question: http://stackoverflow.com/q/25134774
tags question: http://stackoverflow.com/q/25226343
tags question: http://stackoverflow.com/q/25182650
tags question: http://stackoverflow.com/q/25097350
tags question: http://stackoverflow.com/q/25136021
tags question: http://stackoverflow.com/q/25182008
tags question: http://stackoverflow.com/q/25110794
tags question: http://stackoverflow.com/q/25215127
tags question: http://stackoverflow.com/q/25072491
tags question: http://stackoverflow.com/q/25111335
tags question: http://stackoverflow.com/q/25145149
tags question: http://stackoverflow.com/q/25074359
tags question: http://stackoverflow.com/q/25165062
tags question: http://stackoverflow.com/q/25136461
tags question: http://stackoverflow.com/q/25093763
tags question: http://stackoverflow.com/q/25084955
tags question: http://stackoverflow.com/q/25195977
tags question: http://stackoverflow.com/q/25170278

http://stackoverflow.com/q/25197449
score: 0
accepted answer: http://stackoverflow.com/a/25197807
answer count: 1
tagged with: file-upload
tagged with: google-app-engine
type: AnsweredQuestion
has body: I'm trying to convert a Java web app to use GAE. The entire app consists of selecting one or more local (xml) files in a form and hitting submit. On the receiving end, the elements in the xml are sorted and are outputted separately to a textarea (one for each input file). I don't care about the contents of the file once I parse the XML. Apache Commons File Upload uses a temp location to upload the file, but this is unavailable in GAE. How do I get an InputStream directly for each one of the uploaded files? Update Here's the final code sample just so you won't have to follow the link in the accepted answer ServletFileUpload upload = new ServletFileUpload (); try { FileItemIterator uploads = upload.getItemIterator (request); while (uploads.hasNext ()) { FileItemStream item = uploads.next (); if (item.isFormField ()) { continue; } final String filename = item.getName (); w.println ("&lt;textarea class='xmlout' readonly='true' cols='150' rows='100' &gt;"); try { doSomethingWith(item.openStream ()); stream.close (); } catch (Exception e) { // uh oh! } w.println ("&lt;/textarea&gt;"); } } catch (Exception e) { }
has title: Appengine process file upload direct from stream (JAVA)
tagged with: java
has answer: http://stackoverflow.com/a/25197807
type: Question

http://stackoverflow.com/comment/39002028
comment on: http://stackoverflow.com/q/25069671
has text: What would you like to achieve?
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/25105447
has body: The basic mistake ResultSet res = statement.executeQuery(SQL); this gives you a ResultsetObject Now the question comes what is ResultSet A ResultSet object maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row. The next method moves the cursor to the next row, and because it returns false when there are no more rows in the ResultSet object, it can be used in a while loop to iterate through the result set. So that means you need to iterate over the resultsetObject obtained to get the column values. Something like this while(resultSetObject.next()) { String name = resultSetObject.getString("yourColumnName"); } *Note Always try using PreparedStatement instead of Statement to avoid sql-injection So in that case it will be something like this String SQL = "select * from courses where id = ?"; PreparedStatement statement = con.prepareStatement(sql); statement.setInt(1,id); ResultSet res = statement.executeQuery();
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25105345
score: 1
upvote count: 1

tomcat
tags question: http://stackoverflow.com/q/25092955
tags question: http://stackoverflow.com/q/25177600
tags question: http://stackoverflow.com/q/25097791
tags question: http://stackoverflow.com/q/25114549
tags question: http://stackoverflow.com/q/25090259
tags question: http://stackoverflow.com/q/25200599
tags question: http://stackoverflow.com/q/25195694
tags question: http://stackoverflow.com/q/25124451
tags question: http://stackoverflow.com/q/25076962
tags question: http://stackoverflow.com/q/25099849
tags question: http://stackoverflow.com/q/25107612
tags question: http://stackoverflow.com/q/25207936
tags question: http://stackoverflow.com/q/25093693
tags question: http://stackoverflow.com/q/25072024
tags question: http://stackoverflow.com/q/25208105
tags question: http://stackoverflow.com/q/25226391
tags question: http://stackoverflow.com/q/25075617
tags question: http://stackoverflow.com/q/25096718
tags question: http://stackoverflow.com/q/25136860
tags question: http://stackoverflow.com/q/25164774
tags question: http://stackoverflow.com/q/25122587
tags question: http://stackoverflow.com/q/25224989
tags question: http://stackoverflow.com/q/25155789
tags question: http://stackoverflow.com/q/25087615
tags question: http://stackoverflow.com/q/25203211
tags question: http://stackoverflow.com/q/25094113
tags question: http://stackoverflow.com/q/25229686
tags question: http://stackoverflow.com/q/25077654
tags question: http://stackoverflow.com/q/25202783
tags question: http://stackoverflow.com/q/25086906
tags question: http://stackoverflow.com/q/25097408
tags question: http://stackoverflow.com/q/25201865
tags question: http://stackoverflow.com/q/25156974
tag name: tomcat
tags question: http://stackoverflow.com/q/25226308
tags question: http://stackoverflow.com/q/25104755
tags question: http://stackoverflow.com/q/25161886
tags question: http://stackoverflow.com/q/25138517
tags question: http://stackoverflow.com/q/25113958
tags question: http://stackoverflow.com/q/25078424
tags question: http://stackoverflow.com/q/25214496
tags question: http://stackoverflow.com/q/25164932
tags question: http://stackoverflow.com/q/25087178
tags question: http://stackoverflow.com/q/25227775
tags question: http://stackoverflow.com/q/25225730
tags question: http://stackoverflow.com/q/25115262
tags question: http://stackoverflow.com/q/25137790
tags question: http://stackoverflow.com/q/25194496
tags question: http://stackoverflow.com/q/25084970
tags question: http://stackoverflow.com/q/25069743
tags question: http://stackoverflow.com/q/25124885
tags question: http://stackoverflow.com/q/25137791
tags question: http://stackoverflow.com/q/25079887
tags question: http://stackoverflow.com/q/25126980
tags question: http://stackoverflow.com/q/25149329
type: Tag
tags question: http://stackoverflow.com/q/25138729
tags question: http://stackoverflow.com/q/25087833
tags question: http://stackoverflow.com/q/25099811
tags question: http://stackoverflow.com/q/25208494
tags question: http://stackoverflow.com/q/25150370
tags question: http://stackoverflow.com/q/25177767
tags question: http://stackoverflow.com/q/25148193
tags question: http://stackoverflow.com/q/25179720
tags question: http://stackoverflow.com/q/25210399
tags question: http://stackoverflow.com/q/25138915
tags question: http://stackoverflow.com/q/25172178
tags question: http://stackoverflow.com/q/25083537
tags question: http://stackoverflow.com/q/25223421
tags question: http://stackoverflow.com/q/25104995
tags question: http://stackoverflow.com/q/25193217
tags question: http://stackoverflow.com/q/25130781
tags question: http://stackoverflow.com/q/25227332
tags question: http://stackoverflow.com/q/25124896
tags question: http://stackoverflow.com/q/25220151
tags question: http://stackoverflow.com/q/25103254
tags question: http://stackoverflow.com/q/25205536
tags question: http://stackoverflow.com/q/25140246
tags question: http://stackoverflow.com/q/25110544
tags question: http://stackoverflow.com/q/25211335

http://stackoverflow.com/q/25117713
has comment: http://stackoverflow.com/comment/39091805
favorite count: 0
has comment: http://stackoverflow.com/comment/39093216
has answer: http://stackoverflow.com/a/25118056
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39093770
has comment: http://stackoverflow.com/comment/39102424
has comment: http://stackoverflow.com/comment/39111079
linked to: http://stackoverflow.com/q/7283338
has comment: http://stackoverflow.com/comment/39098928
has comment: http://stackoverflow.com/comment/39093416
has answer: http://stackoverflow.com/a/25121924
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39091786
tagged with: collections
has comment: http://stackoverflow.com/comment/39093193
downvote count: 1
has body: I know this question has already been asked on SO a couple of times, but I still haven't found a satisfying solution, and I'm unsure which way to go. The question is: Why doesn't the Java library provide HashSet.get(Object o) and HashMap.getKey(Object o) methods that return the actual instance in the map providing an equal instance? Example: // Retrieve a house with ID=10 that contains additional information like size, // location and price. houses.get(new House(10)); I think the best answer can be found here. So here's a mixture of answers that I'm aware of: Why would you need the instance when you already have it? It doesn't make sense to try to get the same object you already have. The object has an identifier (which controls it's equality to other Foo types) plus any number of other fields that do not contribute to it's identity. I want to be able to get the object from the Set (which includes the extra fields) by constructing an 'equal' Foo object (text is taken from one of the comments). -> no answer Iterate the Collection and search for the instance using equals(). This uses linear search and is extremely slow in big collections. -> bad answer Use a HashMap instead of a HashSet I don't need a map and I think it's not adequate to return a map in a method like getHouses(). The getter should return a Set and not a Map. Use TreeSet.ceiling - don't know This hacky code below (Java 8 HashSet only) uses reflection and provides the missing functionality. I did not find something like this in other answers (no surprise). This could have been an acceptable solution if the target Java version is defined and future Java versions would finally provide such a method, now that we have default methods for interfaces. One could think of default E get(E o){stream().filter(e-&gt;e.equals(o)).findAny().orElse(null);} // Alternative: Subclass HashSet/HashMap and provide a get()/getKey() methods public static &lt;T&gt; T getFromSet(HashSet&lt;T&gt; set, T key) throws Exception { F…
has comment: http://stackoverflow.com/comment/39101092
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39091500
has comment: http://stackoverflow.com/comment/39091758
has comment: http://stackoverflow.com/comment/39092828
linked to: http://stackoverflow.com/q/13863506
has comment: http://stackoverflow.com/comment/39091526
has title: Why doesn't the Java library provide `HashSet.get(Object o)` and `HashMap.getKey(Object o)`
has comment: http://stackoverflow.com/comment/39092178
linked to: http://stackoverflow.com/q/12014641
linked to: http://stackoverflow.com/q/861296
has comment: http://stackoverflow.com/comment/39092057
has comment: http://stackoverflow.com/comment/39100537

http://stackoverflow.com/comment/39103195
comment on: http://stackoverflow.com/q/25123912
type: Comment
type: QuestionComment
score: 1
has text: Welcome to Stack Overflow, please take the [Tour](http://stackoverflow.com/tour). Please post your code, see [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve).

http://stackoverflow.com/a/25219609
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25219394
type: Answer
has comment: http://stackoverflow.com/comment/39281692
upvote count: 3
score: 3
has body: It IS possible but I wouldn't recommend doing it, since basically it's not a good style. Here's how you could do it: Field field = YourClass.class.getField("nameOfTheVarGoesHere"); BufferedImage sprite = (BufferedImage) field.get(this); However, even though it is possible, you should stay with your current switch in my opinion.
has comment: http://stackoverflow.com/comment/39281592
answers question: http://stackoverflow.com/q/25219394
type: AcceptedAnswer

http://stackoverflow.com/comment/39288731
comment on: http://stackoverflow.com/q/25223735
has text: @JamesB added as answer
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39020781
score: 1
comment on: http://stackoverflow.com/q/25080038
has text: How about `jsonObject.keys()` to get an iterator
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25167555
has body: Consider maybe returning a ResponseEntity from your request mapping. http://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/http/ResponseEntity.html Then you can set response headers using like this: @RequestMapping("/handle") public ResponseEntity&lt;String&gt; handle() { HttpHeaders responseHeaders = new HttpHeaders(); responseHeaders.set("MyResponseHeader", "MyValue"); return new ResponseEntity&lt;String&gt;("Hello World", responseHeaders, HttpStatus.CREATED); }
downvote count: 3
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/25165468
score: -3
has comment: http://stackoverflow.com/comment/128114558

http://stackoverflow.com/comment/39417737
comment on: http://stackoverflow.com/a/25291716
score: 1
has text: you @afzalex, are a life saver. I can now get on with creating a rasterizer for Minecraft.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39096461
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25119307
has text: Maybe, if there's a configuration item called "[x] don't send JMS messages sometimes". Needs more debugging (and I don't mean running it through a debugger. That's only a part of the debugging process).
score: 0

http://stackoverflow.com/comment/39051421
comment on: http://stackoverflow.com/a/25096293
has text: I dont need any fxml loaded. It is already loaded at the start. I just need to change the label of main fxml file which controller is CoreAppFXMLController. I have protected Label nameOfTheLeague; and in my other controller I have a method that checks for input and sets the label. I will try with ur suggestion.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39247095
type: Comment
type: AnswerComment
has text: keep your answer but improve it,
score: 0
comment on: http://stackoverflow.com/a/25201439

http://stackoverflow.com/a/25324107
has body: In the meantime i got an answer for my question. When you add the following line to the &lt;properties&gt; section in your persistent.xml file, hibernate will use the "pooled-lo" optimizer. &lt;property name="hibernate.id.optimizer.pooled.prefer_lo" value="true" /&gt;
has comment: http://stackoverflow.com/comment/109275942
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/25204019
upvote count: 3
type: Answer

http://stackoverflow.com/comment/39181563
type: QuestionComment
comment on: http://stackoverflow.com/q/25165695
score: 0
has text: its already there, its the entire button code; the logcat didnt specify which line
type: Comment

http://stackoverflow.com/a/29946224
upvote count: 10
answers question: http://stackoverflow.com/q/25125563
downvote count: 0
type: Answer
has body: You could configure the '-fx-prompt-text-fill' key in '.text-field:focused' area like in '.text-field' area (css): `.text-field { -fx-prompt-text-fill: derive(-fx-control-inner-background,-30%); } .text-field:focused { -fx-prompt-text-fill: derive(-fx-control-inner-background,-30%); }` and add the 'promptText' entry in fxml file: &lt;TextField fx:id="XY_Id" promptText="First name"&gt; That is all and works for me.
score: 10
has comment: http://stackoverflow.com/comment/115974435

http://stackoverflow.com/comment/39029523
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25084341
score: 1
has text: @LuiggiMendoza I understand your example :), but surely this is answering the original question, seeing that Fly is an Animal, and Octopus is an Animal?

java-2d
tags question: http://stackoverflow.com/q/25114446
tag name: java-2d
tags question: http://stackoverflow.com/q/25224851
tags question: http://stackoverflow.com/q/25080678
type: Tag

http://stackoverflow.com/a/25130715
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25130608
score: 1
upvote count: 1
has body: The problem is that the columns were empty in your call defaultTableModel.setDataVector(setData(), setColumns()); After replacing your setColumns method with the code below, the data was visible: private Vector setColumns() { Vector v = new Vector(); v.add("Col1"); v.add("Col2"); v.add("Col3"); return v; }

http://stackoverflow.com/comment/39090949
has text: There is same problem
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25114613
type: Comment

http://stackoverflow.com/a/25131039
accepted answer of: http://stackoverflow.com/q/25124035
upvote count: 3
type: AcceptedAnswer
type: Answer
has body: The Libgdx 9-patch only supports the nine basic patches. It does not support more complex patches (I didn't realize that was even possible with Android 9patch, but it seems to be). You can see the Libgdx code here: https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/NinePatch.java The Libgdx NinePatch class doesn't even support the meta-data pixels. It expects those to be chopped off and converted by your TextureAtlas. See Loading nine-patch image as a Libgdx Scene2d Button background looks awful
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/25124035

http://stackoverflow.com/comment/39083268
type: QuestionComment
comment on: http://stackoverflow.com/q/25095144
score: 2
has text: This problem has nothing to do with SB and SB is not created to solve this kind or problem. Edit question and retag it
type: Comment

http://stackoverflow.com/q/25220503
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: deployment
answer count: 0
has body: When releasing my first android app using the facebook sdk, what are all the steps involved to get it working? The process is confusing me, the Key Hashes in particular. 1. Take the App ID from my facebook App and put it into my AndroidManifest.xml 2. Add the platform: Android in the developers.facebook.com App-Settings 3. Copy my Package Name to the Android-form at developers.facebook.com 4. ? EDIT: By releasing an app to Google Play without facebook in it and then reading this: Key hash for Android-Facebook app I learned everything I needed to know. I will answer my own post eventually with all the steps needed, if someone else don't beat me to it.
has comment: http://stackoverflow.com/comment/39286957
tagged with: java
type: Question
score: 0
upvote count: 1
tagged with: release
downvote count: 1
tagged with: facebook-android-sdk
has comment: http://stackoverflow.com/comment/39283314
linked to: http://stackoverflow.com/q/4388992
has title: Android, Facebook and key hashes, how does it work?

http://stackoverflow.com/q/25173787
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25174606
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has body: I'm working through the example code of chapter 4 of Core Servlets and JavaServer Pages (http://volume1.coreservlets.com/archive/Chapter4.html) and I get the above error when I try to compile the BeanUtilities.java file. I thought initially it was my classpath but that seems to include the required .jar files (looking at the starttomcat prompt). I think I have the .jar files in the correct directory ($CATALINA_HOME/lib/ I'm running tomcat 7 on fedora). Any advice? Thanks &amp; I hope your day is going better than mine, sigh.
tagged with: tomcat7
accepted answer: http://stackoverflow.com/a/25174606
type: Question
tagged with: web-development-server
has title: error: package org.apache.commons.beanutils does not exist
downvote count: 0

http://stackoverflow.com/q/25087490
has comment: http://stackoverflow.com/comment/39035393
score: -4
tagged with: runtime-error
downvote count: 4
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/25119678
favorite count: 0
has body: I get the following error while trying to run a java program: java.lang.ExceptionInInitializerError at b.a.a.b.&lt;clinit&gt;(Unknown Source) at pcloud.systemtray.ASPAgent.&lt;clinit&gt;(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 com.exe4j.runtime.LauncherEngine.launch(Unknown Source) at com.exe4j.runtime.WinLauncher.main(Unknown Source) at com.install4j.runtime.launcher.WinLauncher.main(Unknown Source) Caused by: java.lang.NullPointerException at b.a.f.a.&lt;clinit&gt;(Unknown Source) ... 9 more I have no idia what's causing it or how to solve it. I have java 7 u65 installed and the program works on other PCs.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39035929
has title: Java environment error
tagged with: java
tagged with: error-handling
has answer: http://stackoverflow.com/a/25118814
type: Question
has comment: http://stackoverflow.com/comment/39035366

http://stackoverflow.com/a/25124356
score: 0
type: Answer
has body: try this code: removing your interface code and getItem code.. this is all you need to make the itemClickListener to work. listview.setOnItemClickListener(new OnItemClickListener(){ @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Intent intent = new Intent(EventsActivity.this,EventSingleItemActivity.class); intent.putExtra("id_item", id);//this is id of the item that you said it. for example id:5544323 from your JSON web service intent.putExtra("position", position); //order position in listview 0-1-2-3... startActivity(intent); //start Activity } }
answers question: http://stackoverflow.com/q/25124188
has comment: http://stackoverflow.com/comment/39104274

http://stackoverflow.com/q/25160584
has body: This code is very rough, incomplete, and is not professional in any way. I have recieved: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1 at ConnectFourGame.main(ConnectFourGame.java:63) anytime that I try to enter a column this shows up. I have been looking over my code and so has my father, and we are unable to find where the error is. Any help would be great! import javax.swing.*; import java.awt.*; import java.awt.event.*; public class ConnectFourGame { public static void main(String[] args) { int[][] grid = new int[6][7]; int i, j, temp, player=0, inarowl=0, inarowr=0, temprow=0, inarowd=0, tempcol=0; boolean legal = true; boolean gameover = false; //Initializing game board for(i=0;i&lt;6;i++) for(j=0;j&lt;7;j++) grid[i][j] = 0; //ALL GAME LOGIC do { i=0; j=0; //PLAYER 1 //check for diagonals next do { i=0; j=0; player=1; //player places chip temp=Integer.parseInt(JOptionPane.showInputDialog(null, "pick your column( 0 / 1 / 2 / 3 / 4 / 5 / 6 )")); for(i=0;i&lt;6;i++) { if(grid[i][temp]==0) //detects lowest available chip slot in the column for placement { // and turns that spot into a box owned by the player grid[i][temp]=player; legal=true; temprow=i; tempcol=temp; break; }else legal=false; } } while(!legal); inarowl=0; inarowr=0; tempcol=temp; do { tempcol--; inarowl++; }while(grid[temprow][tempcol]==player); tempcol=temp; do { tempcol++; inarowr++; }while(grid[temprow][tempcol]==player); do { temprow--; inarowd++; }while(grid[temprow][tempcol]==player); if (inarowl+inarowr-1&gt;=4||inarowd&gt;=4) gameover=true; //PLAYER 2 //check for diagonals next do { i=0; j=0; player=2; temp=Integer.parseInt(JOptionPane.showInputDialog(null, "pick your column( 0 / 1 / 2 / 3 / 4 / 5 / 6 )")); for(i=0;i&lt;6;i++) { if(grid[i][temp]==0) { grid[i][temp]=player; legal=true; temprow=i; tempcol=temp; break; }else legal=false; } } while(!legal); inarowl=0; inarowr=0; tempcol=temp; do { tempcol--; inarowl++; }while(grid[temprow][tempcol]==player); tempcol=t…
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25160687
has answer: http://stackoverflow.com/a/25160687
score: 0
tagged with: exception
has answer: http://stackoverflow.com/a/25160716
has title: Connect Four OutOfBoundsException
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25160716
tagged with: java

http://stackoverflow.com/comment/44792127
type: QuestionComment
score: 0
has text: I think you should use selendroid.
type: Comment
comment on: http://stackoverflow.com/q/25221701

http://stackoverflow.com/a/25150550
answers question: http://stackoverflow.com/q/25150472
has body: The Eclipse Compiler for Java (ECJ) is open source, so it's freely modifiable. See the JDT Core documentation. However, @univerio's suggestion to look at Scala before taking this on is a good idea. Scala fixes many of the shortcomings of Java but still compiles to JVM code, so existing Java libraries work seamlessly.
score: 0
type: Answer
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/25134168
has comment: http://stackoverflow.com/comment/39121837
score: 0
has body: I have a webapp that runs on a pi thats just a animation. Now the pi struggles when there is loads of animation happening. What I would like to do is render the app on the server and stream is as a video feed to the pi thus taking all the javascript processing away from the pi. How would I go about doing that? The app has a java backend serving up the html.
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has title: Stream webapp as video feed
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39121903
has answer: http://stackoverflow.com/a/25134703
tagged with: java
has comment: http://stackoverflow.com/comment/39122075
type: Question
tagged with: javascript

http://stackoverflow.com/a/25166573
has comment: http://stackoverflow.com/comment/39182719
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25166337
type: Answer
has comment: http://stackoverflow.com/comment/39182666
has comment: http://stackoverflow.com/comment/39182919
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/39182448
has body: If you can rewrite StatUtils.mergeStats into a Collector, you could just write return scopedMetrics.stream().collect(groupingBy(classifier, mergeStatsCollector)); And even if you can't do this, you could write return scopedMetrics.stream().collect(groupingBy(classifier, collectingAndThen(toList(), StatUtils::mergeStats)));
accepted answer of: http://stackoverflow.com/q/25166337

http://stackoverflow.com/comment/39272805
comment on: http://stackoverflow.com/a/25214779
score: 0
type: AnswerComment
has text: Best thing is to try something and ask more questions ;)
type: Comment

http://stackoverflow.com/a/25073186
has body: you are calling methods that throws UnsupportedOperationException. private static void mode(int i) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } private static void quality(int i) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } private static void complexity(int i) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } private static void sampleRate(int i) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } replace with private static void mode(int i) { //what you want to do } private static void quality(int i) { //what you want to do } private static void complexity(int i) { //what you want to do } private static void sampleRate(int i) { //what you want to do }
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25073093
type: Answer
upvote count: 1

http://stackoverflow.com/q/25178387
has comment: http://stackoverflow.com/comment/39210250
has body: When documenting code, I often have to write about methods. But how to name them properly in documentation? Here is an example: To perform this task, use someMethod() from MyClass class. There are also alternative conventions I know: (...), use MyClass.myMethod(). (...), use MyClass#myMethod(). (...), use myObject.myMethod(). Which convention is most commonly used? Are there any official guidelines?
answer count: 2
has comment: http://stackoverflow.com/comment/39210451
downvote count: 0
tagged with: documentation
favorite count: 0
has answer: http://stackoverflow.com/a/25227482
upvote count: 2
has comment: http://stackoverflow.com/comment/39211242
accepted answer: http://stackoverflow.com/a/25253603
possible better answer: http://stackoverflow.com/a/25227482
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39210713
tagged with: java
tagged with: naming
tagged with: methods
type: Question
tagged with: naming-conventions
has title: How to name methods in documentation?
has answer: http://stackoverflow.com/a/25253603

http://stackoverflow.com/a/25104852
has comment: http://stackoverflow.com/comment/39067207
type: Answer
has body: You just have to compile the single file you've changed. JRebel is tracking all classes and it'll reload changed class during next access. To do that in IntelliJ you need to invoke Build -> Compile from menu or use proper shortcut of course (Ctrl + Shift + F9). Also from IntelliJ 12 you can just check option "Make project automatically" in Settings -> Compiler to automatically compile all edited files)
score: 3
answers question: http://stackoverflow.com/q/25104836
accepted answer of: http://stackoverflow.com/q/25104836
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39067171
upvote count: 3

http://stackoverflow.com/q/25071344
has body: I'm really struggling with regex right now... I've read up and looked at a lot of examples, but cannot seem to find the answer. I'd like to split a string when the string "::" is found, and I would like to discard those two characters. The closest I have gotten was splitting on the correct pattern, but it kept the colons. Here is an example of my input and desired output: String input = "One::Two::Three"; I would like the output to be: output[0]: "One" output[1]: "Two" output[2]: "Three"
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25071370
accepted answer: http://stackoverflow.com/a/25071365
has answer: http://stackoverflow.com/a/25071370
tagged with: repeat
tagged with: regex
has title: Java split and throw away on repeated char using regex
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/25071365

http://stackoverflow.com/comment/92205697
type: AnswerComment
has text: Great explanation @AaronM. So, non-blocking IO requires the program to poll the file handle periodically to check if the IO interrupt has occurred. If I'm understanding this correctly, it sounds like a waste to poll when we have this interrupt mechanism in place. Are there techniques to have the IO interrupt "bubble up" to the program to forgo the need for polling?
type: Comment
comment on: http://stackoverflow.com/a/40049018
score: 0

http://stackoverflow.com/q/25224150
upvote count: 1
tagged with: types
has answer: http://stackoverflow.com/a/25224156
accepted answer: http://stackoverflow.com/a/25224156
downvote count: 1
has comment: http://stackoverflow.com/comment/39289391
favorite count: 0
has body: Sometimes I see methods declared like this: public MethodName() { ... } other times, I see methods declared with a class defining the type they are returning(?). For example: public ClassName methodName() { ... } What's the point of this? Why do I have to specify the return type?
linked to: http://stackoverflow.com/q/2690544
has comment: http://stackoverflow.com/comment/39289395
possible better answer: http://stackoverflow.com/a/25224191
type: AnsweredQuestion
tagged with: oop
tagged with: java
type: Question
has title: Why do you have to specify method return type in Java?
has answer: http://stackoverflow.com/a/25224191
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39289413

http://stackoverflow.com/comment/39062594
type: Comment
has text: Thanks, I kept thinking it was the first one. That makes sense; there's no guarantee that the next node would not match as well.
comment on: http://stackoverflow.com/a/25102323
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39110141
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25125007
has text: In eclipse, in the properties for the project, there is an entry for "java build path". In that screen is a way to add and remove jar files from the path; if they're in the project, then you use Add, if you want to add them from outside the project, use "Add External".

http://stackoverflow.com/q/25167823
has answer: http://stackoverflow.com/a/25168031
answer count: 4
has comment: http://stackoverflow.com/comment/39184807
favorite count: 0
has comment: http://stackoverflow.com/comment/39185090
has comment: http://stackoverflow.com/comment/39184730
has answer: http://stackoverflow.com/a/25167973
accepted answer: http://stackoverflow.com/a/25167973
score: 2
type: AnsweredQuestion
tagged with: list
has comment: http://stackoverflow.com/comment/39184652
has body: I am trying to randomly generate 'n' number of items from a HashMap where 'n' is determined by the user. Here is what I have so far: public static void main(String []args){ int numColors = 3; HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put("White","FFFFFF"); map.put("Blank","000000"); map.put("Red","ED0A15"); map.put("Green","06F76C"); map.put("Blue","0689FF"); map.put("Sky Blue","00C2FC"); map.put("Light Blue","08F0FC"); map.put("Silver","C0BFC5"); map.put("Mint","ABD3CA"); map.put("Off White","FFEFF0"); map.put("Purple","736FFA"); map.put("Lavendar","DEBEEF"); map.put("Hot Pink","F5159A"); map.put("Pink","DB39CC"); map.put("Light Pink","F5C2E3"); map.put("Blush","C95FA7"); map.put("Orange","D4361B"); map.put("Yellow","DEF231"); map.put("Warm White","F3E4C3"); map.put("Turquoise","01DCA4"); List&lt;String&gt; valuesList = new ArrayList&lt;String&gt;(map.values()); int randomIndex = new Random().nextInt(valuesList.size()); String randomValue = valuesList.get(randomIndex); System.out.printf(randomValue); } It prints 1 random color for me (in hex) which I want, however I am unsure of how/which loop to use in order to generate say 3 random hex colors from the map. I declared numColors as 3 just to try and test this out. Here is what I ended up going with: public static void main(String []args){ int numColors = 3; HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put("White","FFFFFF"); map.put("Blank","000000"); map.put("Red","ED0A15"); map.put("Green","06F76C"); map.put("Blue","0689FF"); map.put("Sky Blue","00C2FC"); map.put("Light Blue","08F0FC"); map.put("Silver","C0BFC5"); map.put("Mint","ABD3CA"); map.put("Off White","FFEFF0"); map.put("Purple","736FFA"); map.put("Lavendar","DEBEEF"); map.put("Hot Pink","F5159A"); map.put("Pink","DB39CC"); map.put("Light Pink","F5C2E3"); map.put("Blush","C95FA7"); map.put("Orange","D4361B"); map.put("Yellow","DEF231"); map.put("Warm White","F3E4C3"); map.put("Turquoise","0…
tagged with: java
possible better answer: http://stackoverflow.com/a/25168034
has comment: http://stackoverflow.com/comment/39184667
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/136474
tagged with: hashmap
has title: Randomly select n items from a map
downvote count: 0
has answer: http://stackoverflow.com/a/25168034
has comment: http://stackoverflow.com/comment/39184664
tagged with: arraylist
tagged with: random
has comment: http://stackoverflow.com/comment/39184714
has answer: http://stackoverflow.com/a/25168635

http://stackoverflow.com/a/25175951
answers question: http://stackoverflow.com/q/25172083
has comment: http://stackoverflow.com/comment/39211737
type: Answer
has body: JPA 2.2 doesn't support this feature. If you are using Hibernate, then you can simply use a Hibernate CompositeUserType. Hibernate gives you the flexibility of mapping one or more SQL types to specific Domain Model subtypes (e.g. Currency, Money).
has comment: http://stackoverflow.com/comment/39210826
has comment: http://stackoverflow.com/comment/108729536
upvote count: 7
has comment: http://stackoverflow.com/comment/39209672
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/108732506
score: 7
accepted answer of: http://stackoverflow.com/q/25172083

http://stackoverflow.com/a/25203693
upvote count: 2
has body: Timer task is not related with fragment life cycle. You can cancel timer when you finished your job with that fragment. Fragment's onStop method is good place to do that. public void onStop() { super.onStop(); timer.cancel(); }
has comment: http://stackoverflow.com/comment/39259794
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25203360
type: Answer

http://stackoverflow.com/comment/39212234
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25181591
has text: Do you have to use XPath? If you can transform your query to be built using [`Predicate.class`](http://docs.adobe.com/docs/en/cq/current/javadoc/com/day/cq/search/Predicate.html) you could add two queries to one PredicateGroup with `setAllRequired(false)` specified.
score: 0

http://stackoverflow.com/q/25214701
answer count: 2
has comment: http://stackoverflow.com/comment/39272103
tagged with: binary-tree
has answer: http://stackoverflow.com/a/25215169
tagged with: nullpointerexception
tagged with: while-loop
has answer: http://stackoverflow.com/a/25214723
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39272102
has body: I am using a binary tree structure here. I am getting a "NullPointerException" from the line containing the while statement. I am completely confused about why that would be. BinaryTreeNode&lt;CharData&gt; currNode = theTree.findValue(data); // Move up the Binary Tree to create code. while(currNode.getParent() != null) { // The loop does some stuff that doesn't // affect what is assigned to currNode. // Move to the parent node for the next iteration. currNode = currNode.getParent(); } // End the while loop. return code; // Return the string of binary code. Find value is a method from my BinaryTree class that searches for and finds the node containing specific data. I know this works from testing it separately outside of this implementation.
type: Question
has title: NullPointerException in a while loop using a Binary Tree node
tagged with: java
has comment: http://stackoverflow.com/comment/39272650
has comment: http://stackoverflow.com/comment/39272093
tagged with: eclipse
score: 0

http://stackoverflow.com/a/25199681
has body: Install Maven on the system(not having IDE) before running the code ensure you've got system property M2_HOME set to your Maven installation location and also Maven bin folder added to PATH go to the directory,containing pom.xml of your project and type "mvn install" plus Enter to build your project if it's for example simple project,packaged as JAR,you can run it then by typing something like this in the console: $ java -cp target/simple-1.0-SNAPSHOT.jar org.yourcompany.projectNam.App and Enter
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25199279

http://stackoverflow.com/comment/39190603
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25169175
score: 0
has text: @agbinfo Actually, Java already has this problem, with default methods. If two interfaces declare `default void identify()`, which one is used? It's a compile error, and you have to implement an overriding method (which could just be `Animal.super.identify()`). So Java already resolves this problem for default methods – why not for static methods?

http://stackoverflow.com/comment/39257403
has text: Sorry, sort of a tough question to ask for me, tried to clarify. Hopefully what i added is clearer.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25194100

http://stackoverflow.com/q/25157934
tagged with: java
accepted answer: http://stackoverflow.com/a/25158776
type: Question
tagged with: jsoup
answer count: 2
has body: I am trying to store the HTML links of a webpage in a set. (Since sets don't allow duplicate strings?) Followed by parsing the HTML from those links Then Storing the parsed links in another set. So far all I have gotten is this: public static void main(String[] args) throws IOException { Document doc = Jsoup.connect("http://en.wikipedia.org/wiki/Matrix_(mathematics)").get(); Elements links = doc.select("body a"); System.out.println(links);
possible better answer: http://stackoverflow.com/a/25158009
has answer: http://stackoverflow.com/a/25158009
score: 0
has title: How do I store the links of a webpage in a set using Jsoup?
has answer: http://stackoverflow.com/a/25158776
type: AnsweredQuestion

http://stackoverflow.com/q/25220651
has title: Google Game Services for Android Stubborn Error
tagged with: service
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39283438
has answer: http://stackoverflow.com/a/25297632
tagged with: google-play-services
score: 0
answer count: 1
tagged with: google-play-games
tagged with: android
has comment: http://stackoverflow.com/comment/39428417
has body: I've used SO to help me solve programming frustrations for years now and this feels like the first time I've had an issue that's unique to me alone (or at least that noone else has asked about). Anyway, here's my issue below and I'd be very grateful for any help anyone can offer. :) I've been trying for the past 24 hours or so to implement Google Game Services in my existing Android app. I followed the instructions provided by Google with regards to setting up the app in the developer console, using the signing certificate key, linking it to my app in the store, put the application ID into my Eclipse project in the location and all of that. I derive from the BaseGameActivity class as recommended and my project compiles fine with no errors. I also use the FacebookSDK and AdMob/Google ads (using the new Google services library). I can't think of anything I haven't done that could explain my error - which is as follows... When my app opens and attempts to sign in, it pops up and asks for permissions/authorization as normal but once I grant these permissions it says "Failed to sign in. Please check your network connection and try again.". This has happened every time for the past 24 hours as I've been trying little tweaks here and there hoping to make a difference. I'm 100 % sure there's no problem with my network connection as implied by the error message. P.S. It did seem to connect/sign in one random time and I got the welcome message but by the time it got to the next activity in my app it seemed to have signed out again and the error message returned. I've also checked from the Google+ side and I can see where I have indeed granted my app permissions (which implies that I did sign in successfully and authorize it properly) so I can't understand the error messages I'm getting within the game itself. I know this was very long but I wanted to be as thorough with my explanation as possible - can anyone please advice me on how to deal with this? :( import java.util.Iter…

http://stackoverflow.com/a/25218900
has comment: http://stackoverflow.com/comment/39283793
has comment: http://stackoverflow.com/comment/39281231
answers question: http://stackoverflow.com/q/25213686
downvote count: 0
has body: If all you want is the possibility to use <c:if> you must have a scoped variable. Attributes of current request, session of application context are with respective scope being request, session and application. You can easily put variables in page context (valid only for the current jsp, and others included by @include but not by <jsp:include>) : <% ... String statut = useraction.Connect(); pageContext.setAttribute("statut", statut); %> <c:if test="${statut == 'ADMIN'}"> ... </c:if> But if you want to to many excluvise test the correct tag is <c:choose> : <% String statut = useraction.Connect(); pageContext.setAttribute("statut", statut); %> <c:choose> <c:when test="${statut eq 'ADMIN'}"> ... </c:when> <c:when test="${statut == 'USER'}"> ... </c:when> <c:otherwise> Status ${statut} not found </c:otherwise> </c:choose> I've just tested it it works (on my machine ...), and the otherwise clause could explain why you do not get what you want.
has comment: http://stackoverflow.com/comment/39284602
score: 1
has comment: http://stackoverflow.com/comment/39283284
has comment: http://stackoverflow.com/comment/39284008
has comment: http://stackoverflow.com/comment/39280565
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39283708

http://stackoverflow.com/a/25174957
has comment: http://stackoverflow.com/comment/39214890
accepted answer of: http://stackoverflow.com/q/25173630
upvote count: 2
answers question: http://stackoverflow.com/q/25173630
type: AcceptedAnswer
has body: Try changing this: @OneToMany(mappedBy = "id") public Set&lt;ClusterMember&gt; getMembers() { return members; } to @OneToMany(mappedBy = "cluster") public Set&lt;ClusterMember&gt; getMembers() { return members; } and add insertable/updatable to false on the associated ManyToOne mapping. @ManyToOne @JoinColumn(name = "cluster_id", insertable="false", updatable="false") public Cluster getCluster() { return cluster; } Because you are not really interested in the ClusterMember.id but in the FK linking back to Cluster. In Hibernate you cannot use the same column in to different mapping. The "ClusterMember" already uses "cluster_id" for the @Id property, hence if you plan on using for a ManyToOne association, you need to instruct Hibernate to ignore any changes to this end (inserts and updates should be ignored). Also you can use Hibernate's @MapsId annotation, for composite identifiers with alternate associated mappings.
has comment: http://stackoverflow.com/comment/39214483
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39214168
has comment: http://stackoverflow.com/comment/39224468

http://stackoverflow.com/comment/39074568
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25107499
has text: @shlomi33 - http://stackoverflow.com/questions/19528304/how-to-get-the-threadpoolexecutor-to-increase-threads-to-max-before-queueing

http://stackoverflow.com/q/25214169
type: AnsweredQuestion
has title: Compile error with Java Generics and Apache Olingo 4
score: 1
tagged with: java
has body: I’ve extended some of the base classes of Apache Olingo 4 (still in development) to allow for stronger typing. However, my use of generics is causing an error that I didn’t expect. I have a type parameter E that extends FooODataEntity which in turn implements the ODataEntity interface. Since FooODataEntity is an ODataEntity (just more specific) I would expect this to compile with no issues. However, getEntities() has a compilation error as shown in the code below. Also, I would expect to be able to specify List&lt;E&gt; as a return type for my override of getEntities() but then I get a compile error saying: 'getEntities()' in 'com.foo.restapi.client.olingo.FooEntitySet' clashes with 'getEntities()' in 'org.apache.olingo.commons.api.domain.v4.ODataEntitySet'; attempting to use incompatible return type What am I missing here? FooODataEntitySet: package com.foo.restapi.client.olingo; import com.foo.restapi.client.FooODataEntity; import com.foo.restapi.client.exceptions.FooRuntimeException; import org.apache.olingo.commons.api.domain.v4.ODataAnnotation; import org.apache.olingo.commons.api.domain.v4.ODataEntity; import org.apache.olingo.commons.api.domain.v4.ODataEntitySet; import org.apache.olingo.commons.core.domain.AbstractODataEntitySet; import java.lang.reflect.Constructor; import java.net.URI; import java.util.ArrayList; import java.util.List; public class FooEntitySet&lt;E extends FooODataEntity&gt; extends AbstractODataEntitySet implements ODataEntitySet { private final List&lt;E&gt; entities = new ArrayList&lt;E&gt;(); public FooEntitySet() { super(); } @Override public List&lt;ODataEntity&gt; getEntities() { // compile error // Incompatible types. Found: 'java.util.List&lt;E&gt;', // required: 'java.util.List&lt;org.apache.olingo.commons.api.domain.v4.ODataEntity&gt;' return entities; } } FooODataEntity: package com.foo.restapi.client; public class FooODataEntity extends AbstractODataPayload implements ODataEntity, ODataSingleton { // code not shown }
type: Question
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39271482
has answer: http://stackoverflow.com/a/25250788
accepted answer: http://stackoverflow.com/a/25250788
favorite count: 0
linked to: http://stackoverflow.com/q/10803005
upvote count: 1
tagged with: generics
tagged with: olingo
has comment: http://stackoverflow.com/comment/39342928
has comment: http://stackoverflow.com/comment/39340047

http://stackoverflow.com/comment/39189459
type: Comment
comment on: http://stackoverflow.com/q/25170185
has text: I may have misunderstood, but adding a XML prolog in the middle of an XML document invalid. A SOAPMessage is already a XML Document, and the SOAP Body is nested, so you can not repeat the prolog. Could you explain what the result end result you seek would look like ?
score: 0
type: QuestionComment

log4j2
tags question: http://stackoverflow.com/q/25081829
tags question: http://stackoverflow.com/q/25085648
tags question: http://stackoverflow.com/q/25186957
tags question: http://stackoverflow.com/q/25118993
tags question: http://stackoverflow.com/q/25100047
tags question: http://stackoverflow.com/q/25175794
tag name: log4j2
type: Tag
tags question: http://stackoverflow.com/q/25114526

http://stackoverflow.com/q/25124485
type: UnansweredQuestion
tagged with: keystore
tagged with: jetty
has comment: http://stackoverflow.com/comment/39142640
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39142567
type: Question
tagged with: ssl
score: 0
has comment: http://stackoverflow.com/comment/39114106
has title: how to reapply the same certificate to my JDK?
has body: I created a jetty.crt and imported that to my JDK security cert as follows: sudo /usr/java/latest/bin/keytool -import -v -trustcacerts -alias jetty -file /path/etc/jetty.crt -keystore /usr/java/jdk1.6.0_31/jre/lib/security/cacerts -keypass changeit -storepass changeit I realized that I wanted to re-create the certificate. But when importing the certificate again using the same command above, it doesn't accept it. I was forced to create another certificate with another alias and then import it. Is there any way i can import with the same alias again? Note: I do not want to delete the previous import. Update: The error I get when reapplying the same alias is : keytool error: java.lang.Exception: Certificate not imported, alias already exists java.lang.Exception: Certificate not imported, alias already exists at sun.security.tools.KeyTool.addTrustedCert(KeyTool.java:1903) at sun.security.tools.KeyTool.doCommands(KeyTool.java:818) at sun.security.tools.KeyTool.run(KeyTool.java:172) at sun.security.tools.KeyTool.main(KeyTool.java:166) – Thanks

http://stackoverflow.com/comment/39288207
type: QuestionComment
has text: Yeah maybe I'm just expecting too much out of Eclipse haha. I guess you get what you paid for
comment on: http://stackoverflow.com/q/25223353
score: 0
type: Comment

http://stackoverflow.com/q/25213150
favorite count: 0
has comment: http://stackoverflow.com/comment/39269408
has title: Selenium "return" javascript value not printing
accepted answer: http://stackoverflow.com/a/25213207
has comment: http://stackoverflow.com/comment/39269234
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/25213207
type: Question
tagged with: javascript
has body: I'm using Selenium with Java for some tests. The code I have to print the pages html from javascript works great as an alert: js.executeScript("alert($('html').html());"); However when I use return, nothing prints in the Eclipse console: js.executeScript("return $('html').html();"); What am I doing wrong, and how can i print (using System.out.print) the html result from returning in Javascript? Thanks, and no I do not want to use source.
upvote count: 1
answer count: 1

http://stackoverflow.com/a/25187099
score: 0
type: Answer
has body: You didnt provide stacktrace so, LET ME GUESS My Attempt to Solve your problem : You cast an ImageView to be a Button and yet in the View Heirarchy , TextView is the parent of Button while ImageView's parent is View. View -> TextView -> Button MEANWHILE View -> ImageView Post your logcat man!
answers question: http://stackoverflow.com/q/25186788

http://stackoverflow.com/comment/39197948
comment on: http://stackoverflow.com/a/25174786
type: Comment
has text: I have no idea why I did if (possitive2 == 0) lol
type: AnswerComment
score: 0

http://stackoverflow.com/a/25180422
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25177562
answers question: http://stackoverflow.com/q/25177562
score: 1
has comment: http://stackoverflow.com/comment/39208080
has body: onMessage() is a part of MessageListener pattern. It is some active component, which is initiated by the external system (from big height). And it works each time by that remote command, so you can't use it as a passive componet to be initiated by the user call. Since you have "Flume lifecycle Start()" from other side and SimpleMessageListenerContainer has the same from its side, I'd say you have to correlate their lifecycles to work in tandem. From here you should to provide for the SimpleMessageListenerContainer some inline MessageListener implementation, which invokes the desired method to "post onto the Flume channel". HTH UPDATE SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory); .... container.setMessageListener(new MessageListener() { public void onMessage(Message message) { sendMessageToFlumeChannel(message); } }); Where the sendMessageToFlumeChannel is a method of the holding class. Of course it can be any POJO instead of MessageListener implementation, but the main goal to delegate listener resul to some method.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39208413
type: Answer

http://stackoverflow.com/q/25091790
has title: Java Out of Bounds Error
possible better answer: http://stackoverflow.com/a/25091894
type: Question
has answer: http://stackoverflow.com/a/25091894
answer count: 3
has comment: http://stackoverflow.com/comment/39172402
has body: When i Enter 1 record and I choose 1. Add Record it always have a error. And when i Enter 2 records I can only Enter 1 record and when i choose 1. Add Records again it says OutofBounds. How can i fix that error ? public static int recno=0, recsize, choice, i=0; public static void main (String args[]) throws IOException{ System.out.print("Enter Number of Records"); recsize = Integer.parseInt(reader.readLine()); String EmpNo[] = new String[recsize]; display_menu(EmpNo,recno); } public static void add_Rec(String EmpNo[], int recno) throws IOException{ ++recno; EmpNo[recno]= "EMP-"+ recno; System.out.print("Employee Number: " + EmpNo[recno]); System.out.print("\nEmployee Name: "); display_menu(EmpNo,recno); } public static void display_menu(String EmpNo[], int recno) throws IOException{ System.out.println("Main Menu"); System.out.println("1. Add record"); System.out.println("Enter Your Choice"); choice = Integer.parseInt(reader.readLine()); if (choice==1){ add_Rec(EmpNo,recno); } }
has answer: http://stackoverflow.com/a/25091872
accepted answer: http://stackoverflow.com/a/25091872
score: 0
has comment: http://stackoverflow.com/comment/39043364
has comment: http://stackoverflow.com/comment/39043265
has answer: http://stackoverflow.com/a/25091937
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/25136173
has comment: http://stackoverflow.com/comment/39125453
has comment: http://stackoverflow.com/comment/39125839
has answer: http://stackoverflow.com/a/25136241
tagged with: java
linked to: http://stackoverflow.com/q/564913
has body: I have a void method that prints some stuff. Can (swing)TextField be filled with the content of my print, somehow? Or should I use something different? if my method prints: Hello how are you? I would like to show on the window, exactly that. Thank you. private class ButtonListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { label.setText(instance.voidMethodThatPrints()); } } It does not work cause setText takes a string, so I was trying to ask you if there's a faster way to make it work.
tagged with: eclipse
type: Question
upvote count: 0
score: -2
tagged with: awt
has title: Show on a window (awt/swing) what I system.out.prinlt()
answer count: 2
has comment: http://stackoverflow.com/comment/39126237
has answer: http://stackoverflow.com/a/25136296
favorite count: 0
type: UnansweredQuestion
downvote count: 2
tagged with: swing

http://stackoverflow.com/comment/39248507
type: QuestionComment
has text: Please provide some logs
comment on: http://stackoverflow.com/q/25202481
score: 0
type: Comment

http://stackoverflow.com/a/25140390
answers question: http://stackoverflow.com/q/25140203
type: Answer
score: 1
upvote count: 1
downvote count: 0
has body: You have to set the onclicklistener on each View but there is a cleaner way of doing so. Put this in the Activity code: public void myOnclickListener(View v) { Toast.makeText(v.getContext(),"button clicked",Toast.LENGTH_SHORT).show(); } Then set the click listener in your xml: &lt;TextView android:id="@+id/mytext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="myOnclickListener" /&gt;

http://stackoverflow.com/comment/39232248
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25193304
type: AnswerComment
has text: That's the right way. You'll read all sorts of nonsense from exception-phobic thought police about this, but the fact is that this API throws EOFException at end of stream: therefore you have to catch it.

http://stackoverflow.com/comment/39061715
has text: thanks to both of your answer. Just one more thing. Then why is there a load factor in LRUMap. I actually also thought that as we are saying there is a MaxSize and there is a isFull() method, the size should not increase as it is LRU. Then I saw the linked discussion on load factor and hence my question. Does load factor play any role in LRU then.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25097757

http://stackoverflow.com/q/25088242
answer count: 3
has title: What am I doing wrong in this jersey Java class?
has answer: http://stackoverflow.com/a/25088285
has answer: http://stackoverflow.com/a/65990758
score: 5
type: AnsweredQuestion
has body: Here is the class :- package com.bablo.rest; import javax.websocket.server.PathParam; import javax.ws.rs.Path; @Path("/") public class Library { @Produces("text/plain") @Path("/books/{name}") public String getBook(@PathParam("name") String name){ System.out.println(name); return "My Name is Anthony Goncalves"; } } Its giving this as error A sub-resource locator, public java.lang.String com.bablo.rest.Library.geBook(java.lang.String), can not have an entity parameter. Try to move the parameter to the corresponding resource method. and Missing dependency for method public java.lang.String com.bablo.rest.Library.getBook(java.lang.String) at parameter at index 0 I am invoking this webservice through the Browser like this http://localhost:8080/JAXRS-HelloWorld/rest/books/bablo Also I am doing curl: curl -X GET http://localhost:8080/JAXRS-HelloWorld/rest/books/bablo
upvote count: 5
tagged with: java
possible better answer: http://stackoverflow.com/a/33113177
has comment: http://stackoverflow.com/comment/39036960
accepted answer: http://stackoverflow.com/a/25088285
type: Question
has answer: http://stackoverflow.com/a/33113177
tagged with: jersey
has comment: http://stackoverflow.com/comment/39036891
downvote count: 0
tagged with: jax-rs
favorite count: 0

http://stackoverflow.com/comment/39187465
comment on: http://stackoverflow.com/a/25169087
score: 0
type: AnswerComment
type: Comment
has text: `post.addHeader( "Some name" , "some name value" );` That should work.

http://stackoverflow.com/comment/39285818
type: AnswerComment
comment on: http://stackoverflow.com/a/25182880
score: 0
type: Comment
has text: There you are then. You are invoking the toString method of the salt array, but unfortunately it does not print the byte values in the array. The output will vary as the objects are different. Try: `for (byte b : salt) { System.out.print(b + " "); }`

http://stackoverflow.com/a/25211040
answers question: http://stackoverflow.com/q/25210024
has body: The xml layout you give us has 2 NumberPicker elements with visibility "gone" I presume that at some point you make the third NumberPicker visible. In the above case the second NumberPicker has android:gravity="center" android:layout_gravity="center" and the third does not. This might be causing you the alignment problem
type: Answer
has comment: http://stackoverflow.com/comment/39265381
has comment: http://stackoverflow.com/comment/39265080
score: 0

http://stackoverflow.com/comment/39017144
has text: I resolved I wrote in the file. Properties of different instructions that I found in an article that said how to integrate log4j with spring mvc.
comment on: http://stackoverflow.com/a/25077293
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39017884
type: Comment
comment on: http://stackoverflow.com/a/25074773
type: AnswerComment
has text: I've updated the question for clarity. Child1 and Child2 are subclasses of Parent. Thus, both subclasses depend on the super. Applying your suggestions gives the semantic issue, `Attempting to use the forward class 'Parent' as a superclass of 'Child1'`.
score: 0

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

http://stackoverflow.com/comment/39116002
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25130788
has text: @tmax for love of Moses you are checking everything char by char. use stack and make yourself happy
score: 0

http://stackoverflow.com/comment/39037217
comment on: http://stackoverflow.com/q/25087035
type: QuestionComment
score: 0
has text: To format, select the code block and click the braces icon. Is that a `java.awt.Canvas` your extending? As an aside, consider `MouseAdapter`.
type: Comment

http://stackoverflow.com/q/25070041
accepted answer: http://stackoverflow.com/a/25070233
has body: I am trying to make it so that if a player is opped or has atleast one of two permission nodes, they are allowed to execute a command Player player = (Player) sender; if (! (player.hasPermission("perm.node1")) || (player.hasPermission("perm.node2")) ) { sender.sendMessage(ChatColor.RED + "Access denied!"); return true; } I am testing this plugin on a server with the same bukkit build as the one the plugin was compiled with and I am opped ingame, I have not given myself any of the permissions With only one permission node if (! (player.hasPermission("perm.node1"))) being required, the code works fine but with both permissions listed, it replied with "Access denied!". The words "Access denied!" appear nowhere else in the code so it must be coming from this statement I have tried adding another or to the if statement player.isOp(), but it has no effect If I am in a user group with perm.node1 I can execute the command in question without getting "Access denied!" but if I have perm.node2, I do get "Access denied!", regardless of if I have perm.node1
score: 0
answer count: 1
tagged with: plugins
tagged with: permissions
type: AnsweredQuestion
tagged with: java
tagged with: bukkit
has title: Bukkit plugin multiple permissions not working
type: Question
has answer: http://stackoverflow.com/a/25070233

http://stackoverflow.com/comment/39168522
type: QuestionComment
score: 1
has text: Take a look at [The Perils of Image.getScaledInstance()](https://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html)
type: Comment
comment on: http://stackoverflow.com/q/25159067

http://stackoverflow.com/q/25168084
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/39186425
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/39186615
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: java
has title: Android edit stored .html page
has comment: http://stackoverflow.com/comment/39186990
has body: I have a locally stored HTML file in my assets folder that I am accessing through this: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); WebView webView = new WebView(this); setContentView(webView); webView.loadUrl("file:///android_asset/test.html"); } I was wondering if there is any way I would be able to edit the source of the HTML file loaded, as I may need to manipulate certain elements. ex. I have a Johny in the test.html, How can I change it by using an edittext? I know how to use and show and get results form an edittext, but then, how to replace what is from the edittext to the tags in replacement to Johny?
has comment: http://stackoverflow.com/comment/39186957
has comment: http://stackoverflow.com/comment/39186505

http://stackoverflow.com/comment/39085983
score: 0
has text: As noted in [http://docs.oracle.com/javase/tutorial/uiswing/components/internalframe.html](http://docs.oracle.com/javase/tutorial/uiswing/components/internalframe.html) you can use `java.awt.Component.setLocation(int x, int y)`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25113274

http://stackoverflow.com/a/29968384
type: Answer
has comment: http://stackoverflow.com/comment/76518233
has body: The answer is No. The main issue with Maven and S3 repo is that Maven loads a parent POM before a S3 wagon. Check here for details: http://www.sonatype.org/nexus/2015/03/03/why-s3-is-not-the-perfect-maven-repository/
score: 0
answers question: http://stackoverflow.com/q/25224864

http://stackoverflow.com/comment/39105800
has text: Are there bounds on the value of the integers?
comment on: http://stackoverflow.com/q/25125299
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39199000
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25173618
type: QuestionComment
has text: @Saif Yes. The dynamic state means that i change static directory with the path of i choose. Does it work?

http://stackoverflow.com/q/25186004
tagged with: groovy
has title: Running spock unit tests with Maven
upvote count: 32
favorite count: 0
possible better answer: http://stackoverflow.com/a/27535340
has answer: http://stackoverflow.com/a/68133626
has answer: http://stackoverflow.com/a/27535340
has answer: http://stackoverflow.com/a/25186309
tagged with: maven
tagged with: unit-testing
answer count: 4
type: AnsweredQuestion
tagged with: spock
tagged with: java
has answer: http://stackoverflow.com/a/45984697
type: Question
accepted answer: http://stackoverflow.com/a/25186309
downvote count: 0
score: 32
has body: On a previous project I used the Spock testing framework to unit test my Java code. I found this really productive so I am trying to add Spock tests to my current project which uses Maven as its build tool (The previous project used Gradle). While I can get Maven to compile my Spock tests (using groovy-eclipse-compiler), I am unable to get Maven to run the tests. I've made a simple example to demonstrate my problem with 2 files: pom.xml src/test/java/ASpec.groovy Contents of pom.xml: 4.0.0 my.group my-artifact 0.1-SNAPSHOT junit junit 4.10 org.codehaus.groovy groovy-all 2.0.8 test org.spockframework spock-core 0.7-groovy-2.0 test org.apache.maven.plugins maven-compiler-plugin 3.1 groovy-eclipse-compiler org.codehaus.groovy groovy-eclipse-compiler 2.8.0-01 org.codehaus.groovy groovy-eclipse-batch 2.1.8-01 Contents of ASpec.groovy: import spock.lang.Specification class ASpec extends Specification { def "Test A"(){ // Always fail expect: false } } When I execute mvn clean test (or mvn clean install) I would expect my single unit test to be run and fail. While it is compiled, Maven does not run it. Does any one know how to run a Spock unit test from Maven (or if it is possible?) (I have not put my test in a package to keep the example simple. Also I have put my groovy code in src/test/java to avoid configuring the example to pick up source files from an additional directory, again to keep the example as simple as possible.)

http://stackoverflow.com/comment/39258620
score: 0
has text: @SterlingArcher May I ask, which book is it?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25207419

http://stackoverflow.com/q/25188722
has answer: http://stackoverflow.com/a/25188913
downvote count: 2
has answer: http://stackoverflow.com/a/25188906
tagged with: java
tagged with: unit-testing
type: Question
has body: This example is custom made to ask my doubt. Object Car { color:null tyre : 0; } fillCar(Object Car, boolean b) { if (b) { Car.color = "Red" } else { Car.tyre = 4; } } Now i need to unit test my code. My test1 is (Car, true) and test2 is (Car, false). My question: Do i need to test "tyres == 4" when in test1 and on similar lines do i need to check "color == null" when test2 ?
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/39223497
answer count: 3
has title: Should we check no changes in unit tests?
favorite count: 0
has answer: http://stackoverflow.com/a/25189033
has comment: http://stackoverflow.com/comment/39223144
type: UnansweredQuestion

http://stackoverflow.com/comment/39276808
has text: What noise would an `Animal` make?
comment on: http://stackoverflow.com/q/25217154
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39345192
type: Comment
score: 0
type: AnswerComment
has text: where should I define this event? is it like this "table.addListener(SWT.FocusOut,tableListner)" ? For some reason, after I defined this event, my delete button is always disabled :( Do I miss something here?
comment on: http://stackoverflow.com/a/25216235

http://stackoverflow.com/comment/39107739
comment on: http://stackoverflow.com/a/25123964
score: 1
type: AnswerComment
has text: No they don't, only option 1 requires C++. With 2 and 3 you can use pure Java Sound to access specific recording devices. Those recording devices will be feeding you audio output.
type: Comment

android
tags question: http://stackoverflow.com/q/25168084
tags question: http://stackoverflow.com/q/25142522
tags question: http://stackoverflow.com/q/25123942
tags question: http://stackoverflow.com/q/25187691
tags question: http://stackoverflow.com/q/25201495
tags question: http://stackoverflow.com/q/25121868
tags question: http://stackoverflow.com/q/25195988
tags question: http://stackoverflow.com/q/25077132
tags question: http://stackoverflow.com/q/25227125
tags question: http://stackoverflow.com/q/25142354
tags question: http://stackoverflow.com/q/25163795
tags question: http://stackoverflow.com/q/25072706
tags question: http://stackoverflow.com/q/25099413
tags question: http://stackoverflow.com/q/25133665
tags question: http://stackoverflow.com/q/25099286
tags question: http://stackoverflow.com/q/25162458
tags question: http://stackoverflow.com/q/25166193
tags question: http://stackoverflow.com/q/25216220
tags question: http://stackoverflow.com/q/25202491
tags question: http://stackoverflow.com/q/25108925
tags question: http://stackoverflow.com/q/25221501
tags question: http://stackoverflow.com/q/25186538
tags question: http://stackoverflow.com/q/25218853
tags question: http://stackoverflow.com/q/25118278
tags question: http://stackoverflow.com/q/25229210
tags question: http://stackoverflow.com/q/25130009
tags question: http://stackoverflow.com/q/25117986
tags question: http://stackoverflow.com/q/25124662
tags question: http://stackoverflow.com/q/25120645
tags question: http://stackoverflow.com/q/25111484
tags question: http://stackoverflow.com/q/25197134
tags question: http://stackoverflow.com/q/25078754
tags question: http://stackoverflow.com/q/25101293
tags question: http://stackoverflow.com/q/25097065
tags question: http://stackoverflow.com/q/25079249
tags question: http://stackoverflow.com/q/25083753
tags question: http://stackoverflow.com/q/25199974
tags question: http://stackoverflow.com/q/25082180
tags question: http://stackoverflow.com/q/25100593
tags question: http://stackoverflow.com/q/25130196
tags question: http://stackoverflow.com/q/25087267
tags question: http://stackoverflow.com/q/25126582
tags question: http://stackoverflow.com/q/25207581
tags question: http://stackoverflow.com/q/25100695
tags question: http://stackoverflow.com/q/25103631
tags question: http://stackoverflow.com/q/25207091
tags question: http://stackoverflow.com/q/25122702
tags question: http://stackoverflow.com/q/25155031
tags question: http://stackoverflow.com/q/25098300
tags question: http://stackoverflow.com/q/25163328
tags question: http://stackoverflow.com/q/25072419
tags question: http://stackoverflow.com/q/25105687
tags question: http://stackoverflow.com/q/25125776
tags question: http://stackoverflow.com/q/25165254
tags question: http://stackoverflow.com/q/25183571
tags question: http://stackoverflow.com/q/25078930
tags question: http://stackoverflow.com/q/25122287
tags question: http://stackoverflow.com/q/25157765
tags question: http://stackoverflow.com/q/25086362
tags question: http://stackoverflow.com/q/25158590
tags question: http://stackoverflow.com/q/25229194
tags question: http://stackoverflow.com/q/25197345
tags question: http://stackoverflow.com/q/25142625
tags question: http://stackoverflow.com/q/25163994
tags question: http://stackoverflow.com/q/25075993
tags question: http://stackoverflow.com/q/25106640
tags question: http://stackoverflow.com/q/25193689
tags question: http://stackoverflow.com/q/25097006
tags question: http://stackoverflow.com/q/25186543
tags question: http://stackoverflow.com/q/25102513
tags question: http://stackoverflow.com/q/25166023
tags question: http://stackoverflow.com/q/25140203
tags question: http://stackoverflow.com/q/25172137
tags question: http://stackoverflow.com/q/25116187
tags question: http://stackoverflow.com/q/25107991
tags question: http://stackoverflow.com/q/25133950
tags question: http://stackoverflow.com/q/25177428
tags question: http://stackoverflow.com/q/25229428
tags question: http://stackoverflow.com/q/25142147
tags question: http://stackoverflow.com/q/25112355

http://stackoverflow.com/a/25168034
type: Answer
has body: A simple solution is to shuffle the entire map using Collections.shuffle(map). Then just iterating over it and picking the first n elements. Of course this doesn't make sense if the map is huge and you only need a couple of elements. Edit: Naturally, with this solution you won't get any duplicate entries
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25167823
has comment: http://stackoverflow.com/comment/39185013
upvote count: 2
has comment: http://stackoverflow.com/comment/39185031

http://stackoverflow.com/a/25204477
answers question: http://stackoverflow.com/q/25203821
has comment: http://stackoverflow.com/comment/39253219
has body: You don't need to attach the file appender twice, just attach it once at the com.company.app level and let additivity do the right thing: # Application logs log4j.logger.com.company.app=DEBUG, file log4j.additivity.com.company.app=false log4j.logger.com.company.app.sub=TRACE Here com.company.app.sub will inherit the file appender from its parent com.company.app but inheritance will stop here because of the additivity setting so it won't inherit the stdout appender from the root logger.
has comment: http://stackoverflow.com/comment/81048966
score: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25203821
type: Answer
upvote count: 4

http://stackoverflow.com/comment/39085596
type: QuestionComment
comment on: http://stackoverflow.com/q/25114626
score: 0
type: Comment
has text: @ 1337 please explain me in the context of my code.

http://stackoverflow.com/comment/39023881
type: Comment
score: 1
type: QuestionComment
has text: In that line you say it should run at 6:00, 6:30, 9:00, 9:30, 12:00, 12:30. You probably want to make 2 lines for that, one with `30 6 * * ...` and `0 9,12,14 * * ....`
comment on: http://stackoverflow.com/q/25081658

http://stackoverflow.com/comment/39210550
type: QuestionComment
has text: possible duplicate of [Java: unparseable date exception](http://stackoverflow.com/questions/2009207/java-unparseable-date-exception)
comment on: http://stackoverflow.com/q/25178772
score: 0
type: Comment

http://stackoverflow.com/a/26242797
upvote count: 16
answers question: http://stackoverflow.com/q/25082148
type: Answer
has comment: http://stackoverflow.com/comment/48108833
downvote count: 0
score: 16
has comment: http://stackoverflow.com/comment/140159107
has body: Use @SendToUser and add "/user/" in front of queue when subscribing (only subscriber side). Rest works magic :-) Instead of Java Server: @SendTo("/topic/showResult") and JS Client: stompClient.subscribe('/topic/showResult', function(calResult){ .... use: Java Server: @SentToUser("/topic/showResult") and JS Client: stompClient.subscribe('/user/topic/showResult', function(calResult){ ....

http://stackoverflow.com/comment/39112437
score: 0
type: AnswerComment
type: Comment
has text: @ValentinRuano Edited. (I hope it's correct, since I haven't been able to test this at all as I don't have any Java compiler near me.)
comment on: http://stackoverflow.com/a/25128636

http://stackoverflow.com/q/25186788
has comment: http://stackoverflow.com/comment/39219672
type: Question
has comment: http://stackoverflow.com/comment/39219639
tagged with: java
tagged with: eclipse
has body: I've been trying to write a simple BMI calculator as my first app. I was using an outdated tutorial to do so and was not the first to have a problem running my app (it just exits when I try to run it), but what others sugested didn't seem to do the trick for me. I have no idea what's wrong so please help me fix this and point out what is wrong so I don't repeat my mistakes. Here is my code: import android.app.Activity; import android.graphics.Typeface; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { int cm,kg,bmi,cm2; Button wsub10,wsub1,wadd1,wadd10,hsub10,hsub1,hadd1,hadd10,calcbmi; TextView displaybmi,h,w; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); cm = 170; cm2 = 0; kg = 60; bmi = 0; displaybmi = (TextView) findViewById(R.id.TextView04); h = (TextView) findViewById(R.id.TextView01); w = (TextView) findViewById(R.id.TextView03); Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/lucida.ttf"); //set typeface for all text TextView tv = (TextView) findViewById(R.id.textView00); tv.setTypeface(tf); TextView tv1 = (TextView) findViewById(R.id.TextView01); tv1.setTypeface(tf); TextView tv2 = (TextView) findViewById(R.id.TextView02); tv2.setTypeface(tf); TextView tv3 = (TextView) findViewById(R.id.TextView03); tv3.setTypeface(tf); TextView tv4 = (TextView) findViewById(R.id.TextView04); tv4.setTypeface(tf); TextView tv5 = (TextView) findViewById(R.id.TextView05); tv5.setTypeface(tf); TextView tv6 = (TextView) findViewById(R.id.TextView06); tv6.setTypeface(tf); TextView tv7 = (TextView) findViewById(R.id.TextView07); tv7.setTypeface(tf); TextView tv8 = (TextView) findViewById(R.id.TextView08); tv8.setTypeface(tf); TextView tv9 = (TextView) findViewById(R.id.TextView09); tv9.setTypeface(tf); TextView tv10 = (TextView) findViewById(R.id.TextView10); tv10.setTypefac…
accepted answer: http://stackoverflow.com/a/25187188
answer count: 2
has answer: http://stackoverflow.com/a/25187099
tagged with: calculator
has title: Android app calculator exits on start
has answer: http://stackoverflow.com/a/25187188
score: 0
tagged with: android
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39219486
possible better answer: http://stackoverflow.com/a/25187099
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/25123849
type: UnansweredQuestion
has body: I'm generating a temporary html site with my Eclipse plugin. As it seems, it is not possible to use the common way as for Java Swing, like so: URL location = getClass().getResource("/img/notifications/pic.png"); InputStream inputStream = location.openStream(); final Image ideaImage = new Image(display, inputStream); I tried using this, but logically I only get bundleresource://592.fwk513700442:1/img/html/pic.png. So currently I'm using the following approach: URL configURL = bc.getBundle().getResource("/img/html/pic.png"); File configFile = new File(FileLocator.toFileURL(configURL).getPath()); location = configFile.toString().substring(0, configFile.toString().length()-7); // 7 = length of "pic.png" to get the root folder This works, but only for the image for which I enter the name above. It's cumbersome to loop over all the images, I think, so there must be a better solution... Another solution would be to extract all my JAR contents into a local folder, but that's not really what I want as the user shouldn't be able to easily access all the files. EDIT: Clarification I do have an exported plugin in jar format. From inside this plugin I open up the user's native browser and open a temporary file. I do this with the following class: package de.stefansurkamp.handlers; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.net.URL; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import org.eclipse.core.runtime.FileLocator; import org.eclipse.equinox.security.storage.StorageException; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; public class WebsiteGenerator { private StringBuilder output = new StringBuilder(); private ArrayList&lt;Member&gt; achievementList = new ArrayList&lt;Member&gt;(); private String location; public WebsiteGenerator() { try { // get location information BundleContex…
type: Question
tagged with: java
tagged with: image
has comment: http://stackoverflow.com/comment/39103321
tagged with: jar
tagged with: eclipse-plugin
score: 0
tagged with: http://stackoverflow.com/tag/html
has title: Eclipse plugin: Path to jar directory for html site
has comment: http://stackoverflow.com/comment/39104774
answer count: 0

http://stackoverflow.com/a/25218216
has comment: http://stackoverflow.com/comment/39279497
has comment: http://stackoverflow.com/comment/39278921
accepted answer of: http://stackoverflow.com/q/25218010
upvote count: 1
has comment: http://stackoverflow.com/comment/39279175
has comment: http://stackoverflow.com/comment/39279264
has comment: http://stackoverflow.com/comment/39279335
has comment: http://stackoverflow.com/comment/39279174
has comment: http://stackoverflow.com/comment/39279057
has comment: http://stackoverflow.com/comment/39279207
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/39278972
has body: Download Picasso library from here Add it to your build path. Import this library to your code file. For loading from web url: String url = "http://example.com" Picasso.with(getApplicationContext()).load(url).into(imageView); For loading from drawable: Picasso.with(getApplicationContext()).load(R.drawable.imageFile).into(imageView); Here, imageView is the name of variable you are using to represent ImageView. Eg. ImageView imageView = (ImageView) findViewById(R.id.ImageView1); If you are using ImageButton, change imageView variable to imageButton variable ImageButton imageButton = (ImageButton)findViewById(R.id.imageButton); Note that I am passing variable name.
answers question: http://stackoverflow.com/q/25218010

http://stackoverflow.com/a/25159252
score: 4
has comment: http://stackoverflow.com/comment/39168005
has comment: http://stackoverflow.com/comment/39168238
type: Answer
has comment: http://stackoverflow.com/comment/39168088
accepted answer of: http://stackoverflow.com/q/25159221
upvote count: 4
answers question: http://stackoverflow.com/q/25159221
type: AcceptedAnswer
downvote count: 0
has body: Use replaceAll("\\.", "").length()); replaceAll() takes a REGEX as input. . has a special meaning in REGEX, it means any character. You need to escape it by using 2 \\s EDIT: Use : String temp = "TTT..####"; System.out.println(temp.split("\\.", -1).length - 1); // using -1 as limit in split() divides the String based on the passed argument (and gives empty Strings as result, if needed). So, in the split array you will have n+1 elements, where n is the number of occurances of the particular argument. So, we are doing length-1.

http://stackoverflow.com/comment/39073202
type: Comment
type: QuestionComment
has text: Should work. Which exception do you receive?
score: 0
comment on: http://stackoverflow.com/q/25107840

http://stackoverflow.com/comment/60410812
comment on: http://stackoverflow.com/a/36302827
score: 0
type: AnswerComment
type: Comment
has text: There is validateHttpMethodAndEntity function in JerseyInvocation which validates method and entity presence. This will throw IllegalStateException

http://stackoverflow.com/comment/39269681
has text: ohh yeah, you're right sorry, thanks a lot for the help!
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25212778

http://stackoverflow.com/q/25151917
has comment: http://stackoverflow.com/comment/39155206
has comment: http://stackoverflow.com/comment/39155182
score: 2
type: AnsweredQuestion
tagged with: numbers
tagged with: java
has comment: http://stackoverflow.com/comment/39155216
accepted answer: http://stackoverflow.com/a/25151957
has comment: http://stackoverflow.com/comment/39155164
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/25151964
has comment: http://stackoverflow.com/comment/39155499
has title: What happens if I exceed the limit of a variable in Java?
tagged with: byte
possible better answer: http://stackoverflow.com/a/25152053
has answer: http://stackoverflow.com/a/25152053
has answer: http://stackoverflow.com/a/25151957
favorite count: 0
has answer: http://stackoverflow.com/a/25152007
downvote count: 2
has body: Pretty small question, but I'm intrigued. Say I have the following code: byte b = 123134235; A byte can only store a number of -128 to 127. With this in mind, what happens if I give it the value 123134235 on an 'internal' scale. When I try compiling the code, I get the following error: test.java:10: error: possible loss of precision But what is the Java compiler actually doing? Is it just storing the value as 123... or? Apologies for my incoherent English, I'm really tired (5am here!)
has comment: http://stackoverflow.com/comment/39155267
answer count: 4

http://stackoverflow.com/comment/39239176
comment on: http://stackoverflow.com/q/25197047
type: Comment
type: QuestionComment
score: 0
has text: @IshanRastogi: How to retrieve the list of items that has been checked in the Tree view ?

http://stackoverflow.com/comment/67678170
type: Comment
comment on: http://stackoverflow.com/q/25088381
type: QuestionComment
has text: try allprojects { repositories { jcenter() mavenCentral() maven { url "https://nexus.spritzinc.com/content/repositories/PublicReleases" } } }
score: 0

http://stackoverflow.com/q/25071547
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25071574
has answer: http://stackoverflow.com/a/25071609
has answer: http://stackoverflow.com/a/25072096
tagged with: java
has title: Simple assembly code conversion to Java
upvote count: 1
has body: I want to convert the following code into Java code. I think it is assembly code, but not sure. The part that I really do not get is y -= m &lt; 3;. int dow(int y, int m, int d) { static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; y -= m &lt; 3; return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7; }
answer count: 5
has answer: http://stackoverflow.com/a/25071568
has answer: http://stackoverflow.com/a/25071574
has answer: http://stackoverflow.com/a/42055885
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/25071568
score: 1

http://stackoverflow.com/q/25111630
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/25111677
type: Question
has title: How to restore the pre-selected values in the form if there is error while submitting it?
answer count: 2
has body: This is my controller code. @RequestMapping(value = "/save", method = RequestMethod.POST) public final String submit(@ModelAttribute("loanType") @Valid LoanType loanType, BindingResult binding, RedirectAttributes attr, HttpSession session) { if (binding.hasErrors()) { attr.addFlashAttribute("org.springframework.validation.BindingResult.loanType", binding); attr.addFlashAttribute("loanTypeForm", binding); return "redirect:/loanType/addLoanType"; } loanTypeService.insertLoanType(loanType); log.info("loan type saved succesfully with loan type id =" + loanType.getLoanTypeId() + " and name =" + loanType.getLoanTypeName()); attr.addFlashAttribute("message", "Loan Type named= '" + loanType.getLoanTypeName() + "' is added Successfully"); return "redirect:/loanType/listLoanType"; } This is my view page. &lt;tr&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;form:input cssErrorClass="errorinput" path="loanTypeName" alt="LoanTypeName" placeholder="Loan Type Name:" /&gt;&lt;/td&gt; &lt;td&gt;&lt;form:errors path="loanTypeName" cssClass="error"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;br&gt; &lt;table class="form-subtable"&gt; &lt;tr&gt; &lt;td class="formtitle-subtitle"&gt; Loan Details &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;form:errors path="documents" cssClass="error"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;form:checkboxes cssClass="regular- checkbox" path="documents" items="${documentList}" itemLabel="documentName" itemValue="documentId" delimiter="&lt;br&gt;"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt; &lt;br&gt;&lt;div class="submit"&gt;&lt;input class="submit" type="submit" value="Save" /&gt; &lt;input type="reset" value="Cancel" /&gt;&lt;/div&gt; &lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; When I submit the form without filling the text field and only choosing the checkboxes, it shows th…
score: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2543797
tagged with: spring
has answer: http://stackoverflow.com/a/25112149
linked to: http://stackoverflow.com/q/18137326

http://stackoverflow.com/q/25135265
has comment: http://stackoverflow.com/comment/64574972
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: reflection
tagged with: java
has answer: http://stackoverflow.com/a/66011194
type: Question
has comment: http://stackoverflow.com/comment/39123990
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39153314
has title: Change Inner Java Class Modifier to Public via Reflection
favorite count: 0
has body: If I have following Java code: package a.b.c; public class A{ static class B{ public B(){ } } } I want to change class B's modifier to "public" at run-time via reflection, how can I do that? Thanks. So the after effect will be like following: package a.b.c; public class A{ public static class B{ public B(){ } } }
linked to: http://stackoverflow.com/q/3301635

http://stackoverflow.com/comment/39189832
has text: Obvious question: do you have a `com.twittstr.TwittstrApplication` class and does it extend `Application`?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25170453

http://stackoverflow.com/comment/39129798
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25113430
has text: I think I got the answer for that. Thanks guys!
score: 0

http://stackoverflow.com/comment/39220769
has text: You probably should use a `while` in a do-while loop
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25187459

http://stackoverflow.com/comment/39268840
comment on: http://stackoverflow.com/a/25203847
has text: Depends how it's being accessed. Given the code you've provided, it makes little difference.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/47051019
downvote count: 0
answers question: http://stackoverflow.com/q/25164932
upvote count: 2
type: Answer
score: 2
has body: As @jtahlborn rightly mentioned in comment, There is no bug in code. It happens mostly when the client closed / broke the connection or maybe network interruption / slowness which you can not control. Luckily, I have never faced this error again.
accepted answer of: http://stackoverflow.com/q/25164932
type: AcceptedAnswer

http://stackoverflow.com/comment/39480530
has text: Im using a custom filtering and a custom sorting. My NatTable implementation is also fed with large data most of the times.Thanks for the info @AlexanderGavrilov
comment on: http://stackoverflow.com/q/25201550
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25989350
upvote count: 2
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25182926
score: 2
accepted answer of: http://stackoverflow.com/q/25182926
downvote count: 0
has body: There are two ways to add this claim mapping. It's depends on your requirement. To get this done has to add a role claim mapping under "http://wso2.org/oidc/claim" claim dialect. This can be done in following ways Case 1 : For fresh WSO2IS before first startup Go to <IS_HOME>/repository/conf/claim-config.xml file Add following configuration under <Dialect dialectURI="http://wso2.org/oidc/claim"> Roles Roles role role of the user 10 <SupportedByDefault /> Case 2: For already running server. Login to the Identity server management console as admin user. Click the Configure button to access the Configure menu Click on http://wso2.org/oidc/claim Dialect. Click on "Add New Claim Mapping" and set the above details. (There you will get an error which is known issues. But that value will store. Then again edit it and set Mapped Attribute again) Then restart the server. Now you can get user info with roles

http://stackoverflow.com/a/25209476
accepted answer of: http://stackoverflow.com/q/25209410
downvote count: 0
score: 1
type: AcceptedAnswer
has body: Calendar#roll will just roll (increase/decrease) the value of the field you specify and won't update the other fields in the Calendar. Since you're rolling the month, only month will be affected, not year not day nor any other field. Also, note that Calendar#DATE, Calendar#MONTH and Calendar#YEAR are constants to the class, they're not the fields. Use Calendar#get instead: System.out.println(c.getTime() + " " + c.get(Calendar.DATE) + " " + c.get(Calendar.MONTH) + " " + c.get(Calendar.YEAR));
answers question: http://stackoverflow.com/q/25209410
upvote count: 1
type: Answer

http://stackoverflow.com/q/25118788
has title: SmartGwt RPC service (No source code is available for type com.server.GreetingServiceImpl; did you forget to inherit a required module?)
score: 0
tagged with: rpc
answer count: 1
tagged with: smartgwt
has answer: http://stackoverflow.com/a/25129363
type: AnsweredQuestion
has body: I'm getting an error when I'm trying to access server-side's GreetingServiceImpl class and try to use a function of it in client-side. ERROR: No source code is available for type com.demo1.server.GreetingServiceImpl; did you forget to inherit a required module? Here is the GreetingServiceImpl: public class GreetingServiceImpl extends RemoteServiceServlet implements GreetingService { public LinkedList&lt;String&gt; greetServer() throws IllegalArgumentException { // Verify that the input is valid. LinkedList&lt;String&gt; list = new LinkedList&lt;String&gt;(); try { File file = getLog(); Parse parse = new Parse(file); list = parse.callControlRequest(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return list; } public File getLog() throws IOException { //doing something } } and I'm trying to use it in client-side like: GreetingServiceImpl resultList = new GreetingServiceImpl(); //this is where I am getting error greetingService.greetServer(new AsyncCallback>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub dialogBox .setText("Remote Procedure Call - Failure"); dialogBox.center(); } @Override public void onSuccess(LinkedList&lt;String&gt; result) { result=resultList.greetServer(); // this is where I am trying to get the output of it } });; }
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25129363

http://stackoverflow.com/a/25247624
type: AcceptedAnswer
type: Answer
has body: I found this to help along with my answer, although not a specific answer to my question. I think using the info in this article can lead to the optimal practice. http://www.javacodegeeks.com/2010/08/java-best-practices-vector-arraylist.html
accepted answer of: http://stackoverflow.com/q/25194100
answers question: http://stackoverflow.com/q/25194100
score: 0

http://stackoverflow.com/q/25177039
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25177326
has body: I have one local commit (for example, at branch1 branch) and I need to apply it to another branch (eg. branch2). I know that I have to use the git cherry-pick command but I really cant find out by myself how the command should finally look. Help me please and sorry for my English. UPD: I've read this link, but I still cant understand how to use it in my case.
tagged with: java
upvote count: 1
answer count: 1
tagged with: git
has title: GIT: how to commit in two branches using cherry-pick
type: AnsweredQuestion
tagged with: push
tagged with: cherry-pick
downvote count: 0
tagged with: branch
score: 1
has answer: http://stackoverflow.com/a/25177326

http://stackoverflow.com/a/58168804
type: Answer
has body: If you are using ESAPI library function and prepared statement in your code,then you can mark this issues Not an issue. Prepared statement is one of the mitigation technique to a avoid SQL injection . preparedStatement = conn.prepareStatement(sql);
answers question: http://stackoverflow.com/q/25081287
score: 0

http://stackoverflow.com/q/25130196
has comment: http://stackoverflow.com/comment/39116473
has body: Good day everyone, In brief, I have a list that populates a list of arrays through JSON data. Upon click, it takes users to a single item activity, which essentially provides more information about that particular item. Now I would want the user to do that up to three times. In other words, until the user has clicked on three different items on the list of arrays, it would continuously prompt them to select additional item on the list until they have selected 3 item. Once 3 items have been selected, the user would be redirected to another activity page. Below is the code for list of arrays activity page public class EventsActivity extends Activity{ private static final String URL_WEB_SERVICE = "http://dooba.ca/analytics/ed.php"; private GridView gv; private ArrayList&lt;Events_List&gt; container; private ArrayList&lt;Events_List&gt; items; public Uri list_item_bac; public String list_item_name; public String list_item_description; public String list_item_price; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.events_list_layout); gv = (GridView) findViewById(R.id.gridview); container = new ArrayList&lt;Events_List&gt;(); //download JSON listDownload(); GridView s = (GridView) findViewById(R.id.gridview); s.setOnItemClickListener(new OnItemClickListener(){ @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Intent intent = new Intent(EventsActivity.this,EventSingleItemActivity.class); intent.putExtra("list_item_name", list_item_name); intent.putExtra("list_item_description", list_item_description); intent.putExtra("list_item_price",list_item_price); startActivity(intent); //start Activity } }); } public void listDownload(){ RequestQueue volley = Volley.newRequestQueue(this); JsonObjectRequest json = new JsonObjectRequest(Method.GET, URL_WEB_SERVICE, null, ResponseListener(), ErrorListener()); volley.add(json); } private Response.Listener&lt;JSONObj…
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39118446
has comment: http://stackoverflow.com/comment/39114837
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39118796
type: Question
tagged with: android-layout
has title: Loop in list - selecting multiple item in a list
upvote count: 1
tagged with: android-activity

http://stackoverflow.com/comment/39071359
type: QuestionComment
has text: `For now I'm going to set the contents of the parenthesis (PageSize.f.rotate(), 50, 50, 50, 50) as a variable and drop that in.` WHAT?
score: 0
comment on: http://stackoverflow.com/q/25107016
type: Comment

http://stackoverflow.com/q/25219423
score: 5
has answer: http://stackoverflow.com/a/25220242
has answer: http://stackoverflow.com/a/25219495
answer count: 2
has title: setAlignmentX(CENTER_ALIGNMENT) does not center boxLayout in JFrame
tagged with: layout-manager
favorite count: 0
upvote count: 5
possible better answer: http://stackoverflow.com/a/25220242
type: AnsweredQuestion
has body: I want to keep my two JLabel text have Left alignment and at the same time place my boxLayout in the center of the JFrame. I tried setAlignmentX(CENTER_ALIGNMENT) on my boxlayout panel but it's not placing my boxlayout in the center. import javax.swing.BoxLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class GuiTest extends JFrame { private static final long serialVersionUID = 1L; private JLabel jLabelOne = new JLabel(); private JLabel jLabelTwo = new JLabel(); private JPanel panel = new JPanel(); private BoxLayout boxLayout = new BoxLayout(panel,BoxLayout.Y_AXIS); public GuiTest() { jLabelOne.setAlignmentX(LEFT_ALIGNMENT); jLabelTwo.setAlignmentX(LEFT_ALIGNMENT); jLabelOne.setText("This is text one"); jLabelTwo.setText("This is text two"); panel.setLayout(boxLayout); panel.add(jLabelOne); panel.add(jLabelTwo); panel.setAlignmentX(CENTER_ALIGNMENT); add(panel); pack(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setSize(1024,768); setLocationRelativeTo(null); setVisible(true); } public static void main(String args[]) { new GuiTest(); } }
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25219495
tagged with: swing
tagged with: boxlayout
type: Question

http://stackoverflow.com/comment/39088570
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25114802
type: AnswerComment
has text: I need a const value, but calling a final method is a runtime expression -> Compile error

http://stackoverflow.com/comment/39067783
type: Comment
has text: Yes. Reason being, we need to created several suites from a bunch of test classes. Same test classes may be repeated.
comment on: http://stackoverflow.com/a/25102931
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39176978
type: QuestionComment
comment on: http://stackoverflow.com/q/25157814
has text: That is what I am trying to do in receiver2. @Kayaman
score: 0
type: Comment

http://stackoverflow.com/comment/39226122
type: QuestionComment
has text: You can get the `Combo` from the `ComboViewer` by calling `ComboViewer#getCombo()`. `Combo` is a `Widget`.
comment on: http://stackoverflow.com/q/25190241
score: 0
type: Comment

http://stackoverflow.com/comment/39268543
score: 0
comment on: http://stackoverflow.com/q/25211966
has text: Note that each user will be running their own java process on their own machine - so multiple threads will be running, but they'll be running on separate JVMs. The term "multi-threaded" typically means multiple threads running on the same JVM.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39276070
comment on: http://stackoverflow.com/q/25214353
type: Comment
type: QuestionComment
has text: Try `SELECT * FROM table_one`. If that fails, you have not opened the correct database file.
score: 0

http://stackoverflow.com/comment/39073257
has text: Using Parcelables is preferable from a performance perspective, but it is definitely not a requirement. Serializables will do the job as well.
comment on: http://stackoverflow.com/a/25107969
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/62685485
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/30954959
type: Comment
has text: For some reason I got an error saying it was running low on memory so I increased the RAM requirements on all then i got the error above, changing the path to PhpStorm64.exe fixed this as well.

http://stackoverflow.com/comment/39268246
has text: Removed everything but <action android:name="android.intent.action.SEARCH" /> from the intent filter. Still have the same issue. Here's my current manifest:
comment on: http://stackoverflow.com/a/25212487
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25226406
accepted answer of: http://stackoverflow.com/q/25225730
answers question: http://stackoverflow.com/q/25225730
has comment: http://stackoverflow.com/comment/39295259
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39296767
has body: This is possible in a lifecycle component in Tomcat, not from the webapp itself but declared in context.xml. Here is an example and here the declaration.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39315447
has comment: http://stackoverflow.com/comment/39318063
type: Answer

http://stackoverflow.com/comment/39159368
type: QuestionComment
has text: @sankrish: Basically it's a matter of "Just because 6 people haven't seen the duplicate before doesn't mean it doesn't exist" :)
score: 0
comment on: http://stackoverflow.com/q/25135681
type: Comment

http://stackoverflow.com/comment/39209662
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25179071
has text: I've done exactly what you said but now I need a right join for User as there might be Users without Transactions. How do I do that.
type: Comment

http://stackoverflow.com/a/25185575
type: Answer
upvote count: 11
has comment: http://stackoverflow.com/comment/39218475
has comment: http://stackoverflow.com/comment/39217294
has comment: http://stackoverflow.com/comment/39217885
score: 11
answers question: http://stackoverflow.com/q/25185258
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25185258
has body: This comes down to operator precedence. The order of operations goes: postfix (foo++, foo--) unary (++foo, --foo, +expr, ...) ... additive (+, -) ... So, let's take a look at each expression: first + ++second is first + (++second). That's fine. first +++ second is (first++) + second, which works as you said it does. first +++++ second is ((first ++)++)+ second), but (first ++) is a value (not a variable) and thus can't be incremented -- that's what the error is trying to tell you. first ++ + ++ second explicitly tells Java to split things up differently than above: it becomes (first ++) + (++ second), which is fine. first + + + + + + second becomes first + (+ (+ (+ (+ (+ second))))). The unary + just means "not negated", so +foo == foo. Therefore this expression simplifies to first + second, which is obviously fine.
has comment: http://stackoverflow.com/comment/39252231

http://stackoverflow.com/comment/39053289
comment on: http://stackoverflow.com/q/25097212
score: 0
has text: @SotiriosDelimanolis if there was no constructor, however, onDraw() will try to draw a text which has not been initialised. is it your question, did i got you right?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39065813
has text: I think this should be possible with parameterized testing in JUnit.
comment on: http://stackoverflow.com/q/25103532
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39233139
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25193589
type: QuestionComment
has text: this? https://code.google.com/p/android/issues/detail?id=73002

http://stackoverflow.com/q/25228231
has answer: http://stackoverflow.com/a/25235524
answer count: 1
has body: When I write this code, it only shows dialog with one button, but not showing check boxes. I don't know what's the problem. private void showDialog(){ final ArrayList selectedItems = new ArrayList(); AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setTitle("asdasd"); dialogBuilder.setMessage("asdasd"); final String[] options = {"asd", "dsa","asd","aa"}; dialogBuilder.setMultiChoiceItems(options, null, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { if(isChecked){ selectedItems.add(which); }else if(selectedItems.contains(which)){ selectedItems.remove(Integer.valueOf(which)); } } }); dialogBuilder.setNegativeButton("CANCEL",null); AlertDialog dialog = dialogBuilder.create(); dialog.show(); };
tagged with: android
type: AnsweredQuestion
has title: Checkbox dialog not working
accepted answer: http://stackoverflow.com/a/25235524
tagged with: java
has comment: http://stackoverflow.com/comment/39297952
type: Question
has comment: http://stackoverflow.com/comment/39297708
has comment: http://stackoverflow.com/comment/39311966
score: 0

http://stackoverflow.com/comment/39007599
comment on: http://stackoverflow.com/a/25072778
has text: Brilliant answer alfasin thanks a ton time for me to get hold of poly mor phism :)
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39112006
has text: Don't use a tiled map, just use a 2D array.
type: Comment
comment on: http://stackoverflow.com/q/25128554
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39177079
comment on: http://stackoverflow.com/q/25163735
type: Comment
type: QuestionComment
has text: Some help : this link has an "Activity lifecycle" category, you may like to read it : http://developer.android.com/reference/android/app/Activity.html
score: 0

http://stackoverflow.com/a/25182674
has comment: http://stackoverflow.com/comment/39212218
type: Answer
has comment: http://stackoverflow.com/comment/39213478
answers question: http://stackoverflow.com/q/25181929
has body: Use setPreferredSize but maybe you might benefit from the normal usage of a JScrollPane: panel.add(new JScrollPane(pane)); The JTextPane will adapt to its document size, and the JScrollPane takes further care of scrollbars when needed.
has comment: http://stackoverflow.com/comment/39212255
score: 0
has comment: http://stackoverflow.com/comment/39213597

http://stackoverflow.com/q/25146045
has comment: http://stackoverflow.com/comment/39186487
linked to: http://stackoverflow.com/q/6092200
has title: Exception in thread "main" java.lang.UnsatisfiedLinkError: no indri_jni in java.library.path
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25146253
type: Question
has comment: http://stackoverflow.com/comment/39159374
has comment: http://stackoverflow.com/comment/39259146
accepted answer: http://stackoverflow.com/a/25146253
answer count: 1
has body: I am working on lemur tool and i am running with some problem. when i execute the code , java complains Exception in thread "main" java.lang.UnsatisfiedLinkError: no indri_jni in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886) at java.lang.Runtime.loadLibrary0(Runtime.java:849) at java.lang.System.loadLibrary(System.java:1088) at lemurproject.indri.indriJNI.&lt;clinit&gt;(indriJNI.java:109) at lemurproject.indri.IndexEnvironment.&lt;init&gt;(IndexEnvironment.java:39) at indritest.main(indritest.java:9) this is My code import lemurproject.indri.*; public class indritest { public static void main ( String[] args ) { try { String [] stopwords = {"a", "an", "the", "of"}; IndexEnvironment env = new IndexEnvironment(); env.setStoreDocs(true); env.setStopwords(stopwords); env.create("aaa"); env.addFile("trekfile.txt", "booomer.txt"); env.close(); } catch (Exception e) { e.printStackTrace(); } } } I am using jdk 1.8.0_11 x64bit , windows 7 ultimate x64bit , indri5.7 x64bit , eclipse juno x64bit. ..................................................................................................................................................................... EDIT:- I worked with the solution given by RALF WAGNER now my console is showing this Bug. after printed the System.getProperty("java.library.path") in my console i am getting this output. indri_jni.dll is already present in system32 folder. My code. import lemurproject.indri.*; public class indritest { public static void main ( String[] args ) { try { System.out.println(System.getProperty("java.library.path")); //System.loadLibrary("indri_jni"); String [] stopwords = {"a", "an", "the", "of"}; IndexEnvironment env = new IndexEnvironment(); env.setStoreDocs(true); env.setStopwords(stopwords); env.create("aaa"); env.addFile("trekfile.txt", "booomer.txt"); env.close(); } catch (Exception e) { e.printStackTrace(); } } } My console outout. C:\Program Files\Java\jdk1.8.0_11\bin;C:\Windows\Sun\Jav…

http://stackoverflow.com/q/25140789
tagged with: spring
has title: How to check if embedded database exists?
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25141074
type: Question
downvote count: 0
answer count: 1
tagged with: spring-batch
has body: I'd like to use Spring-Batch with an embedded h2 database to save the metadata from the batch jobs. I just want to always run the database script on each application start, so I don't have to worry about missing database file if I move my application. But how can I check if the script has to be run? Because if I run it and the DB exists already, I'm getting the following exception: org.h2.jdbc.JdbcSQLException: Table "BATCH_JOB_INSTANCE" already exists DataSourceInitializer init = new DataSourceInitializer(); init.setDataSource(embeddedDB); //embedded h2 db ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); populator.addScript(resource); //"classpath:org/springframework/batch/core/schema-h2.sql" initializer.setDatabasePopulator(populator);
score: 1
has answer: http://stackoverflow.com/a/25141074
favorite count: 0
upvote count: 1

http://stackoverflow.com/a/25078234
answers question: http://stackoverflow.com/q/25076133
upvote count: 0
has body: You can use window closing event or window closed event public void windowClosing(WindowEvent e) { System.out.println("window closed"); } OR public void windowClosed(WindowEvent e) { System.out.println("window closed"); }
score: -1
has comment: http://stackoverflow.com/comment/39017335
downvote count: 1
type: Answer

http://stackoverflow.com/a/25160574
has body: As far as I'm aware, it is not bad practice to use the wait, notify, notifyAll methods if you use them properly. It seems you don't use them properly though. Apparently it's either not clear to you what you want to achieve or how to achieve it (by using these methods). I think you need something along these lines (code below). Also, it seems, instead of LOCK you can use this too (in your case). Consequently, you can make the whole two methods synchronized (which implicitly means synchronized on the monitor of this). class Result { private boolean isComplete = false; private static final Object LOCK = new Object(); public void setComplete() { synchronized(LOCK){ isComplete = true; LOCK.notifyAll(); } } public void waitUntilComplete() { synchronized(LOCK){ while (!isComplete) { LOCK.wait(); } // do what you need to do when // complete is already equal to true } } }
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/39178235
upvote count: 1
answers question: http://stackoverflow.com/q/25160418
has comment: http://stackoverflow.com/comment/39172139
downvote count: 0

c3p0
tags question: http://stackoverflow.com/q/25184786
tags question: http://stackoverflow.com/q/25169498
tag name: c3p0
tags question: http://stackoverflow.com/q/25152875
tags question: http://stackoverflow.com/q/25187202
type: Tag

http://stackoverflow.com/comment/39087252
type: AnswerComment
has text: No I don't have MainActivity accessible because my Test class code will go into library .
comment on: http://stackoverflow.com/a/25115615
type: Comment
score: 0

http://stackoverflow.com/comment/39069470
type: Comment
type: QuestionComment
has text: yep, you should move your dt_time into the filtering part (i.e. remove it from aggregation and add another filter, that filters on latest date)
comment on: http://stackoverflow.com/q/25105081
score: 0

http://stackoverflow.com/comment/39044765
score: 0
type: AnswerComment
has text: If you can answer this , can you tell me how to do this code by other way than using If statement like (try) ?
type: Comment
comment on: http://stackoverflow.com/a/25092486

http://stackoverflow.com/q/25110478
accepted answer: http://stackoverflow.com/a/25110498
has title: jstl set tag with url tag
score: 0
has body: I have an form which will used to add/update the user entity, since the server support the REST, so I need to decide the form action for adding or updating: This is what I have done: &lt;c:set var="form_submit" value="&lt;c:url value='/user'/&gt;"/&gt; &lt;c:if test="${user.id}&gt;0"&gt; &lt;c:set var="form_submit" value="&lt;c:url value='/user/${user.id}'/&gt;"/&gt; &lt;/c:if&gt; Then in the form: &lt;form action="${form_submit}" method="post" .... However I got this: &lt;form action="&lt;c:url value='/user'/&gt;" method="post" .... How to fix it?
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/25110498
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jstl

http://stackoverflow.com/a/41214430
answers question: http://stackoverflow.com/q/25093985
downvote count: 0
has body: You can try with this: First, in the table code: HighlightCellRenderer renderer = new HighlightCellRenderer(); table.setDefaultRenderer(String.class, renderer); table.setDefaultRenderer(Number.class, renderer); table.setDefaultRenderer(Boolean.class, renderer); table.setDefaultRenderer(Character.class, renderer); Then: public class HighlightCellRenderer extends DefaultTableCellRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object obj, boolean isSelected, boolean hasFocus, int row, int column) { Component cell = super.getTableCellRendererComponent(table, obj, isSelected, hasFocus, row, column); if (row == table.getSelectedRow()) { if (column == table.getSelectedColumn()) { // special color cell.setBackground(Color.GREEN); } else { // The selected row color in "com.jtattoo.plaf.aero.AeroLookAndFeel" cell.setBackground(new Color(176, 196, 222)); } } else { // Other rows cell.setBackground(Color.WHITE); } return cell; } }
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/25078810
upvote count: 2
tagged with: jframe
tagged with: java
downvote count: 2
tagged with: jprogressbar
has comment: http://stackoverflow.com/comment/39018587
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/39018470
has comment: http://stackoverflow.com/comment/39022429
score: 0
has comment: http://stackoverflow.com/comment/39018592
answer count: 1
has title: Why does the second JFrame does not show components?
favorite count: 0
accepted answer: http://stackoverflow.com/a/25082965
has comment: http://stackoverflow.com/comment/39019767
has body: I have the first JFrame and it works fine. When I push a button it is supposed to show a JProgressBar frame , but i get empty JFrame. I open it with p = new Progress("1/3"); p.setMax(2); p.setProgress(0, "Getting bytes..."); Anyone know why? EDIT: I am going to explain more detail(Because someone misunderstood and corrected my post in the wrong way) - On my main class i start the first JFrame: new Crypt(); And in the Crypt class i have registered a button ActionListener. OnClick it opens a second JFrame But it is empty: p = new Progress("1/3"); p.setMax(2); p.setProgress(0, "Getting bytes..."); The Progress class Screen shot
has comment: http://stackoverflow.com/comment/39019502
has answer: http://stackoverflow.com/a/25082965
type: AnsweredQuestion

http://stackoverflow.com/comment/39130313
type: Comment
comment on: http://stackoverflow.com/a/25135234
has text: That's OK. Thanks for your valuable time and help
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39211943
has text: This seems odd... why would you want a post-svn hook to change a file?
comment on: http://stackoverflow.com/q/25181813
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39008104
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25073110
has text: it shows error in String[] word = tokenlist.get(i);

http://stackoverflow.com/a/25126075
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39110748
accepted answer of: http://stackoverflow.com/q/25125699
answers question: http://stackoverflow.com/q/25125699
upvote count: 2
type: AcceptedAnswer
has body: For your spinner, once the item is selected, you can grab it using spinner.getSelectedItem().toString(). You now have the string that you can use to check if it is American, and if it is, then send tradamerican to the yelp API
type: Answer

http://stackoverflow.com/comment/39284602
has text: Thank you so much, now i know where the problem. it is in the variable statut it didn't return the value that i want.Now i have to know how to get the statut of the user who is connected.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25218900
type: Comment

http://stackoverflow.com/comment/39139794
comment on: http://stackoverflow.com/q/25143607
type: QuestionComment
has text: The class is names Exemplo01 while your file is names Example. Correct that.
type: Comment
score: 1

http://stackoverflow.com/q/25209350
type: Question
has body: The code is working fine on my laptop(JAVA 1.7) but when i run the same code on Linux server (JAVA 1.6), it doesn't work properly. Java -Version java version "1.6.0_22" OpenJDK Runtime Environment (IcedTea6 1.10.9) (rhel-1.28.1.10.9.el5_8-x86_64) OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode) The BufferedReader only returns 1 line of string(header) but the gz file has more than 1 line. *The gz file is not damaged or corrupted. *Code is fine if i load the "file" inside the gz file. *I modify the code a bit for debug testing GZIPInputStream gzip = new GZIPInputStream(new FileInputStream(fileName)); Reader decoder = new InputStreamReader(gzip,"ISO-8859-1"); BufferedReader br = new BufferedReader(decoder); String line = null; String header = null; //read 1st line of file which is file header header = br.readLine(); System.out.println(header); line = br.readLine(); System.out.println(line); line = br.readLine(); System.out.println(line); and it returns IDþfirstnameþlastname null null Any suggestion? Thanks!
score: 0
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39266459
has comment: http://stackoverflow.com/comment/39263078
answer count: 0
has title: GZIPInputStream incomplete decompression
tagged with: linux

http://stackoverflow.com/comment/39204540
comment on: http://stackoverflow.com/a/25178902
type: Comment
has text: That sounds like a long procedure!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39192799
type: Comment
comment on: http://stackoverflow.com/q/25172057
has text: please put the complete stack trace so that we can find the exact line where its crashing
score: 0
type: QuestionComment

http://stackoverflow.com/q/25200325
upvote count: 0
has answer: http://stackoverflow.com/a/25200453
tagged with: bigdecimal
has comment: http://stackoverflow.com/comment/39244859
score: -1
has comment: http://stackoverflow.com/comment/39245001
has comment: http://stackoverflow.com/comment/39244979
has title: BigDecimal.valueOf(n).toPlainString() is not giving exact value
has body: I am taking a double value(generated by a different method) and i want to extract number of trailing zeros from it.One way to do is by converting it into String and then doing operations on it but i am getting values in scientific notation for eg that method generated factorial of 60 i.e 8.320987112741392E81 as it is in scientific notation i am unable to do string operations on it. I googled about this and found out that using BigDecimal.valueOf(n).toPlainString() i can get exact number but unfortunately i am getting this //8320987112741392000000000000000000000000000000000000000000000000000000000000000000 whereas the correct precise answer is //8320987112741390144276341183223364380754172606361245952449277696409600000000000000 Anyone know how to tackle this problem public class Factorial { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(bf.readLine()); for (int i = 0; i &lt; t; i++) { double num = Double.parseDouble(bf.readLine()); System.out.println("fact ans" + factorial(num)); System.out.println(z(factorial(num))); } } public static Double factorial(Double n) { if (n &lt; 2) { return 1D; } return n * factorial(n - 1); } public static int z(Double n) { System.out.println(BigDecimal.valueOf(n).toPlainString()); return 1; } }
answer count: 1
favorite count: 0
type: UnansweredQuestion
downvote count: 1
tagged with: biginteger
tagged with: java
type: Question

http://stackoverflow.com/comment/39154846
type: Comment
type: QuestionComment
has text: Would the `@Before` annotation solve your problem?
comment on: http://stackoverflow.com/q/25151697
score: 0

http://stackoverflow.com/a/25177966
type: Answer
has body: You should check the javadoc for parse method. it would return null if any exception occurred. Then you can check for doc == null next after the try/catch block or in the finally block.
answers question: http://stackoverflow.com/q/25177819
score: 0
has comment: http://stackoverflow.com/comment/39206641

http://stackoverflow.com/q/25078159
has title: Edittext Exception in SubscribeActivity: Null Pointer Exception error
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39017275
has comment: http://stackoverflow.com/comment/39017776
has comment: http://stackoverflow.com/comment/39017196
favorite count: 0
has comment: http://stackoverflow.com/comment/39018272
has comment: http://stackoverflow.com/comment/39018781
tagged with: android
has answer: http://stackoverflow.com/a/25081195
tagged with: fatal-error
has comment: http://stackoverflow.com/comment/39017286
type: AnsweredQuestion
tagged with: android-edittext
has comment: http://stackoverflow.com/comment/39017303
accepted answer: http://stackoverflow.com/a/25081195
has comment: http://stackoverflow.com/comment/39017463
has body: i have code for subscribing the activity but when i enter the send button to insert it i am getting fatal exception i check it in google but i didnt find the solution to my problem . i am getting error after the connection success message. I have added internet permission as well then what might be issue can any one help public class SubscribeActivity extends Activity { String result = null; InputStream is = null; private EditText edittext_first; private EditText edittext_last; private EditText edittext_age; private EditText edittext_email; private EditText edittext_confirm; private Button send; String v5,v1,v2,v3,v4,v6; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.subscribe); edittext_first = (EditText) findViewById(R.id.firstname); edittext_last = (EditText) findViewById(R.id.lastname); edittext_age = (EditText) findViewById(R.id.age1); edittext_email = (EditText) findViewById(R.id.email); edittext_confirm = (EditText) findViewById(R.id.confirm); send = (Button) findViewById(R.id.send); send.setOnClickListener(new View.OnClickListener() { @SuppressLint("NewApi") @Override public void onClick(View view) { boolean isValid = true; if (edittext_first.getText().toString().length() &lt;= 0) { edittext_first.setError("VALUE REQUIRED"); isValid = false; } else if (!edittext_first.getText().toString().matches("[a-zA-Z ]+")) { edittext_first.setError("ENTER ONLY ALPHABETS"); isValid = false; } if (edittext_last.getText().toString().length() &lt;= 0) { edittext_last.setError("VALUE REQUIRED"); isValid = false; } else if (!edittext_last.getText().toString().matches("[a-zA-Z ]+")) { edittext_last.setError("ENTER ONLY ALPHABETS"); isValid = false; } if (edittext_age.getText().toString().length() &lt;= 0) { edittext_age.setError("VALUE REQUIRED"); isValid = false; } else if (!edittext_age.getText().toString().matches("[0-9 ]+")) { edittext_age.setError("ACCEPT NUMBERS"); isValid = false; } if (edittext…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39018151
upvote count: 1
has comment: http://stackoverflow.com/comment/39017104
type: Question
has comment: http://stackoverflow.com/comment/39017355
has comment: http://stackoverflow.com/comment/39017543
has comment: http://stackoverflow.com/comment/39017637
has comment: http://stackoverflow.com/comment/39018065
has comment: http://stackoverflow.com/comment/39018756
has comment: http://stackoverflow.com/comment/39017418
has comment: http://stackoverflow.com/comment/39017227
has comment: http://stackoverflow.com/comment/39017457
has comment: http://stackoverflow.com/comment/39017728

http://stackoverflow.com/q/25076913
tagged with: java
has comment: http://stackoverflow.com/comment/39306123
has body: I have following code for the radio buttons: Test.html &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;webobject name=RadioButton1&gt;&lt;/webobject&gt; &amp;nbsp; &lt;webobject name=LocalString1&gt;A&lt;/webobject&gt; &lt;/td&gt; &lt;td&gt; &lt;webobject name=RadioButton2&gt;&lt;/webobject&gt; &amp;nbsp; &lt;webobject name=LocalString2&gt;B&lt;/webobject&gt; &lt;/td&gt; &lt;td&gt; &lt;webobject name=RadioButton3&gt;&lt;/webobject&gt; &amp;nbsp; &lt;webobject name=LocalString3&gt;C&lt;/webobject&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; Test.wod RadioButton1: WORadioButton { name = "type"; selection = requestType; value = 0; } RadioButton2: WORadioButton { name = "type"; selection = requestType; value = 1; } RadioButton3: WORadioButton { name = "type"; selection = requestType; value = 2; } I have following webbjects to show : A, B &amp; C &lt;webobject name=A&gt;&lt;/webobject&gt; &lt;webobject name=B&gt;&lt;/webobject&gt; &lt;webobject name=C&gt;&lt;/webobject&gt; Question is: I want to show the webobject A when user select the RadioButton1, B when select RadioButton2 &amp; C when select 3. What condition I apply to the radio button and How ?
type: Question
has title: Conditional radio button in webobjects
answer count: 1
score: 0
tagged with: http://stackoverflow.com/tag/html
type: UnansweredQuestion
tagged with: webobjects
has answer: http://stackoverflow.com/a/25084686

http://stackoverflow.com/q/25163089
has comment: http://stackoverflow.com/comment/39202625
has comment: http://stackoverflow.com/comment/39175986
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/39202317
has comment: http://stackoverflow.com/comment/39175689
has comment: http://stackoverflow.com/comment/39202235
type: UnansweredQuestion
tagged with: filereader
has answer: http://stackoverflow.com/a/25163305
tagged with: java
has body: I have the following code to convert text file to xml.:- ** public static void main (String args[]) { new ToXML().doit(); } public void doit () { try{ in = new BufferedReader(new FileReader("D:/sample.txt")); out = new StreamResult("D:/data.xml"); initXML(); String str; while ((str = in.readLine()) != null) { process(str); } in.close(); writeXML(); } catch (Exception e) { e.printStackTrace(); } } public void initXML() throws ParserConfigurationException{ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); DOMImplementation impl = builder.getDOMImplementation(); xmldoc = impl.createDocument(null, "AIRLINE_INFO", null); root = xmldoc.getDocumentElement(); } public void process(String s) { String elements = s; Element e1 = xmldoc.createElement("Supplier_Name"); Node n1 = xmldoc.createTextNode(elements); e1.appendChild(n1); Element e2 = xmldoc.createElement("E-Mail_Address"); Node n2 = xmldoc.createTextNode(elements); e2.appendChild(n2); e0.appendChild(e1); e0.appendChild(e2); root.appendChild(e0); } public void writeXML() throws TransformerConfigurationException, TransformerException { DOMSource domSource = new DOMSource(xmldoc); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); transformer.setOutputProperty(OutputKeys.ENCODING,"ISO-8859-1"); transformer.setOutputProperty ("{http://xml.apache.org/xslt}indent-amount", "4"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.transform(domSource, out); } } ** The output which is Expected is: ** &lt;AIRLINE_INFO&gt; &lt;AIRTICKET&gt; &lt;Supplier_Name&gt;SpiceJet Ltd, 319, Udyog Vihar, Phase IV, Gurgaon - 122016 Haryana, India&lt;/Supplier_Name&gt; &lt;E-Mail_Address&gt;E-Mail: custrelations@spicejet.com&lt;/E-Mail_Address&gt; &lt;/AIRTICKET&gt; &lt;/AIRLINE_INFO&gt; ** But Currently While Excuting the code i am getting t…
tagged with: file
has comment: http://stackoverflow.com/comment/39202780
type: Question
has comment: http://stackoverflow.com/comment/39197354
has comment: http://stackoverflow.com/comment/39202535
score: 0
has comment: http://stackoverflow.com/comment/39201955
answer count: 1
tagged with: string
has title: How to Print String object Line by Line

http://stackoverflow.com/a/25151083
accepted answer of: http://stackoverflow.com/q/25130759
score: 0
has body: Well after some research I think I found a solutions, TreeWalker Code: getNode return [double r] {ExpNode a=null; List&lt;ExpNode&gt; list = new ArrayLis&lt;ExpNode&gt;(); r = null;} : #(MIN a=getNode {list.add(a);} ({ExpNode b = getNode; list.add(b);})*) {try{r=new MinExpNode(list);}catch(Exception e){throw new RecognitionException(e.toString();}} But still if you can suggest me a better one it would be very helpful.
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25130759

http://stackoverflow.com/comment/41491420
type: AnswerComment
has text: Thank you. Actually right click on the "cloud-endpoints" project => "Google App Engine WTP" => "Generate Cloud Endpoint Client Library" was the answer. Works even when using WTP and no maven
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25907336

http://stackoverflow.com/q/25164067
downvote count: 1
tagged with: macos
has answer: http://stackoverflow.com/a/25164336
favorite count: 0
has body: I am trying to open *.docx files programmatically from Java on Mac OS X. For Windows and Linux I already got it working with the following methods: Windows: Runtime.getRuntime().exec(new String[] {"C:\Program Files\Microsoft Office\Office15\WINWORD.EXE", "document.docx"}); Linux: Runtime.getRuntime().exec(new String[] {"/bin/sh", "-c", "/usr/bin/libreoffice", "document.docx"}); How does it work with Mac OS X ? My Microsoft Office installation is at the following location: /Applications/Microsoft Office 2011/Microsoft Word.app Any ideas highly appreciated - thanks.
possible better answer: http://stackoverflow.com/a/25170626
type: AnsweredQuestion
score: 1
tagged with: runtime.exec
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39190680
has title: How to open file in Microsoft Word on Mac OS X from within Java?
has comment: http://stackoverflow.com/comment/39207722
accepted answer: http://stackoverflow.com/a/25164336
upvote count: 2
tagged with: linux
answer count: 2
has answer: http://stackoverflow.com/a/25170626

http://stackoverflow.com/comment/39265989
has text: Not really. If you're deciding between two totally different algorithms, and one runs in O(_n_), say, and the other in O(_n_ log _n_), then you can determine that the first one will run faster _for sufficiently large n_. We use this to evaluate sorting algorithms, for instance. But in real life, the basic algorithm is usually settled early on, and the performance is based on other factors besides "time complexity".
score: 1
comment on: http://stackoverflow.com/q/25211231
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39161693
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25154407
type: Comment
has text: Yes I am. I am using mysql on the server end. But you don't have to connect to db directly obviously so you will need a php or any other server side script to handle the requests, to the db

http://stackoverflow.com/comment/39106068
has text: Thanks. It is very usefull. but I ended up usisg the textview.getText(). Worked like a charm. I will be looking into the Mailgun for another app. Thankyou very much for your quick answer.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25109858

http://stackoverflow.com/q/25208494
has answer: http://stackoverflow.com/a/25213802
accepted answer: http://stackoverflow.com/a/25213802
has title: Hitting Tomcat HTTPS URL with a Java Client
tagged with: ssl
linked to: http://stackoverflow.com/q/22737970
score: 0
answer count: 1
tagged with: tomcat
has body: I have configured my Tomcat instance to use SSL on port 8443. I've verified it's working by hitting the main tomcat page thru https:8443 on my browser. Now I'm trying to understand what I need to do to get a Java program to read from an HTTPS URL on that tomcat server. I followed the instructions here: Java SSL Tutorial I just copied the .keystore file down to my client that I generated with Java's keytool on my web server. It is self signed, just for dev work. This seemed a little weird to me since that also has the private key, right? I thought I would do something to export the public key and put that on my client, but I can't find a good guide on what steps I need to for that. Anyway, when I tried using the .keystore generated on my server in my client, I get this error: *** %% Invalidated: [Session-1, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA] main, SEND TLSv1 ALERT: fatal, description = certificate_unknown main, WRITE: TLSv1 Alert, length = 2 main, called closeSocket() main, handling exception: 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 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 at sun.security.ssl.Alerts.getSSLException(Unknown Source) I've set my client up to run with these JVM args: -Djavax.net.ssl.keyStore=.keystore -Djavax.net.ssl.keyStorePassword=changeit -Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol -Djavax.net.debug=ssl It does print out a bunch of stuff in that .keystore, so I'm sure it is reading it. But the server doesn't seem to like it when it tries to handshake. What do I need to do to get that SSL Java client reading data from my webserver? ------- edit Oops, I just noti…
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/25104915
type: Question
answer count: 2
has title: Android Access Activity Methods From Non-Activity Class
has comment: http://stackoverflow.com/comment/39067388
has answer: http://stackoverflow.com/a/25105118
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/25104950
possible better answer: http://stackoverflow.com/a/25104950
has comment: http://stackoverflow.com/comment/39067295
accepted answer: http://stackoverflow.com/a/25105118
type: AnsweredQuestion
tagged with: java
has body: This is the method I want to access from the Activity class (ActivityName): public MediaPlayer getBlipComp() { return blipComp; } EDIT In the activity class public SingleGameActivity getSingleGameActivity() { return this; } This is working fine in my SurfaceView class: SingleGameActivity myActivity = ((SingleGameActivity)getContext()).getSingleGameActivity(); // Later in the code myActivity.getBlipStart().start(); But when I pass the reference variable to the ball (normal)-class it doesn't work: ball = new Ball(myActivity, box.getCenterX(), box.getCenterY(), currentLvl, Color.GREEN); Ball-class public Ball(SingleGameActivity activity, int xPos, int yPos, int level, int color) { myActivity = activity; THIS METHOD CAN NOT BE CALLED FROM THE BALL CLASS, WHY? SOLUTION? myActivity.getBlipPlay().start();
has comment: http://stackoverflow.com/comment/39067349

http://stackoverflow.com/q/25118609
tagged with: java
answer count: 2
upvote count: 1
has body: How to execute a .bat file with java program? Thanks in advance
has comment: http://stackoverflow.com/comment/39093465
possible better answer: http://stackoverflow.com/a/25118868
tagged with: ant
has answer: http://stackoverflow.com/a/25118689
type: AnsweredQuestion
score: -5
has comment: http://stackoverflow.com/comment/39093311
accepted answer: http://stackoverflow.com/a/25118689
favorite count: 0
has comment: http://stackoverflow.com/comment/39092963
has title: How to execute a .bat file with java program?
type: Question
has comment: http://stackoverflow.com/comment/39092929
downvote count: 6
has comment: http://stackoverflow.com/comment/39092870
has answer: http://stackoverflow.com/a/25118868

http://stackoverflow.com/q/25073585
linked to: http://stackoverflow.com/q/540396
answer count: 4
has answer: http://stackoverflow.com/a/25073616
has title: There are no main classes found
has comment: http://stackoverflow.com/comment/39008859
has comment: http://stackoverflow.com/comment/39008848
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25073617
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25073651
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25073633
has comment: http://stackoverflow.com/comment/39010107
has body: When I play it in NETBEANS IDE 8.0 it keeps saying there is no main class even though I added the main class already? Need help can't understand. PS. If I delete the static in magic() it blocks the magic() in main. package fibotail; import java.util.Scanner; public class Fibotail { public static int fibo(int control, int currentValue, int previousValue) { if (control &lt; 2) { return currentValue; } return fibo(control - 1, currentValue + previousValue, currentValue); } public static void magic() { String cCharacter; do { System.out.println("Input here: "); int something = new Scanner(System.in).nextInt(); for (int i = 1; fibo(i, 0, 1) &lt;= something; i++) { System.out.println(fibo(i, 0, 1)); } do { System.out.println("Do you want to try again? "); cCharacter = new Scanner(System.in).next(); } while (!(cCharacter.equals("y") || cCharacter.equals("Y") || cCharacter.equals("N") || cCharacter.equals("n"))); } while (cCharacter.equals('y') || cCharacter.equals('Y')); } public static int main(String args[]) { magic(); return 0; } }
favorite count: 0
has comment: http://stackoverflow.com/comment/39009054

http://stackoverflow.com/q/25188939
has comment: http://stackoverflow.com/comment/46347831
has answer: http://stackoverflow.com/a/40804059
has answer: http://stackoverflow.com/a/25202635
accepted answer: http://stackoverflow.com/a/25202635
has answer: http://stackoverflow.com/a/27866092
linked to: http://stackoverflow.com/q/13012584
has answer: http://stackoverflow.com/a/60831929
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/36109273
tagged with: sqlresultsetmapping
has answer: http://stackoverflow.com/a/53292503
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39233312
tagged with: pojo
has answer: http://stackoverflow.com/a/40805344
type: Question
upvote count: 54
has comment: http://stackoverflow.com/comment/46482321
tagged with: jpa
favorite count: 0
linked to: http://stackoverflow.com/q/25179180
has title: How to map the result set of a JPA NativeQuery to a POJO using SqlResultSetMapping
linked to: http://stackoverflow.com/q/22423604
has answer: http://stackoverflow.com/a/36109273
has answer: http://stackoverflow.com/a/77751144
has answer: http://stackoverflow.com/a/64458163
has body: I am attempting to map the results of a Native query to a POJO using @SqlResultSetMapping with @ConstructorResult. Here is my code: @SqlResultSetMapping(name="foo", classes = { @ConstructorResult( targetClass = Bar.class, columns = { @ColumnResult(name = "barId", type = Long.class), @ColumnResult(name = "barName", type = String.class), @ColumnResult(name = "barTotal", type = Long.class) }) }) public class Bar { private Long barId; private String barName; private Long barTotal; ... And then in my DAO: Query query = em.createNativeQueryBar(QUERY, "foo"); ... set some parameters ... List<Bar> list = (List<Bar>) query.getResultList(); I have read that this functionality is only supported in JPA 2.1, but that is what I am using. Here's my dependency: org.hibernate.javax.persistence hibernate-jpa-2.1-api 1.0.0.Final I found a couple of resources, including this one: @ConstructorResult mapping in jpa 2.1. But I am still not having any luck. What am I missing? Why can't the SqlResultSetMapping be found? javax.persistence.PersistenceException: org.hibernate.MappingException: Unknown SqlResultSetMapping [foo]
has comment: http://stackoverflow.com/comment/39234415
has answer: http://stackoverflow.com/a/57977188
has comment: http://stackoverflow.com/comment/39224776
has answer: http://stackoverflow.com/a/63893592
answer count: 12
downvote count: 0
score: 54
has answer: http://stackoverflow.com/a/57562706

http://stackoverflow.com/q/25094724
downvote count: 0
favorite count: 0
has title: Unimplemented WebView method run called from: android.os.Handler.handleCallback(Handler.java:733)
has answer: http://stackoverflow.com/a/25113062
tagged with: android
tagged with: facebook
tagged with: webview
upvote count: 1
has body: I am new to Android app development. I try to connect facebook using socialauth. I implemented everything as given. When I execute my app, at background it gets green access to facebook and return back to app, but it opens with a blue screen webview and start to loading, and then still remains same. Getting errors in Logcat as "W/OpenGLRenderer(1361): Bitmap too large to be uploaded into a texture (2560x1600, max=2048x2048) W/UnimplementedWebViewApi??(1361): Unimplemented WebView?? method run called from: android.os.Handler.handleCallback(Handler.java:733)" here is my logcat Can any one help me resolve this.?
tagged with: socialauth
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25113062
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/39086919

http://stackoverflow.com/a/25215099
score: 2
has body: Pivot4J or Olap4J is used to browse an existing OLAP schema, so you'll need to rely on using another tool to create cubes which is usually provided by the vendor of the respective OLAP backend you're using. As to Mondrian, there's a GUI application called Schema Workbench which allows you to manipulate Mondrian schema files. Hope this helps! Xavier
answers question: http://stackoverflow.com/q/25197763
accepted answer of: http://stackoverflow.com/q/25197763
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/25209696
has answer: http://stackoverflow.com/a/25209793
has comment: http://stackoverflow.com/comment/39262801
possible better answer: http://stackoverflow.com/a/25209727
has title: JAVA - REGEX - Don't match only whitespaces
score: 2
has body: I'm trying to build a regular expression that doesn't allow only whitespaces, but, for example, does allow " aaaaa " " aaaaa" "aaaaaa " The string's lenght should be {1,150}. I'm trying to use ^(?=.\\S).{1,20}$ ...but it doesn't work for the input of " aaaaaa"
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25209793
tagged with: regex
answer count: 4
has answer: http://stackoverflow.com/a/25209981
type: AnsweredQuestion
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25209835
type: Question
has answer: http://stackoverflow.com/a/25209727

http://stackoverflow.com/q/25092797
tagged with: http://stackoverflow.com/tag/xml
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25093415
has answer: http://stackoverflow.com/a/29762733
answer count: 2
has title: Hibernate Association references unmapped class when the class is mapped
downvote count: 0
has body: I have mapped all my entity classes in my hibernate project. But still I am getting an Association references Association references unmapped class: Items. Please someone help me to solve this problem. As I am quite new to hibernate please give me a detailed answer. Thanks in advance. Items.java public class Items { private long id; private String itemId; private double itemTotal; private int quantity; private Cart cart; // no-args constructor getters and setters Cart.java package com.journaldev.hibernate.model; import java.util.Set; public class Cart { private long id; private double total; private String name; private Set<Items> items; // no-args constructor getters and setters hibernate.cfg.xml <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> org.hibernate.dialect.MySQLDialect com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/composition?zeroDateTimeBehavior=convertToNull root root123 <mapping resource="cart.hbm.xml"/> <mapping resource="Item.hbm.xml"/> </hibernate-configuration> Item.hbm.xml <?xml version="1.0" encoding="UTF-8"?> <generator class="identity" /> cart.hbm.xml <?xml version="1.0" encoding="UTF-8"?> <generator class="identity" /> <one-to-many class="Items"/> HibernateUtil.java package com.journaldev.hibernate.util; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; public class HibernateUtil { private static SessionFactory sessionFactory; private static SessionFactory buildSessionFactory() { try { // Create the SessionFactory from hibernate.cfg.xml Configuration configuration = new Configuration(); configuration.configure("hibernate.cfg.xml"); System.out.println("Hibernate Configuration loaded"); /* ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build(); System.out.println("Hibernate serviceRegistry created"); SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry); */ …
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/25073325
has comment: http://stackoverflow.com/comment/39008656
upvote count: 2
answers question: http://stackoverflow.com/q/25073312
type: Answer
has body: You forgot to add a condition that i != j I suspect that you should replace the following condition: boxPool.get(i) != boxPool.get(j) with: !boxPool.get(i).equals(boxPool.get(j)) Further, there's no need to double loop over all the elements, you can always start with j = i + 1 and then you don't have to check that i != j: for(int i=0;i&lt;boxPool.size();i++) { // V for(int j=i+1;j&lt;boxPool.size();j++) // &lt;-- this line has changed! { if(boxPool.get(i) != boxPool.get(j) &amp;&amp; checkCollision(boxPool.get(i), boxPool.get(j))) { boxPool.get(i).colliding = true; boxPool.get(j).colliding = true; } } }
accepted answer of: http://stackoverflow.com/q/25073312
score: 2
has comment: http://stackoverflow.com/comment/39009007
has comment: http://stackoverflow.com/comment/39008808
has comment: http://stackoverflow.com/comment/39009218
has comment: http://stackoverflow.com/comment/39009139
has comment: http://stackoverflow.com/comment/39008769
has comment: http://stackoverflow.com/comment/39008915
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25225970
has answer: http://stackoverflow.com/a/25226865
type: AnsweredQuestion
tagged with: mysql
has comment: http://stackoverflow.com/comment/39292787
tagged with: swing
has comment: http://stackoverflow.com/comment/39292790
has title: Insert multiple rows in MySQL
type: Question
tagged with: sql-insert
tagged with: java
score: 0
has body: I am trying to insert the details below from the jtextfields into the database. Columns to be inserted are roomNumberSelected,guestName,passportNo,phoneNo in Guest table. Currently when it compiles, it only inserts the final row of data. I am implementing three-tier architecture in my application. I believe I have to alter my SQL statement to insert multiple values but I'm unsure on how to go about that. UI - GuestDetails.java No. of rooms needed is equivalent to noOfRoomsSelected. In this case, noOfSelectedRooms = 5; if(noOfRoomsSelected=="1"){ if(name1.isEmpty()||passportNo1.isEmpty()||phoneNo1.isEmpty()){ JOptionPane.showMessageDialog(null, "Some Required field(s) are not entered. Please try again."); } else{ g.setSelectedRoomNum(comboBox1.getSelectedItem().toString()); g.setGuestPassportNo(tfPassportNo1.getText()); g.setGuestName(tfGuestName1.getText()); g.setGuestPhoneNo(tfPhoneNo1.getText()); } } else if(noOfRoomsSelected=="2"){ if(name1.isEmpty()||passportNo1.isEmpty()||phoneNo1.isEmpty() ||name2.isEmpty()||passportNo2.isEmpty()||phoneNo2.isEmpty()){ JOptionPane.showMessageDialog(null, "Some Required field(s) are not entered. Please try again."); } else{ g.setSelectedRoomNum(comboBox1.getSelectedItem().toString()); g.setGuestPassportNo(tfPassportNo1.getText()); g.setGuestName(tfGuestName1.getText()); g.setGuestPhoneNo(tfPhoneNo1.getText()); g.setSelectedRoomNum(comboBox2.getSelectedItem().toString()); g.setGuestPassportNo(tfPassportNo2.getText()); g.setGuestName(tfGuestName2.getText()); g.setGuestPhoneNo(tfPhoneNo2.getText()); } } else if(noOfRoomsSelected=="3"){ if(name1.isEmpty()||passportNo1.isEmpty()||phoneNo1.isEmpty() ||name2.isEmpty()||passportNo2.isEmpty()||phoneNo2.isEmpty()|| name3.isEmpty()||passportNo3.isEmpty()||phoneNo3.isEmpty()){ JOptionPane.showMessageDialog(null, "Some Required field(s) are not entered. Please try again."); } else { g.setSelectedRoomNum(comboBox1.getSelectedItem().toString()); g.setGuestPassportNo(tfPassportNo1.getText()); g…
answer count: 1
has comment: http://stackoverflow.com/comment/39292910
tagged with: insert
accepted answer: http://stackoverflow.com/a/25226865
has comment: http://stackoverflow.com/comment/39292927
has comment: http://stackoverflow.com/comment/39292924

http://stackoverflow.com/a/25224776
has comment: http://stackoverflow.com/comment/39295322
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39295234
accepted answer of: http://stackoverflow.com/q/25224603
type: AcceptedAnswer
has body: Pre-KitKat, this might be possible by intercepting the SMS_RECEIVED broadcast, aborting it, and writing the altered message to the provider. This won't work everywhere, though, as the SMS API was not publicly available until KitKat, and the exact implementation varies from vendor to vendor. From KitKat on, the default SMS app is responsible for writing the message to the provider, so if your app is selected as default, you could display and write the altered message. However this isn't a 100% guaranteed solution, as any attempt to abort the SMS_RECEIVED action is ignored by the system, and any app listening for it will still have access to the original message.
answers question: http://stackoverflow.com/q/25224603
upvote count: 1
type: Answer

http://stackoverflow.com/q/25183997
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25198326
tagged with: javascript
score: 0
type: UnansweredQuestion
tagged with: jsni
has title: Get javascript data to the gwt side
has body: I am using javascript variable which has json data like: I got the above string in my html like below: var info = [{"tenantKey":"Demo:farcoahuja@gmail.com","lastModifiedDate":1407410632468,"seqId":1,"lastModifiedBy":"farcoahuja@gmail.com","historyStr":null,"mDate":null,"mBy":null,"partyOrgKey":"5488762045857792","id":6245226045767680,"organizationName":"","fullName":"ram's","partyNameSplitList":["ram"],"currencyId":6262818231812096,"currency":null,"comments":null,"panNo":"","tinNo":"","serviceTaxNo":"","internalRole":"CUSTOMER","acctgAttrib":{"mainBranch":false,"balance":0.0,"openingBalance":0.0,"finalBalance":0.0},"glAcctOrgKey":"4837851162214400:6245226045767680","priceListRef":null,"priceList":null,"mapFirstName":null,"mapLastName":null}]; If you see my above json key-value("fullName":"ram's"), the value ram's has a special character(single quote). I have got this to the gwt side by using JSNI. private static native String getPartyListString() /*-{ return $wnd.info; }-*/ The my above approach is correct but because of special single quotation in the value, the jsni was not able to get it to the gwt side. How to get the above data to the gwt side?
tagged with: gwt
has answer: http://stackoverflow.com/a/25184478
tagged with: java

http://stackoverflow.com/comment/39036228
score: 1
comment on: http://stackoverflow.com/a/25087830
type: AnswerComment
has text: @Gumbo answering poor questions encourages the behavior of asking poor questions, see meta discussion http://meta.stackoverflow.com/a/255462/3666763 The community isn't completely in agreement on this, but as i said, those were _ideas_
type: Comment

http://stackoverflow.com/q/25168907
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39186632
tagged with: java
has body: I have to read a file and depending of the content of the last lines, I have to copy most of its content into a new file. Unfortunately I didn't found a way to copy first n lines or chars of a file in java. The only way I found, is copying the file using nio FileChannels where I can specifiy the length in bytes. However, therefore I would need to know how many bytes the stuff I read needed in the source-file. Does anyone know a solution for one of these problems?
linked to: http://stackoverflow.com/q/2231369
type: Question
has comment: http://stackoverflow.com/comment/39186645
has comment: http://stackoverflow.com/comment/39186657
has title: Java how to copy part of a file
has comment: http://stackoverflow.com/comment/39187107
has answer: http://stackoverflow.com/a/25169059
has answer: http://stackoverflow.com/a/25169109
answer count: 2
tagged with: file-io
score: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/25125231
answer count: 1
favorite count: 0
tagged with: multi-touch
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25125285
has body: I've got a question with regard to the hardware of Android mobile phones. Do they have multiple touch sensors? Is it possible to make two buttons that can be pressed at the same time? For example, I'm programming a ping-pong game and I'm creating a multiplayer mode (face to face IRL). However if player 1 is touching the screen to change the direction of the racket, then player 2 can't make his racket change direction because a button is already pressed. How to solve this?
tagged with: java
upvote count: 1
downvote count: 1
has title: Android Multi Touch Sensors Programming
has comment: http://stackoverflow.com/comment/39107159
type: Question
accepted answer: http://stackoverflow.com/a/25125285
tagged with: touch
has comment: http://stackoverflow.com/comment/39105616
score: 0

http://stackoverflow.com/comment/39090552
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25117232
has text: why are you using reflection? Make getter methods and access directly. Reflection makes the things slow.
type: Comment

http://stackoverflow.com/q/25226741
has body: I am trying to work on an example for @Subselect using Hibernate documentaion. I have created entities for Bid and Item as follows: @Entity public class Bid { @Id private int id; @Column(name="item_id") private int itemId; @Column private int amount; //getters &amp; setters } @Entity public class Item { @Id private int id; @Column private String name; //getters and setters } I have inserted some records in database tables for Bid and Item. Now I have created another entity to test the @Subselect as: @Entity @Subselect("select item.name name, max(bid.amount) amount, count(*) count " + "from item " + "join bid on bid.item_id = item.id " + "group by item.name") @Synchronize({ "item", "bid" }) // tables impacted public class Summary { @Id @GeneratedValue private int id; @Column private String name; @Column private String amount; @Column private String count; //getters &amp; setters } I am new to Hibernate so trying to create a sample program to test the feature of @Subselect. public class AppTest { public static void main(String[] args) { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); //createItemsAndBids(session); Summary summary = new Summary(); session.save(summary); session.getTransaction().commit(); HibernateUtil.getSessionFactory().close(); } When I run this program I am getting below errors: Hibernate: select hibernate_sequence.nextval from dual Hibernate: insert into ( select item.name name, max(bid.amount) amount, count(*) count from item join bid on bid.item_id = item.id group by item.name ) (amount, count, name, id) values (?, ?, ?, ?) Aug 10, 2014 1:24:31 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions WARN: SQL Error: 904, SQLState: 42000 Aug 10, 2014 1:24:31 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions ERROR: ORA-00904: "ID": invalid identifier Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "ID": invalid identifier Please help me how to test the feature of…
tagged with: oracle-database
has title: How to use @Subselect in Hibernate
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
score: 4
accepted answer: http://stackoverflow.com/a/25227928
upvote count: 4
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25227928
favorite count: 0

http://stackoverflow.com/q/25150456
type: Question
has comment: http://stackoverflow.com/comment/39152831
has comment: http://stackoverflow.com/comment/39152867
has comment: http://stackoverflow.com/comment/39152537
downvote count: 0
has body: If I had a string like telephone and wanted the output to come back as tel*phon*, how would I do that? The program would print back out each letter in the string. If it's the first time that letter is appearing then I'd write it. But if it reappears, I would print an asterisk. hello would be hel*o goodbye would be go*dbye coordination would be co*rdinat*** Please help thanks! And this is not homework... this is practice for the final coming up! Thanks!! I'm trying something like this... but I just don't get how to get further... Please help import java.util.Scanner; public class firstOccurrence{ public static void main(String[] args){ Scanner keyboard = new Scanner(System.in); String s; int i, j, count; System.out.print("Enter string: "); s = keyboard.nextLine(); for(i = 0; i &lt; s.length(); i++){ count = 0; for(j = i+1; i &lt; s.length(); j++){ if(s.charAt(i) == s.charAt(j)) count++; } if(count &lt; 1) System.out.print(s.charAt(i)); else System.out.print("*"); } } } How would I edit this exact code to make it work? Please help :(
answer count: 3
has comment: http://stackoverflow.com/comment/39152901
has comment: http://stackoverflow.com/comment/39153073
favorite count: 0
linked to: http://stackoverflow.com/q/25149353
upvote count: 2
has comment: http://stackoverflow.com/comment/39152566
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27873056
has comment: http://stackoverflow.com/comment/39152520
has comment: http://stackoverflow.com/comment/39152866
has comment: http://stackoverflow.com/comment/39153142
has comment: http://stackoverflow.com/comment/39152945
has title: How do I replace all but one occurrence of a certain character?
has comment: http://stackoverflow.com/comment/39152563
has answer: http://stackoverflow.com/a/25150653
has comment: http://stackoverflow.com/comment/39152633
score: 2
has comment: http://stackoverflow.com/comment/39153172
tagged with: java
has answer: http://stackoverflow.com/a/27875531

http://stackoverflow.com/comment/47793180
comment on: http://stackoverflow.com/a/25070542
score: 0
type: Comment
has text: Ok, I've found that I have to override the annotation introspector since my classes do not refer to this filter in any way. However, this raises another question for me that I've posted here [http://stackoverflow.com/questions/29833259/jackson-how-to-add-property-filter-without-overriding-annotation-filters]
type: AnswerComment

http://stackoverflow.com/q/25097548
type: AnsweredQuestion
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/25098412
downvote count: 1
type: Question
has title: Manipulate all Buttons on a Layout
has body: I have a layout (FullBody) that have some other layouts inside(Header, footer), and each layout have a group of buttons and other ellements(including other layouts). How can i manipulate all buttons with a for() or other thing? I've tried this( Easy way to setOnClickListener() on all Activity Buttons ): ViewGroup group = (ViewGroup)findViewById(R.id.myrootlayout); View v; for(int i = 0; i &lt; group.getChildCount(); i++) { v = group.getChildAt(i); if(v instanceof Button) v.setOnClickListener(this) } This only selects the first level childs of the layout. How can i access all levels(Like DFS ) ?
score: 0
linked to: http://stackoverflow.com/q/7048470
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25098412
tagged with: android

http://stackoverflow.com/comment/39260067
type: Comment
type: QuestionComment
has text: How, specifically, does the "web application in Java" call the Progress app-server? Is the "web application in Java" aware that the user closed the browser window? Is the "web application in Java" expected to kill the app server session? Or is some uninvolved 3rd party supposed to magically understand the linkage between them?
score: 0
comment on: http://stackoverflow.com/q/25207689

http://stackoverflow.com/q/25176449
tagged with: format
has title: Produce variable size digits without leading zeros with Java String format
has body: If you try this code: public class StringFormat { public void printIt() { String pattern = "%%s%%0%dd%%s"; // &lt;-- THIS SHOULD BE FIXED String arrayName = "aaaa[12]"; int arrayLength = 12; String printfString = String.format(pattern, Integer.toString(arrayLength - 1).length()); int arrayAt = 4; int arrayTill = 7; for (int arrayIndex = 0; arrayIndex &lt; arrayLength; arrayIndex++) { String formattedString = String.format(printfString, arrayName.substring(0, arrayAt + 1), arrayIndex, arrayName.substring(arrayTill)); System.out.println(formattedString.toString()); } } public static void main(String[] args) { StringFormat stringFormat = new StringFormat(); stringFormat.printIt(); } } you will see that the output is: aaaa[00] aaaa[01] ....... aaaa[09] aaaa[10] aaaa[11] I do not want to have leading zeros in the array size. The output should be: aaaa[0] aaaa[1] ....... aaaa[9] aaaa[10] aaaa[11] Can the pattern string %%s%%0%dd%%s be changed to do that or shall I branch the execution with two patterns - for single and double digits?
tagged with: java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25176597
tagged with: string
has answer: http://stackoverflow.com/a/25176520
type: Question
possible better answer: http://stackoverflow.com/a/25176597
score: 0
tagged with: string-formatting
answer count: 2
accepted answer: http://stackoverflow.com/a/25176520

http://stackoverflow.com/q/25131067
has comment: http://stackoverflow.com/comment/39116494
answer count: 1
downvote count: 0
favorite count: 0
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/25131358
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question
has body: I'm trying to use a Scanner to draw a rectangle in JFrame, but get these errors: Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at DrawerAutoRect.main(DrawerAutoRect.java:39) My goal of this program is to choose the type of object to draw i.e.: lines, rectangles,o vals, and then input the parameters, i.e. if it's a rectangle I'm drawing, the input would be r, 200,200,400,400 and for it to draw a rectangle with those dimensions on the JFrame. Then I'd just type "end" and it'd end waiting for objects to be input and drawn. import java.awt.BasicStroke; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Scanner; import javax.swing.JFrame; public class DrawerAutoRect extends JFrame { public DrawerAutoRect(){ setSize(1020,1020); } public static void paint(Graphics g, int a, int b,int c, int d) { Graphics2D g2 = (Graphics2D)g; g2.drawRect(a, b, c, d); } public static void main(String[] args) { int x1 = 100; int x2 = 100; int y1 = 50; int y2 = 50; Scanner s = new Scanner(System.in); String dim = s.next(); while(dim!="end"){ if(dim.equals("r")){ x1 = s.nextInt(); y1 = s.nextInt(); x2 = s.nextInt(); y2 = s.nextInt(); } } paint(null, x1, y1, x2, y2); DrawerAutoRect r = new DrawerAutoRect(); r.setDefaultCloseOperation(EXIT_ON_CLOSE); r.setVisible(true); //r.pack(); r.setTitle("Tutorial"); }
tagged with: inputmismatchexception
has title: InputMismatchException on Scanner.nextInt

http://stackoverflow.com/a/25079019
downvote count: 0
has body: You can achieve your requirement with this public static String format(double value) { if(value &lt; 1000) { return format("###", value); } else { double hundreds = value % 1000; int other = (int) (value / 1000); return format(",##", other) + ',' + format("000", hundreds); } } private static String format(String pattern, Object value) { return new DecimalFormat(pattern).format(value); }
has comment: http://stackoverflow.com/comment/39019044
score: 4
has comment: http://stackoverflow.com/comment/39019173
has comment: http://stackoverflow.com/comment/39019146
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25078259

http://stackoverflow.com/comment/39024590
type: Comment
score: 1
has text: Is there any reason for that auto-boxing and if statements? We could keep i1 and i2 as Integer and do `i1.compareTo(i2);`
type: AnswerComment
comment on: http://stackoverflow.com/a/25081537

http://stackoverflow.com/a/26650182
has body: I just choice i want delete .jar at the "libs" folder , then delete it ,then it will auto disappear at Android Private Libraries
score: 0
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/25077689

http://stackoverflow.com/a/25201439
has body: is it possible that particular POM file is corrupt or mangled? Can you look at the contents of: /home/gundam/.m2/repository/org/apache/maven/plugins/maven-assembly-plugin/2.3/maven-assembly-plugin-2.3.pom See here What does this mean: Not a v4.0.0 POM. for project org.codehaus.mojo:rpm-maven-plugin where someone has a similar issue.
has comment: http://stackoverflow.com/comment/39247095
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25200958
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39246753
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25200958
has comment: http://stackoverflow.com/comment/39247048
has comment: http://stackoverflow.com/comment/39247635

http://stackoverflow.com/q/25076223
has comment: http://stackoverflow.com/comment/39013847
answer count: 3
has answer: http://stackoverflow.com/a/25076337
has comment: http://stackoverflow.com/comment/39013889
score: 0
tagged with: java
has title: using # in URL as value key
has comment: http://stackoverflow.com/comment/39013810
has answer: http://stackoverflow.com/a/25076266
has comment: http://stackoverflow.com/comment/39013856
has answer: http://stackoverflow.com/a/25076296
tagged with: java-server
has comment: http://stackoverflow.com/comment/39013775
has body: My java server works as follows: http://locahost:5555/?search="java" The above link would work fine. However, if I ever want to use "#" as part of search string, it all goes wrong. For example: http://locahost:5555/?search="c#" For some reason everything after "#" gets ignored. If I use the decoded version of "#" it works fine again. For example: http://locahost:5555/?search="c%23" The system should be used by people that don't understand url encoding so they would never put %23 instead of #. Is there anyway around it?
has comment: http://stackoverflow.com/comment/39013918
possible better answer: http://stackoverflow.com/a/25076266
accepted answer: http://stackoverflow.com/a/25076337
type: Question
has comment: http://stackoverflow.com/comment/39013659
type: AnsweredQuestion
tagged with: url
has comment: http://stackoverflow.com/comment/39013683

http://stackoverflow.com/comment/39202012
has text: ConnectException Signals that an error occurred while attempting to connect a socket to a remote address and port. once you are connected, ConnectException will not be caught
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25177255

http://stackoverflow.com/a/25161361
has comment: http://stackoverflow.com/comment/39857348
has comment: http://stackoverflow.com/comment/39255232
has body: A client has a different configuration, so there is no point in copying it to the client. Only the server needs to have it. The mapstore classes need to be on the server since it is only running on the server. The classes of the objects you put in the map need to be available on both client and server.
answers question: http://stackoverflow.com/q/25143117
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39879087
type: Answer
accepted answer of: http://stackoverflow.com/q/25143117
score: 2
has comment: http://stackoverflow.com/comment/39221806
upvote count: 2
has comment: http://stackoverflow.com/comment/39245429
has comment: http://stackoverflow.com/comment/39461359

http://stackoverflow.com/comment/39168005
score: 0
type: AnswerComment
has text: before i was using temp.split("#").length-1'#' and '.' were generating error.solved for '.' using your change.but not working for '#'Any suggestion?
comment on: http://stackoverflow.com/a/25159252
type: Comment

http://stackoverflow.com/comment/66579534
type: AnswerComment
has text: In my case fade.excludeTarget(R.id.toolbar, true) is not working.perhaps because the toolbar comes from a theme, for example,Theme.AppCompat.Light.DarkActionBar directly?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/32793267

http://stackoverflow.com/comment/39117309
type: Comment
type: QuestionComment
has text: You need an instance of the `LanguageTranslation` in order to effect change on the fields, you can't "magically" alter the values of fields belonging to a `Class`, they have no state. As I said yesterday, this is a horribly bad idea. You have no idea when those fields will be instantiated, when there text might be set or changed. A better bet would be to use something like [Internationalization](http://docs.oracle.com/javase/tutorial/i18n/) instead...
comment on: http://stackoverflow.com/q/25131587
score: 3

http://stackoverflow.com/a/25083478
score: 1
has body: In normal circumstances (without @Async) a transaction gets propagated through the call hierarchy from one Spring component to the other. When a @Transactional Spring @Component calls a method annotated with @Async this does not happen. The call to the asynchronous method is being scheduled and executed at a later time by a task executor and is thus handled as a 'fresh' call, i.e. without a transactional context. If the @Async method (or the component in which it is declared) is not @Transactional by itself Spring will not manage any needed transactions. Try to annotate the method that calls the @Async method, and tell us if worked.
upvote count: 2
has comment: http://stackoverflow.com/comment/39027616
downvote count: 1
answers question: http://stackoverflow.com/q/25083295
type: Answer

http://stackoverflow.com/q/25093311
has body: i created a java swing frame and it contain a panel named anim.i use netbean ide for that.i have set it's width to 100 .i want to change it's width to 500 by clicking a jbutton.when i click it's width changed to 500 as i expect.but when i focus anywhere of my jframe ,my jpanel width changed to it's initial size 100.this is my code.i want to know how can i change it's width to 500 without change to it's initial size. anim.setSize(500, 400); this image shows my problem
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/39046819
has comment: http://stackoverflow.com/comment/39064530
tagged with: java
has title: confused with jpanel behaviour
type: Question
has comment: http://stackoverflow.com/comment/39050527
downvote count: 2
upvote count: 6
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/39049518
has comment: http://stackoverflow.com/comment/39062252
answer count: 0

http://stackoverflow.com/comment/39278565
has text: This is not hibernate generate query, paste the sql query.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25218086
score: 0

http://stackoverflow.com/a/25220279
type: Answer
answers question: http://stackoverflow.com/q/25219381
has body: ArrayList&lt; ArrayList > yourVar = new ArrayList&lt; ArrayList >(); same should apply for a list, you can also use a 2d array, but those are annoying to fill.
score: 0

http://stackoverflow.com/q/25156583
tagged with: mongodb-java
upvote count: 1
answer count: 1
tagged with: documentation
tagged with: replication
favorite count: 0
has answer: http://stackoverflow.com/a/25157363
accepted answer: http://stackoverflow.com/a/25157363
has body: From MongoClientURI documentation: Represents a URI which can be used to create a MongoClient instance. The URI describes the hosts to be used and options. The format of the URI is: mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database[.collection]][?options]] - host1 is the only required part of the URI. It identifies a server address to connect to. - Replica set configuration: replicaSet=name: Implies that the hosts given are a seed list, and the driver will attempt to find all members of the set. I wonder, is there any sense in passing multiple hosts without specifying replicaSet? Will Mongo client discover the replica set if I pass all nodes hosts but forget to specify replicaSet?
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: mongodb
has title: What will happen if create MongoClientURI from URI containing multiple hosts, but not a replicaSet option?

http://stackoverflow.com/a/68579907
score: 0
answers question: http://stackoverflow.com/q/25219219
type: Answer
has body: I wish to offer this advice and pattern. Do not ever use for/while/loops on an enum. Reduce use of if-then-else on an enum. But exploit the fact that an enum is an efficient hashmap. Build actions into the enum so that you don't have to iterate on the enum to resolve actions due to an enum. Avoid using if blocks to resolve the appropriate action for an enum, but build the function lambda into the enum. Design your code to use EnumSet as much as possible to "sub class" your enum. Redesign the flow of your code to make use of EnumSet. Don't use the plural but Command as the enum class name. So that you'd reference a command holder as Command.ADDUSER rather than Commands.ADDUSER. Example of using EnumSet to categorize items in the enum, enum Command { UPDATEUSER, ADDUSER, ADMINASSIGNMENT, BANUSER, CHANGESTATUS, REMOVEUSER, SELLSHARES, BUYSHARES, ; final static public EnumSet<AdminCommands> ADMIN = EnumSet.of( UPDATEUSER, ADDUSER, ADMINASSIGNMENT, BANUSER, CHANGESTATUS, REMOVEUSER ); final static public EnumSet<AdminCommands> USER= EnumSet.of( SELLSHARES, BUYSHARES ); } Building the class constructor call, and their respective actions into the enum: interface Commander{} @FunctionalInterface public interface CommanderNoArg extends Commander { Action getAction(); } @FunctionalInterface public interface Commander1Arg extends Commander { Action getAction(ActionContext ctx); } @FunctionalInterface public interface Commander2Arg extends Commander { Action getAction(ActionContext ctx, Options opts); } // Auxiliary casters needed due to Java's silly deficient treatment of generics static private CommanderNoArg hasNoArg(CommanderNoArg lambd) { return lambd; } static private Commander1Arg has1Arg(Commander1Arg lambd) { return lambd; } static private Commander2Arg has2Args(Commander2Arg lambd) { return lambd; } enum Command { UPDATEUSER(hasNoArg(UserContext::new) ), ADDUSER(hasNoArg(UserContext::new) ), ADMINASSIGNMENT(has1Arg(AdminContext::new) ), BANUSER(hasNoArg(UserContext::n…

http://stackoverflow.com/comment/39150381
score: 0
comment on: http://stackoverflow.com/q/25149293
type: Comment
type: QuestionComment
has text: Why not use a parser?

http://stackoverflow.com/comment/95111610
type: Comment
has text: The above configuration is posted on Aug 2014 in the context of core spring framework only. I am not sure whether it will work with spring boot or not.
type: AnswerComment
comment on: http://stackoverflow.com/a/25077659
score: 0

http://stackoverflow.com/a/25149506
type: Answer
has comment: http://stackoverflow.com/comment/39184583
downvote count: 0
has comment: http://stackoverflow.com/comment/39234559
has body: Locking does not occur in ActiveJDBC. ActiveJDBC models are completely disconnected from the database, as AJ does not even has a notion of a session. Optimistic locking is supported: http://javalite.io/optimistic_locking Pessimistic locking is a way to lock a set of rows for some time so that one user only can update them. Please, see CONCUR_UPDATABLE for more information. Generally speaking, pessimistic locking is more trouble than it is worth. ActiveJDBC does not support it. You will have to use plain JDBC for that. tx
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25147986

http://stackoverflow.com/a/25218230
has comment: http://stackoverflow.com/comment/39294507
has comment: http://stackoverflow.com/comment/103990141
answers question: http://stackoverflow.com/q/25212944
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25212944
type: Answer
has comment: http://stackoverflow.com/comment/44016349
has comment: http://stackoverflow.com/comment/43956717
score: 14
upvote count: 14
has body: HK2 runs in an OSGi environment for products such as GlassFish. Unfortunately most of the standard jars such as javax.inject, bean-validator and aopalliance do not come with proper OSGi headers. So hk2 needs to repackage them with OSGi headers so that they will work properly in that environment. Also since GlassFish is the RI for Java EE there are certain legal requirements that are made about the availability of the source code, so some of the repackaging that is done is to satisfy the availability of source code requirements. That being said, if you are NOT running in an OSGi environment it is safe to replace these jars with the standard versions (though I myself have not tried this)

http://stackoverflow.com/a/25072490
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25072233
has body: URL mentioned in ajax call should be the context path followed by the controller mapping. And '.html' should not be specified. url: ${pageContext.request.contextPath}/ajaxdays
type: Answer
score: 2

http://stackoverflow.com/a/25146187
has comment: http://stackoverflow.com/comment/39148551
has comment: http://stackoverflow.com/comment/39218093
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25142513
answers question: http://stackoverflow.com/q/25142513
has comment: http://stackoverflow.com/comment/39156289
type: Answer
has body: You can set the recoveryInterval property on the ActiveMQComponent/JmsComponent or set the same property on the JmsConfiguration POJO. However, since the Camel ActiveMQ/JMS consumer is based on a Spring JMS listeners, like DefaultMessageListenerContainer, you cannot simply change that parameter during runtime (if that's what you intend). You need to set the recoveryInterval before the route is created. You can of course recreate the route and possibly ActiveMQ component and have the recovery interval set programmatically. If you really need this feature, you can subclass DefaultMessageListenerContainer to allow setRecoveryInterval to actually trigger during runtime (not sure how easy that is, there is some thread handling to watch out for). Your custom MLC can be supplied to camel via the messageListenerContainerFactoryRef option.
score: 0

http://stackoverflow.com/comment/39150537
has text: That's an excellent point! That function was wrong and I replaced it. Unfortunately, this leads to my example input sets being processed as follows:
type: AnswerComment
comment on: http://stackoverflow.com/a/25149297
type: Comment
score: 0

http://stackoverflow.com/q/25074893
type: Question
has comment: http://stackoverflow.com/comment/39011145
has answer: http://stackoverflow.com/a/25075124
has comment: http://stackoverflow.com/comment/39011421
tagged with: arraylist
has comment: http://stackoverflow.com/comment/39011161
score: 0
has body: I have an easy question, but i didn't know how to search about it... Let's say I have a List of objects, List, and MyObject is something like this: List&lt;MyObject&gt; mo; class MyObject{ private SecondObject so; } class SecondObject{ private String sp; } I want to retrieve the list of the string parameter in the List of MyObject, and the only way I managed is to loop on the List... Is there a smarter/faster way? thank you, bye!!
has title: Java get List of parameter in a List of Objects
favorite count: 0
has comment: http://stackoverflow.com/comment/39011193
upvote count: 2
has answer: http://stackoverflow.com/a/25074983
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25075487
answer count: 4
has comment: http://stackoverflow.com/comment/39011173
has comment: http://stackoverflow.com/comment/39011294
tagged with: list
has comment: http://stackoverflow.com/comment/39011264
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/39011773
has answer: http://stackoverflow.com/a/25075053

http://stackoverflow.com/q/25226416
type: Question
has answer: http://stackoverflow.com/a/25226547
tagged with: hashmap
accepted answer: http://stackoverflow.com/a/25226447
score: 4
has answer: http://stackoverflow.com/a/25226497
upvote count: 4
has title: How to join two hashMap by their key
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/25226423
answer count: 5
has body: I have two HashMap. I need to join the two hashMap by their key. Map&lt;String, String&gt; firstMap = new HashMap&lt;String, String&gt;(); Map&lt;String, String&gt; secondMap = new HashMap&lt;String, String&gt;(); firstMap= [{K1,V1},{K2,V2}] secondMap= [{K2,V2},{K3,V3}] I need my third map to have thirdMap= [{K2,V2}] Kindly help me out. Thanks
has answer: http://stackoverflow.com/a/25226423
has answer: http://stackoverflow.com/a/25226459
tagged with: dictionary
has answer: http://stackoverflow.com/a/25226447
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/25075213
tagged with: java
has comment: http://stackoverflow.com/comment/39012032
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/39011710
answer count: 1
has comment: http://stackoverflow.com/comment/39012138
has title: ScheduledExecutorService and Threads in Java
favorite count: 0
tagged with: scheduledexecutorservice
has comment: http://stackoverflow.com/comment/39011774
has comment: http://stackoverflow.com/comment/39014264
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39011708
has answer: http://stackoverflow.com/a/25076676
has body: How does scheduler work here ? Does it create a new thread in the background and execute Run method in the main thread like a callback. ? . When run method is getting executedl, is it belong to the main thread? classA implements Runnable { public void Run() { System.out.println(Thread.currentTread().getName()); } public static void main(String args[]) { Thread.currentThread().setName("Main"); ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); scheduler.scheduleAtFixedRate(this, 250, 250, TimeUnit.MILLISECONDS); } } Thanks.
score: 2
downvote count: 0

http://stackoverflow.com/q/25141376
type: UnansweredQuestion
has title: Paypal update recurring payment
tagged with: paypal
has comment: http://stackoverflow.com/comment/39330588
has comment: http://stackoverflow.com/comment/39140185
type: Question
has comment: http://stackoverflow.com/comment/39160364
tagged with: java
has comment: http://stackoverflow.com/comment/39330200
has comment: http://stackoverflow.com/comment/39330953
has comment: http://stackoverflow.com/comment/39330488
score: 0
has comment: http://stackoverflow.com/comment/39347021
has body: I use PayPal's UpdateRecurringPaymentsProfile API Operation to update existing a PayPal recurring payment. When I called the PayPalAPIInterfaceServiceService to update the recurring payment using UpdateRecurringPaymentsProfileRequest, it took some time then returned with this response: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header> <Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType" /> xxx xxx xxx <Subject xsi:type="xs:string" /> </SOAP-ENV:Header> <SOAP-ENV:Body id="_0"> <SOAP-ENV:Fault> SOAP-ENV:Client Timeout processing request </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope> here's also the code I use: Logger logger = Logger.getLogger(this.getClass().toString()); UpdateRecurringPaymentsProfileReq updateRecurringPaymentsProfileReq = new UpdateRecurringPaymentsProfileReq(); UpdateRecurringPaymentsProfileRequestType updateRecurringPaymentsProfileRequestType = new UpdateRecurringPaymentsProfileRequestType(); updateRecurringPaymentsProfileRequestType.setVersion("63.0"); UpdateRecurringPaymentsProfileRequestDetailsType updateRecurringPaymentsProfileRequestDetailsType = new UpdateRecurringPaymentsProfileRequestDetailsType(); updateRecurringPaymentsProfileRequestDetailsType.setProfileID(farmBoxOrder.getProfileId()); BasicAmountType basicAmountType = new BasicAmountType(); basicAmountType.setValue(Utilities.stri…
has comment: http://stackoverflow.com/comment/39330290
answer count: 0

http://stackoverflow.com/q/25130436
tagged with: http://stackoverflow.com/tag/xml
has body: I"m working on Selenium Webdriver and the code I'm writing in Java.. In Eclipse running the scripts.. Currently i have many property files in my local directory and it is in the form of test.txt files and test.properties. And everything is a seperate files. Example: 1.login.txt file contains the following details loginUsername= test loginPassword= 1234 url= https//: .... 2. dropdown.properties contains following values visualizationId=Day,Week,Month,Quarter,Semester,Year,RD Tech Group,ICC,Center,Software Pack,Product,Project,Customer PRs,Severity,Priority periodId=Last 4 Weeks,Last 52 Weeks,Date Range,Week Range,Month Range,Year To Date classificationId=All PRs,External PRs,Internal PRs,Customer PRs topographyId=Overall,Center,ICC, swpacksId=ADVIP,ADVLEG,ADVSEC,Boot,H323,IBC,MULTI,None,OneOS_EAD,PROXY,SBO,SIP,TDRE,VoDSL priorityId=Very Urgent,Urgent,Routine,Not Urgent,On Hold,Not Assigned severityId=Blocking,Major,Minor,Cosmetic,OLD PR projectId=/dev/v4.3/r4/e12sqq,BATS,1523 Business IAD &amp; Business CPE,[CoCo2M],VQM My doubt is how can i keep everything in the form of XML file and it should be generic and i should call wherever i want the xml property file. Please help me for this scenario.
downvote count: 0
type: UnansweredQuestion
tagged with: selenium
has answer: http://stackoverflow.com/a/25131859
tagged with: selenium-webdriver
score: 2
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/39115994
answer count: 1
has title: How to create a XML property file in Java?
favorite count: 0

http://stackoverflow.com/a/25153534
has body: For this specific String you can use #replace method. String str="E-Mail: custrelations@abc.comConfirmation Number (PNR):H246FY"; str=str.replace(".com", ".com\n"); //str=str.replace(".com", ".com\r\n"); System.out.println(str); OUTPUT E-Mail: custrelations@abc.com Confirmation Number (PNR):H246FY Note:\r\n should be used for windows as well instead of just \n pointed out by Scary Wombat as well.
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/25153454
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25153454
type: Answer

http://stackoverflow.com/comment/39013917
type: QuestionComment
type: Comment
has text: @JonSkeet I will takecare of that in future am Sorry for the inconvenience.
score: 0
comment on: http://stackoverflow.com/q/25076329

http://stackoverflow.com/comment/39111252
comment on: http://stackoverflow.com/q/25128158
has text: Right, I mainly mean that it has to return an int which is not the output I need to display.
score: 0
type: Comment
type: QuestionComment

abstract-class
tags question: http://stackoverflow.com/q/25217154
type: Tag
tag name: abstract-class
tags question: http://stackoverflow.com/q/25078119

http://stackoverflow.com/comment/39014138
type: Comment
comment on: http://stackoverflow.com/a/25075237
has text: Im not trying to to this in android. I want to do this in pure java.:)
score: 0
type: AnswerComment

http://stackoverflow.com/q/25216281
score: -1
has comment: http://stackoverflow.com/comment/39275172
has comment: http://stackoverflow.com/comment/39275084
has comment: http://stackoverflow.com/comment/39275144
upvote count: 0
answer count: 1
favorite count: 0
has body: I am currently writing an Android app to work as an activity launcher. The main activity works as launcher and will let users launches a new activity from the main activity(here I create this new activity using FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_MULTIPLE_TASKS). So that I can hold multiple these activities with the same name but different content in the background. But I still need a method to manage them, which means I can offer a UI for user to choose to restart one and kill one. Can someone give me a good solution? I appreciate your help very much! And you can also view a similar question asked by me yesterday: set unique identifier for RunningTaskInfo
has title: How to manage multiple activities with the same name inside an app
has comment: http://stackoverflow.com/comment/39275109
tagged with: android
linked to: http://stackoverflow.com/q/17486672
has answer: http://stackoverflow.com/a/25216300
type: UnansweredQuestion
downvote count: 1
linked to: http://stackoverflow.com/q/25199404
type: Question
tagged with: java

http://stackoverflow.com/q/25208049
tagged with: sql
has title: POJO data with one to many / many to one relationship(JDBC)
downvote count: 0
has answer: http://stackoverflow.com/a/25216140
possible better answer: http://stackoverflow.com/a/25212890
favorite count: 0
has body: For example I have two entities : Enterprise, Department. Enterprise has many departments, department has one enterprise, so there is a column - Enterprise_ID in Department table. I have a function for saving Department object void save(Department department); To add Enterprise_ID in the table I need to have either reference on Enterprise object or enterprise's id. Which way is more suitable? However I prefer do not have such information in department object but on this way how can I save Enterprise_ID in the table ? It seems to me Hibernate somehow doing it. public class Department{ private long id; private String name; private DepartmentType type; private List&lt;Employee&gt; employees; //getters()/setters() } public class Enterprise{ ... private List&lt;Department&gt; departments; ... } Department does not have any information about Enterprise in which it exists. So using only department object I can't insert Enterprise_ID(FK) in department table. But hibernate's save method somehow doing it. How can I do it without hibernate using entities above; I use JDBC.
tagged with: jdbc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39263592
score: 3
accepted answer: http://stackoverflow.com/a/25216140
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39259800
type: Question
tagged with: pojo
has comment: http://stackoverflow.com/comment/39265625
has answer: http://stackoverflow.com/a/25212890
answer count: 2

http://stackoverflow.com/comment/76068380
comment on: http://stackoverflow.com/a/43677276
has text: https://fasterxml.github.io/jackson-databind/javadoc/2.6/com/fasterxml/jackson/databind/DeserializationFeature.html. Agreed @Walter Tross, this feature should have been set to disabled by default
type: AnswerComment
score: 2
type: Comment

http://stackoverflow.com/comment/39239516
score: 1
comment on: http://stackoverflow.com/a/25182744
type: AnswerComment
has text: Correct, if values met, until finding the denominator are bigger than the heap size.
type: Comment

http://stackoverflow.com/q/25215655
has comment: http://stackoverflow.com/comment/39277604
type: Question
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/25639977
accepted answer: http://stackoverflow.com/a/25639977
has comment: http://stackoverflow.com/comment/39276387
favorite count: 0
has body: I am trying to run the test case in Eclipse Helios. I have added all the jar files and have written @Test also, but I am not getting the "run as JUnit" option in Eclipse; Instead I am getting "run as java applet" and "run as java application". I have tried changing versions, restarting eclipse, and none of the solutions are working fine... How can I resolve this and get "run as JUnit"?
has comment: http://stackoverflow.com/comment/39276107
has comment: http://stackoverflow.com/comment/39273884
tagged with: eclipse-3.6
downvote count: 0
has title: "Run as JUnit" is not appearing in Eclipse Helios?
has comment: http://stackoverflow.com/comment/39275931
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/25140512
answers question: http://stackoverflow.com/q/25140343
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39144853
has comment: http://stackoverflow.com/comment/39137841
downvote count: 0
has body: Because, according to the language specification, if you supply any constructor, then the default no-args constructor will not be provided. Automatic addition of the public no-args constructor is a convenience, if you will. By specifying any other constructor you are effectively "taking control" and saying to the compiler "hey, please don't add the no-args constructor... if I want one, I'll add it myself". This is since there might be circumstances where you don't want a public no-args constructor (for example, to force object instantiation via a factory class).
type: Answer

http://stackoverflow.com/q/25098937
upvote count: 33
has answer: http://stackoverflow.com/a/25099395
downvote count: 0
has answer: http://stackoverflow.com/a/25099121
accepted answer: http://stackoverflow.com/a/25099566
has answer: http://stackoverflow.com/a/60756434
has title: Java 8: Interface with static methods instead of static util class
possible better answer: http://stackoverflow.com/a/25099395
favorite count: 0
tagged with: static
answer count: 5
tagged with: java-8
has answer: http://stackoverflow.com/a/25099566
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25099064
has body: What is best practice in Java 8 when I need a bunch of stateless utility methods. Is it right to have an interface that will not be implemented by anyone i.e. public interface Signatures and public interface Environments, or is it better to do it the old way - have public final class Signatures and public final class Environments with private constructors || enums?
score: 33
type: Question

http://stackoverflow.com/comment/39114099
type: QuestionComment
has text: Ok. You want to use a java class called Util into your runtime ide. You want something like an action ? I dont understand what you want to do with this class.
comment on: http://stackoverflow.com/q/25122633
score: 0
type: Comment

http://stackoverflow.com/a/25070488
answers question: http://stackoverflow.com/q/25070390
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39003515
has body: I would give your two while loops the following structure: while(in.hasNext()) { if(in.hasNextDouble()) { // your inner while loop code here } else { in.next(); } } Otherwise, you'll miss everything after the first instance of a non-double.
has comment: http://stackoverflow.com/comment/39003539
downvote count: 0
type: Answer

http://stackoverflow.com/q/25220315
score: 2
upvote count: 2
tagged with: java
type: Question
has title: ffmpeg won't start until java exits
tagged with: runtime
tagged with: wait
has body: I am trying to make a java program that automatically converts wtv files in an input folder to mpg files in output folder. The twist is that I make it run periodically, so it acts as a synchronizer. The following code works for converting the .wtv to a .dvr-ms, which is required by ffmpeg since it cannot convert .wtv files directly. Process p = Runtime.getRuntime().exec("C:\\Windows\\ehome\\WTVConverter C:\\Users\\Andrew\\Desktop\\test\\input\\input.wtv C:\\Users\\Andrew\\Desktop\\test\\output\\input.dvr-ms"); p.waitFor(); WTVConverter has no problems running from a java application. ffmpeg is a different story. Once the above line runs, I then run this... Process p = Runtime.getRuntime().exec("ffmpeg\\bin\\ffmpeg -y -i \"C:\\Users\\Andrew\\Desktop\\test\\output\\input.dvr-ms'" -vcodec copy -acodec copy -f dvd \"C:\Users\Andrew\Desktop\test\output\input.mpg\""); p.waitFor(); Suddenly, there is a problem... The application ffmpeg shows up in the task manager, but it's cpu usage is 0, and no mpeg files is being generated. If I force the java application to close, though, suddenly it starts working! Huh? What reason would there be for a command line application to wait for its calling application to quit before it executes? I'm not incredibly command line savvy, so I don't really know how to diagnose this problem.
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25220921
tagged with: ffmpeg
type: UnansweredQuestion

http://stackoverflow.com/q/25218042
has comment: http://stackoverflow.com/comment/39284806
type: Question
accepted answer: http://stackoverflow.com/a/25236329
tagged with: jpa
has comment: http://stackoverflow.com/comment/39293036
has comment: http://stackoverflow.com/comment/39279272
has body: I have a JPA class 'Project' which has a list of 'Employee' and the getEmployeeList() returns the list of Employees. public class Project implements Serializable { @ManyToMany(targetEntity=Employee.class) private List&lt;Employee&gt; employeeList; public List&lt;Employee&gt; getEmployeeList() { return this.employeeList; } } public class Employee implements Serializable { @Basic private EmployeeType type; public EmployeeType getType() { return this.type; } } public enum EmployeeType implements Serializable{ EDITOR, AUDITOR, ADMIN, INACTIVE } I have an Employee with type 'Auditor' and when I run the following for(Employee e: p.getEmployeeList()){ if(e.getType()==EmployeeType.AUDITOR) found=true; } it returns true which it should, but when I run (p.getEmployeeList()).stream().anyMatch((e) -&gt; (e.getType()==EmployeeType.AUDITOR)) it returns false What am I doing wrong?
tagged with: arraylist
has comment: http://stackoverflow.com/comment/39278479
answer count: 2
has comment: http://stackoverflow.com/comment/39280127
possible better answer: http://stackoverflow.com/a/31997545
has comment: http://stackoverflow.com/comment/39278496
has answer: http://stackoverflow.com/a/31997545
downvote count: 0
has comment: http://stackoverflow.com/comment/39292937
has comment: http://stackoverflow.com/comment/131145306
favorite count: 0
tagged with: java-8
linked to: http://stackoverflow.com/q/31939827
type: AnsweredQuestion
tagged with: java-stream
score: 1
duplicate of: http://stackoverflow.com/q/31939827
tagged with: java
has title: Java List stream anyMatch returning incorrect result
upvote count: 1
has answer: http://stackoverflow.com/a/25236329

http://stackoverflow.com/comment/39276569
comment on: http://stackoverflow.com/q/25217057
score: 0
type: Comment
type: QuestionComment
has text: what error is it showing?

http://stackoverflow.com/comment/39030445
type: QuestionComment
has text: Because you told the JVM to expect it there.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25084809

http://stackoverflow.com/q/25092426
tagged with: stdin
has answer: http://stackoverflow.com/a/25092457
type: AnsweredQuestion
tagged with: java
tagged with: stdout
accepted answer: http://stackoverflow.com/a/25092457
tagged with: eclipse
type: Question
has body: I copied and pasted a StdIn Class in eclipse which was used to complete an assignment in Stacks but suprisingly the names of functions readDoubles, readStrings and readInts were crossed automatically single-line crossed by Eclipse (although in the code below they are not crossed but if one tries to copy the below code to eclipse the crossed function names again appear). Why does this happen? The code of StdIn is given below:: package stackimplementation; /************************************************************************* * Compilation: javac StdIn.java * Execution: java StdIn (interactive test of basic functionality) * * Reads in data of various types from standard input. * *************************************************************************/ import java.util.ArrayList; import java.util.InputMismatchException; import java.util.Locale; import java.util.Scanner; import java.util.regex.Pattern; /** * The StdIn class provides static methods for reading strings * and numbers from standard input. See * Section 1.5 of * Introduction to Programming in Java: An Interdisciplinary Approach * by Robert Sedgewick and Kevin Wayne. * * For uniformity across platforms, this class uses Locale.US * for the locale and "UTF-8" for the character-set encoding. * The English language locale is consistent with the formatting conventions * for Java floating-point literals, command-line arguments * (via {@link Double#parseDouble(String)}) and standard output. * * Like {@link Scanner}, reading a token also consumes preceding Java * whitespace; reading a line consumes the following end-of-line * delimeter; reading a character consumes nothing extra. * * Whitespace is defined in {@link Character#isWhitespace(char)}. Newlines * consist of \n, \r, \r\n, and Unicode hex code points 0x2028, 0x2029, 0x0085; * see * Scanner.java (NB: Java 6u23 and earlier uses only \r, \r, \r\n). * * See {@link In} for a version that handles input from files, URLs, * and sockets. * * Note that Java's UTF-…
score: 0
answer count: 1
has title: Automatic crossing of function names by eclipse in the standard StdIn class

http://stackoverflow.com/a/25167160
upvote count: 2
answers question: http://stackoverflow.com/q/25167085
has comment: http://stackoverflow.com/comment/39186600
has comment: http://stackoverflow.com/comment/39207972
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39208091
accepted answer of: http://stackoverflow.com/q/25167085
type: Answer
has comment: http://stackoverflow.com/comment/39186504
has body: Java works by pass by value and not pass by reference.So you need to do this:- private void setupMainTable() { this.mTable= new Table(10, ((screenHeight/2)-(2*cardHeight)), (screenWidth-10), ((screenHeight/2)+(2*cardHeight))); }
score: 2
has comment: http://stackoverflow.com/comment/39186719

spring-mvc
tags question: http://stackoverflow.com/q/25091221
tags question: http://stackoverflow.com/q/25219683
tags question: http://stackoverflow.com/q/25160879
tags question: http://stackoverflow.com/q/25165468
tags question: http://stackoverflow.com/q/25152152
tags question: http://stackoverflow.com/q/25125022
tags question: http://stackoverflow.com/q/25155222
tags question: http://stackoverflow.com/q/25109945
tags question: http://stackoverflow.com/q/25087630
tags question: http://stackoverflow.com/q/25226314
tags question: http://stackoverflow.com/q/25075683
tags question: http://stackoverflow.com/q/25194854
tags question: http://stackoverflow.com/q/25213963
tags question: http://stackoverflow.com/q/25219061
tags question: http://stackoverflow.com/q/25102518
tags question: http://stackoverflow.com/q/25080593
tags question: http://stackoverflow.com/q/25135042
tags question: http://stackoverflow.com/q/25197433
tags question: http://stackoverflow.com/q/25204725
tags question: http://stackoverflow.com/q/25174440
tags question: http://stackoverflow.com/q/25124968
tags question: http://stackoverflow.com/q/25151264
tags question: http://stackoverflow.com/q/25077800
tags question: http://stackoverflow.com/q/25091791
tags question: http://stackoverflow.com/q/25092118
tags question: http://stackoverflow.com/q/25190140
tags question: http://stackoverflow.com/q/25163678
tags question: http://stackoverflow.com/q/25175430
tags question: http://stackoverflow.com/q/25113154
tags question: http://stackoverflow.com/q/25152812
tags question: http://stackoverflow.com/q/25115872
tags question: http://stackoverflow.com/q/25149757
tags question: http://stackoverflow.com/q/25115053
tags question: http://stackoverflow.com/q/25113350
tags question: http://stackoverflow.com/q/25105610
tags question: http://stackoverflow.com/q/25216951
tag name: spring-mvc
tags question: http://stackoverflow.com/q/25229361
tags question: http://stackoverflow.com/q/25108788
tags question: http://stackoverflow.com/q/25084970
tags question: http://stackoverflow.com/q/25084111
tags question: http://stackoverflow.com/q/25166212
tags question: http://stackoverflow.com/q/25182505
tags question: http://stackoverflow.com/q/25159685
tags question: http://stackoverflow.com/q/25160903
tags question: http://stackoverflow.com/q/25177974
tags question: http://stackoverflow.com/q/25185642
tags question: http://stackoverflow.com/q/25078817
tags question: http://stackoverflow.com/q/25178696
tags question: http://stackoverflow.com/q/25210174
tags question: http://stackoverflow.com/q/25230074
tags question: http://stackoverflow.com/q/25077261
tags question: http://stackoverflow.com/q/25221542
type: Tag
tags question: http://stackoverflow.com/q/25143888
tags question: http://stackoverflow.com/q/25134814
tags question: http://stackoverflow.com/q/25164885
tags question: http://stackoverflow.com/q/25220468
tags question: http://stackoverflow.com/q/25192342
tags question: http://stackoverflow.com/q/25116247
tags question: http://stackoverflow.com/q/25225137
tags question: http://stackoverflow.com/q/25129508
tags question: http://stackoverflow.com/q/25097436
tags question: http://stackoverflow.com/q/25071872
tags question: http://stackoverflow.com/q/25109830
tags question: http://stackoverflow.com/q/25129156
tags question: http://stackoverflow.com/q/25163806
tags question: http://stackoverflow.com/q/25139974
tags question: http://stackoverflow.com/q/25157186
tags question: http://stackoverflow.com/q/25121054
tags question: http://stackoverflow.com/q/25126505
tags question: http://stackoverflow.com/q/25092326
tags question: http://stackoverflow.com/q/25226441
tags question: http://stackoverflow.com/q/25126218
tags question: http://stackoverflow.com/q/25140876
tags question: http://stackoverflow.com/q/25174257
tags question: http://stackoverflow.com/q/25084070
tags question: http://stackoverflow.com/q/25073074
tags question: http://stackoverflow.com/q/25169057
tags question: http://stackoverflow.com/q/25081029

http://stackoverflow.com/comment/39090937
comment on: http://stackoverflow.com/q/25117107
score: 0
type: QuestionComment
type: Comment
has text: If you have a DLL that you can call, I'd advise to use JNA rather than JNI.

http://stackoverflow.com/a/25136124
has comment: http://stackoverflow.com/comment/39128332
answers question: http://stackoverflow.com/q/25133134
has comment: http://stackoverflow.com/comment/39127909
has comment: http://stackoverflow.com/comment/39127939
has comment: http://stackoverflow.com/comment/39128179
score: 0
has comment: http://stackoverflow.com/comment/39128040
has body: @mKorbel Here is what I did that really works. I changed my Table Model to AbstractModel public static class JTableModel extends AbstractTableModel { private static final long serialVersionUID = 1L; private static final String[] COLUMN_NAMES = new String[] {"Description", "PLU Code", "Cash Price"}; private static final Class&lt;?&gt;[] COLUMN_TYPES = new Class&lt;?&gt;[] {String.class, String.class, String.class, String.class}; public int getColumnCount() { return COLUMN_NAMES.length; } public int getRowCount() { return products.size(); } @Override public String getColumnName(int columnIndex) { return COLUMN_NAMES[columnIndex]; } @Override public Class&lt;?&gt; getColumnClass(int columnIndex) { return COLUMN_TYPES[columnIndex]; } public Object getValueAt(final int rowIndex, final int columnIndex) { switch (columnIndex) { case 0: return products.get(rowIndex).get("proddesc"); case 1: return products.get(rowIndex).get("prodcode"); case 2: return products.get(rowIndex).get("price"); default: return "Error"; } } public void removeRow(int row) { products.remove(row); fireTableRowsDeleted(row, row); } } private static class JTableButtonMouseListener extends MouseAdapter { private final JTable table; public JTableButtonMouseListener(JTable table) { this.table = table; } public void mouseClicked(MouseEvent e) { int column = table.getColumnModel().getColumnIndexAtX(e.getX()); int row = e.getY()/table.getRowHeight(); if (row &lt; table.getRowCount() &amp;&amp; row &gt;= 0 &amp;&amp; column &lt; table.getColumnCount() &amp;&amp; column &gt;= 0) { Object value = table.getValueAt(row, column); if (value instanceof JButton) { ((JButton)value).doClick(); } } } } Then this is what I did for my search button: JButton btnsearch = new JButton("Search"); btnsearch.setPreferredSize(new Dimension(90,20)); btnsearch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { String search = text.getText(); ArrayList&lt;HashMap&lt;String, String&gt;&gt; product…
type: Answer

http://stackoverflow.com/comment/39218033
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25185831
type: Comment
has text: Ok, so : right-click on your project, and then, properties

http://stackoverflow.com/comment/39233576
comment on: http://stackoverflow.com/q/25130179
has text: @simo.3792095 : Unfortunately it doesn't work this way. Strings are not materialized before they are sent to mysql. Both query template and parameters are sent to mysql and then mysql uses the passed parameters to generate actual query. Here it just ignores comments and leaves it as it is.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39091552
comment on: http://stackoverflow.com/q/25117834
has text: @Naveen, when I did, I got `File: C://Users//najib//studies//pizza.owl not found`
score: 0
type: Comment
type: QuestionComment

jsse
tags question: http://stackoverflow.com/q/25226391
type: Tag
tag name: jsse

http://stackoverflow.com/q/25162422
has answer: http://stackoverflow.com/a/25162574
has comment: http://stackoverflow.com/comment/39174209
has answer: http://stackoverflow.com/a/25162738
has body: For my program i want to have it so that the user can name the variables a bit like in a game you would name your charecter/world. I looked it up and couldn't find anywhere that said if this is possible and if so how it is done.
accepted answer: http://stackoverflow.com/a/25162574
downvote count: 1
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39174405
has comment: http://stackoverflow.com/comment/39174341
score: 2
has comment: http://stackoverflow.com/comment/39174390
upvote count: 3
tagged with: java
has title: Getting the user to name the variables
possible better answer: http://stackoverflow.com/a/25162550
type: Question
has answer: http://stackoverflow.com/a/25162550
has answer: http://stackoverflow.com/a/25162443
has comment: http://stackoverflow.com/comment/39174286
favorite count: 0

http://stackoverflow.com/a/25221847
score: 1
answers question: http://stackoverflow.com/q/25221823
has body: Yes, you can't call the start method of the Thread if it's already started. public void start() Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread. The result is that two threads are running concurrently: the current thread (which returns from the call to the start method) and the other thread (which executes its run method). It is never legal to start a thread more than once. In particular, a thread may not be restarted once it has completed execution. Throws: IllegalThreadStateException - if the thread was already started. See Also: run(), stop() (Source)
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/25128457
tagged with: mysql
type: Question
has body: When a user select a date/time, I need to store it in the DB as a timestamp. I would like to parse the string (date/time) to timestamp (if it is the best approach). However, I cannot figure it out! Here's what I have so far: Java protected String startDate @Column(name="start_date") public String getStartDate() { return startDate; } public void setStartDate(String startDate) { this.startDate = startDate; } @Override public boolean equals(Object obj) { if (startDate == null) { if (other.startDate != null) return false; } else if (!startDate.equals(other.startDate)) return false; } JS // date picker $('.datepicker').datetimepicker({ controlType: 'select', dateFormat: 'M d, yy', timeFormat: 'h:m:s TT' }); HTML &lt;input id="project_start_date" class="datepicker" type="text" name="project.startDate" value="${project.startDate}"/&gt; Thank you in advance!
tagged with: java
score: 0
answer count: 1
tagged with: timepicker
tagged with: freemarker
linked to: http://stackoverflow.com/q/4216745
type: UnansweredQuestion
tagged with: datepicker
has title: Java: Store date/timepicker to mysql as a timestamp
has comment: http://stackoverflow.com/comment/39112689
has answer: http://stackoverflow.com/a/25128978

http://stackoverflow.com/q/25120729
tagged with: richfaces
has body: I have a Richfaces component - fileUpload it's onerror method does not fire up even if server cast an exception. Here is component' code : &lt;rich:fileUpload immediateUpload="true" acceptedTypes="pdf, txt, rtf, xls, xlsx, doc, docx, ppt, pptx, jpg, jpeg, mpg, mpeg" allowFlash="true" maxFilesQuantity="1" fileUploadListener="#{bean.listener}" onerror="alert('error');" onuploadcomplete="alert('complete');" &gt; &lt;f:attribute name="typ" value="#{cc.attrs.typ}"&gt;&lt;/f:attribute&gt; &lt;/rich:fileUpload&gt; My bean.listener looks like this : public void listener(final FileUploadEvent event) throws IOException, ConversionException { throw new RuntimeException("haha"); } in any case the only thing I get is complete message. The version of RichFaces is 4.2.3. Did any one faced such problem? Thanks. UPD. Ok, I checked out Richfaces 4 documentation and there is actually no onerror event. Seems like any result is success for the framework. So now the question is how do I react on exception from server?
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/7348055
has answer: http://stackoverflow.com/a/25121572
type: Question
has title: richface fileUpload onerror does not fire up
score: 0
answer count: 1
tagged with: file-upload

http://stackoverflow.com/q/25198938
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25199002
type: UnansweredQuestion
tagged with: mapreduce
tagged with: hadoop
score: 1
favorite count: 0
type: Question
has body: I am running iterative hadoop/mapreduce jobs to analyze certain data. (apache hadoop version 1.1.0) and I need to know the number of output records of each reduce task to run the next iteration of M/R job. I can read the consolidated counter after each M/R job but I cannot find the way to read counter of each task separately. Please advise me regarding this. Choi
upvote count: 2
tagged with: java
has title: How can I read counter (for example, the number of output records) of each reduce task

http://stackoverflow.com/comment/39148360
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25148094
has text: @azurefrog so how will you write the code for creating this number since this process needs to be done numerous time with different length

http://stackoverflow.com/comment/39048217
type: Comment
has text: CREATE TABLE `Mytable` ( `field1` bigint(20) NOT NULL, `field2` bigint(20) NOT NULL, `field3` bigint(20) NOT NULL, `field4` bigint(20) NULL, `field5` datetime, ) ENGINE=MyISAM
comment on: http://stackoverflow.com/a/25092697
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39251437
type: QuestionComment
comment on: http://stackoverflow.com/q/25202615
has text: So you basically want to fake the location from the GPS device and then make it deliver a different location?
score: 0
type: Comment

http://stackoverflow.com/a/25212097
has comment: http://stackoverflow.com/comment/39271310
downvote count: 0
answers question: http://stackoverflow.com/q/25210690
type: Answer
upvote count: 13
score: 13
has comment: http://stackoverflow.com/comment/99990057
has body: The selectedProperty is inherited from Cell and it just indicates whether the Cell is selected in the UI component. Since you probably don't have cell selection enabled on your TableView, the cell never becomes selected. This isn't what you're looking for anyway; you want to know whether the CheckBox is selected, not the Cell. The trick here is to use the selectedStateCallback property of the CheckBoxTableCell. This is a function that maps the index of the cell to a BooleanProperty. That BooleanProperty is bound bidirectionally to the selected state of the check box. If your column is representing an actual property in your Trainee class (I'll just call it selectedProperty for demonstration) then you can do something like this: final CheckBoxTableCell&lt;Trainee, Boolean&gt; ctCell = new CheckBoxTableCell&lt;&gt;(); ctCell.setSelectedStateCallback(new Callback&lt;Integer, ObservableValue&lt;Boolean&gt;&gt;() { @Override public ObservableValue&lt;Boolean&gt; call(Integer index) { return table.getItems().get(index).selectedProperty(); } }); Then the property in the Trainee class with be bidirectionally bound to the check box state. If you need to do more than just update your model object when the check box is selected/deselected, you can just observe that property. If you don't have a property in the Trainee class, you can just create a BooleanProperty and observe it: final CheckBoxTableCell&lt;Trainee, Boolean&gt; ctCell = new CheckBoxTableCell&lt;&gt;(); final BooleanProperty selected = new SimpleBooleanProperty(); ctCell.setSelectedStateCallback(new Callback&lt;Integer, ObservableValue&lt;Boolean&gt;&gt;() { @Override public ObservableValue&lt;Boolean&gt; call(Integer index) { return selected ; } }); selected.addListener(new ChangeListener&lt;Boolean&gt;() { @Override public void changed(ObservableValue&lt;? extends Boolean&gt; obs, Boolean wasSelected, Boolean isSelected) { System.out.println(isSelected); } }); As usual, all this code looks a lot nicer in Java 8.
accepted answer of: http://stackoverflow.com/q/25210690
type: AcceptedAnswer

jpa
tags question: http://stackoverflow.com/q/25125582
tags question: http://stackoverflow.com/q/25125619
tags question: http://stackoverflow.com/q/25210540
tags question: http://stackoverflow.com/q/25208324
tags question: http://stackoverflow.com/q/25075281
tags question: http://stackoverflow.com/q/25163960
tags question: http://stackoverflow.com/q/25172083
tags question: http://stackoverflow.com/q/25130052
tags question: http://stackoverflow.com/q/25071503
tags question: http://stackoverflow.com/q/25188108
tags question: http://stackoverflow.com/q/25173630
tags question: http://stackoverflow.com/q/25070055
tags question: http://stackoverflow.com/q/25100535
tags question: http://stackoverflow.com/q/25081611
tags question: http://stackoverflow.com/q/25125800
tags question: http://stackoverflow.com/q/25086361
tags question: http://stackoverflow.com/q/25157867
tags question: http://stackoverflow.com/q/25158936
tags question: http://stackoverflow.com/q/25179180
tags question: http://stackoverflow.com/q/25196347
tags question: http://stackoverflow.com/q/25182505
tags question: http://stackoverflow.com/q/25160903
tags question: http://stackoverflow.com/q/25138384
tags question: http://stackoverflow.com/q/25160180
tags question: http://stackoverflow.com/q/25178645
tags question: http://stackoverflow.com/q/25117318
tags question: http://stackoverflow.com/q/25210908
tags question: http://stackoverflow.com/q/25156886
tags question: http://stackoverflow.com/q/25206325
tags question: http://stackoverflow.com/q/25135507
tags question: http://stackoverflow.com/q/25185023
type: Tag
tags question: http://stackoverflow.com/q/25073122
tags question: http://stackoverflow.com/q/25097768
tags question: http://stackoverflow.com/q/25180003
tags question: http://stackoverflow.com/q/25177256
tags question: http://stackoverflow.com/q/25130533
tags question: http://stackoverflow.com/q/25218042
tags question: http://stackoverflow.com/q/25201306
tags question: http://stackoverflow.com/q/25188939
tags question: http://stackoverflow.com/q/25118892
tags question: http://stackoverflow.com/q/25120751
tags question: http://stackoverflow.com/q/25087965
tags question: http://stackoverflow.com/q/25099491
tags question: http://stackoverflow.com/q/25090486
tags question: http://stackoverflow.com/q/25080844
tags question: http://stackoverflow.com/q/25156510
tags question: http://stackoverflow.com/q/25122088
tags question: http://stackoverflow.com/q/25173441
tags question: http://stackoverflow.com/q/25190006
tags question: http://stackoverflow.com/q/25161593
tags question: http://stackoverflow.com/q/25138744
tags question: http://stackoverflow.com/q/25077196
tags question: http://stackoverflow.com/q/25182540
tags question: http://stackoverflow.com/q/25105357
tags question: http://stackoverflow.com/q/25185747
tags question: http://stackoverflow.com/q/25142607
tags question: http://stackoverflow.com/q/25138767
tags question: http://stackoverflow.com/q/25160879
tags question: http://stackoverflow.com/q/25196261
tags question: http://stackoverflow.com/q/25119957
tags question: http://stackoverflow.com/q/25193560
tags question: http://stackoverflow.com/q/25125210
tags question: http://stackoverflow.com/q/25143422
tag name: jpa
tags question: http://stackoverflow.com/q/25082054
tags question: http://stackoverflow.com/q/25076110
tags question: http://stackoverflow.com/q/25201291
tags question: http://stackoverflow.com/q/25077668
tags question: http://stackoverflow.com/q/25175289
tags question: http://stackoverflow.com/q/25145697
tags question: http://stackoverflow.com/q/25082244
tags question: http://stackoverflow.com/q/25134391
tags question: http://stackoverflow.com/q/25138957
tags question: http://stackoverflow.com/q/25163592
tags question: http://stackoverflow.com/q/25227324
tags question: http://stackoverflow.com/q/25112962
tags question: http://stackoverflow.com/q/25125022
tags question: http://stackoverflow.com/q/25183017
tags question: http://stackoverflow.com/q/25120884

http://stackoverflow.com/comment/39252130
type: AnswerComment
score: 0
has text: But my file is not Part of class? I can't understand, can you explain please/
type: Comment
comment on: http://stackoverflow.com/a/25203948

http://stackoverflow.com/comment/39235488
comment on: http://stackoverflow.com/q/25177491
has text: Using CXF as perfollowing https://github.com/vanioinformatika/spring-boot-cxf-integration-example solved the issue.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25117760
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/26034180
accepted answer: http://stackoverflow.com/a/36975918
possible better answer: http://stackoverflow.com/a/26034180
answer count: 2
has title: How to convert .txt / .csv file to ORC format
downvote count: 0
has body: For some requirement I want to convert text file(delimited) to ORC(Optimized Row Columnar) format. As I have to run it in regular intervals, I want to write a java program to do so. I don't want to use Hive temporary table workaround. Can anyone please help me do it? Below is what i tried /*ORCMapper.java*/ import java.io.IOException; import java.util.*; import org.apache.hadoop.mapred.*; import org.apache.hadoop.hive.ql.io.orc.*; import org.apache.hadoop.io.*; public class ORCMapper extends MapReduceBase implements Mapper&lt;LongWritable, Text, NullWritable, Writable&gt;{ OrcSerde serde; @Override public void configure(JobConf job) { serde = new OrcSerde(); } @Override public void map(LongWritable key, Text value, OutputCollector&lt;NullWritable, Writable&gt; output, Reporter reporter) throws IOException { output.collect(NullWritable.get(),serde.serialize(value, null)); } } /*ORCReducer.java*/ import java.io.IOException; import java.util.Iterator; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Writable; import org.apache.hadoop.mapred.MapReduceBase; import org.apache.hadoop.mapred.OutputCollector; import org.apache.hadoop.mapred.Reducer; import org.apache.hadoop.mapred.Reporter; public class ORCReducer extends MapReduceBase implements Reducer&lt;NullWritable, Writable, NullWritable, Writable&gt;{ @Override public void reduce(NullWritable key, Iterator&lt;Writable&gt; values, OutputCollector&lt;NullWritable, Writable&gt; output, Reporter reporter) throws IOException { Writable value = values.next(); output.collect(key, value); } } /*ORCDriver.java*/ import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hive.ql.io.orc.*; import org.apache.hadoop.io.*; import org.apache.hadoop.mapred.*; public class ORCDriver { public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException { JobClient client = new JobClient(); JobConf conf = new JobConf("ORC_Generator"); conf.setInputFormat(TextInputFo…
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/36975918
has comment: http://stackoverflow.com/comment/39091376
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/39092153
upvote count: 7

http://stackoverflow.com/q/25191509
downvote count: 0
has answer: http://stackoverflow.com/a/25192775
tagged with: java
type: Question
has body: I'm using Play Framework 2.3.2 (Java version) I was wondering how I would go about adding multiple filters to the filters() override in Global.java? I have this to enable the CSRF Filter: public class Global extends GlobalSettings { @Override public &lt;T extends EssentialFilter&gt; Class&lt;T&gt;[] filters() { return new Class[]{CSRFFilter.class}; } } and I'd like to now also add the Gzip filter. What's the correct syntax to use to have both the CSRF filter and GZIP compression? It's described here: http://www.playframework.com/documentation/2.3.x/GzipEncoding but it doesn't say how to add that as a filter when one already exists. Thanks in advance!
score: 3
has comment: http://stackoverflow.com/comment/39229204
has comment: http://stackoverflow.com/comment/39230598
upvote count: 3
tagged with: playframework
answer count: 1
has title: Play Framework Multiple filters in Global.java
favorite count: 0
accepted answer: http://stackoverflow.com/a/25192775
type: AnsweredQuestion
tagged with: playframework-2.0

http://stackoverflow.com/a/25166264
has body: Change your code to this public class loops { public static void main(String args[]) throws InterruptedException { int countdown = 1; while (countdown &lt; 10){ System.out.println(countdown); ++countdown; Thread.sleep(1000); } } }
accepted answer of: http://stackoverflow.com/q/25166215
has comment: http://stackoverflow.com/comment/39181752
answers question: http://stackoverflow.com/q/25166215
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer

http://stackoverflow.com/q/25073122
has title: How to limit a collection in an Object's property in hibernate?
tagged with: orm
linked to: http://stackoverflow.com/q/1239723
type: Question
tagged with: jpa
downvote count: 0
answer count: 3
tagged with: sql
has answer: http://stackoverflow.com/a/25073248
has comment: http://stackoverflow.com/comment/39008259
favorite count: 0
has answer: http://stackoverflow.com/a/25073236
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39008112
has comment: http://stackoverflow.com/comment/39008166
has body: I have two entities: item, and bid, each item have many bids for it, so bid is a collection property of item. in the page that show an item, I just want to show the first 10 records of bids about this "item". so, I do this query: from item left join fetch item.bids where item.id=3 ... but this will fetch all bids about an item, so, how to limit the bids about an item ?
score: 2
has answer: http://stackoverflow.com/a/25077664
tagged with: java
tagged with: hibernate

logback
tags question: http://stackoverflow.com/q/25074417
tags question: http://stackoverflow.com/q/25104992
tags question: http://stackoverflow.com/q/25123702
type: Tag
tags question: http://stackoverflow.com/q/25204226
tag name: logback

http://stackoverflow.com/comment/39046293
score: 0
type: Comment
type: QuestionComment
has text: Give an example of the desired output pleas
comment on: http://stackoverflow.com/q/25093357

http://stackoverflow.com/q/25180615
tagged with: jsp
has comment: http://stackoverflow.com/comment/39241125
type: UnansweredQuestion
tagged with: soap
has answer: http://stackoverflow.com/a/25194300
tagged with: java
has body: I have a wsdl file containing a request configuration like this: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bscs="http://www.website.com/ws/bscs"> <soapenv:Header/> <soapenv:Body> <bscs:MyAction> ? ? </bscs:MyAction> </soapenv:Body> </soapenv:Envelope> but when checking the logs of the webserver the soap request is sent in this way: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns3:MyAction xmlns:ns2="http://www.website.com/ws" xmlns:ns3="http://www.website.com/ws/bscs"> 20045454545 45454 </ns3:MyAction> </soap:Body> </soap:Envelope> Do you have an idea on what might be causing the problem? The scenario is that we have SOAP service integrated within a properiatry system (sys1). Now we want that service to be hosted in another system (sys2) and keep the communication between the sys1 and hosted service as usual.
tagged with: web-services
type: Question
has comment: http://stackoverflow.com/comment/39230564
score: 0
has title: SOAP WSDL mis-configuration SOAP instead of SOAPENV
tagged with: wsdl
answer count: 1

http://stackoverflow.com/comment/39068897
has text: Yes, the dependencies also have null-checking constructors.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25104238

http://stackoverflow.com/a/25144277
upvote count: 1
downvote count: 0
has body: Since you return an object of type T and you store it into a variable of type Serializable, I guess that the compiler infers that T is Serializable in your call, so both String and ArrayList are eligible to be parameters of pick.
answers question: http://stackoverflow.com/q/25144230
type: Answer
score: 1

http://stackoverflow.com/comment/39157092
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25142779
has text: but my managed server on different machine with admin server
score: 0

string
tags question: http://stackoverflow.com/q/25141321
tags question: http://stackoverflow.com/q/25125596
tags question: http://stackoverflow.com/q/25162138
tags question: http://stackoverflow.com/q/25097687
tags question: http://stackoverflow.com/q/25118771
tags question: http://stackoverflow.com/q/25218141
tags question: http://stackoverflow.com/q/25073336
tags question: http://stackoverflow.com/q/25155038
tags question: http://stackoverflow.com/q/25142975
tags question: http://stackoverflow.com/q/25221596
tags question: http://stackoverflow.com/q/25076867
tags question: http://stackoverflow.com/q/25178931
tags question: http://stackoverflow.com/q/25119798
tags question: http://stackoverflow.com/q/25193504
tags question: http://stackoverflow.com/q/25179462
tags question: http://stackoverflow.com/q/25201913
tags question: http://stackoverflow.com/q/25096019
tags question: http://stackoverflow.com/q/25138514
tags question: http://stackoverflow.com/q/25143195
tags question: http://stackoverflow.com/q/25224954
tags question: http://stackoverflow.com/q/25096815
tags question: http://stackoverflow.com/q/25229218
tags question: http://stackoverflow.com/q/25208910
tags question: http://stackoverflow.com/q/25081668
tags question: http://stackoverflow.com/q/25163089
tags question: http://stackoverflow.com/q/25116743
tags question: http://stackoverflow.com/q/25134178
tags question: http://stackoverflow.com/q/25208933
tags question: http://stackoverflow.com/q/25225771
tags question: http://stackoverflow.com/q/25131922
tags question: http://stackoverflow.com/q/25210329
tags question: http://stackoverflow.com/q/25149163
tags question: http://stackoverflow.com/q/25138587
tags question: http://stackoverflow.com/q/25224277
tags question: http://stackoverflow.com/q/25103492
tags question: http://stackoverflow.com/q/25117115
tags question: http://stackoverflow.com/q/25125233
tag name: string
tags question: http://stackoverflow.com/q/25137483
tags question: http://stackoverflow.com/q/25087988
tags question: http://stackoverflow.com/q/25225781
tags question: http://stackoverflow.com/q/25176449
tags question: http://stackoverflow.com/q/25190227
tags question: http://stackoverflow.com/q/25074129
tags question: http://stackoverflow.com/q/25109390
tags question: http://stackoverflow.com/q/25168496
tags question: http://stackoverflow.com/q/25171798
tags question: http://stackoverflow.com/q/25110565
type: Tag
tags question: http://stackoverflow.com/q/25091814
tags question: http://stackoverflow.com/q/25149579
tags question: http://stackoverflow.com/q/25074313
tags question: http://stackoverflow.com/q/25087878
tags question: http://stackoverflow.com/q/25161446
tags question: http://stackoverflow.com/q/25153454
tags question: http://stackoverflow.com/q/25127890
tags question: http://stackoverflow.com/q/25176880
tags question: http://stackoverflow.com/q/25109460
tags question: http://stackoverflow.com/q/25181937
tags question: http://stackoverflow.com/q/25111756
tags question: http://stackoverflow.com/q/25119734
tags question: http://stackoverflow.com/q/25078949
tags question: http://stackoverflow.com/q/25171108
tags question: http://stackoverflow.com/q/25195108
tags question: http://stackoverflow.com/q/25185934
tags question: http://stackoverflow.com/q/25178841
tags question: http://stackoverflow.com/q/25225475
tags question: http://stackoverflow.com/q/25095030
tags question: http://stackoverflow.com/q/25152580
tags question: http://stackoverflow.com/q/25103434
tags question: http://stackoverflow.com/q/25134348
tags question: http://stackoverflow.com/q/25110186
tags question: http://stackoverflow.com/q/25220945
tags question: http://stackoverflow.com/q/25218161
tags question: http://stackoverflow.com/q/25103399
tags question: http://stackoverflow.com/q/25149144
tags question: http://stackoverflow.com/q/25214137
tags question: http://stackoverflow.com/q/25136103
tags question: http://stackoverflow.com/q/25153208
tags question: http://stackoverflow.com/q/25219394

http://stackoverflow.com/a/25108224
has comment: http://stackoverflow.com/comment/39079540
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25107074
downvote count: 0
has body: Here are some problems, along with why they are problems &amp; a suggestion on how they could be fixed: Problem: closing a scanner within the a loop that uses it will cause an exception. Reason: after we go through the loop once, the scanner will be closed. when we loop through again, an error will occur since the loop uses the scanner, which means the scanner should be "open". Possible solution: move scanner.close() to after the while loop. Problem: we shouldn't return true at the end of this method. Reason: I'm guessing that this method is supposed to return true if the word is found, and false otherwise. Now, the only way to get to this return statement is if our word doesn't exist in the recordFile; it should return false. Possible solution: return false at the end of the method instead. Problem: the first line in recordFile will never be checked for equality with word Reason: each method call of scanner.nextLine() will return each line from the recordFile as a String once and only once. In your code, it is called once in the beginning of the while loop's body, but not used to compare with word, then after, it is used in the for loop for comparison Possible solution: remove the line: System.out.println(scanner.nextLine());. Problem: scanner.equals(word) will probably always return false. Reason: scanner is a Scanner, and word is a String, they should never be equal. Possible solution: replace scanner.equals(word) with compare.equals(word) Problem: word is not actually compared with each compare. Reason: it is outside the for loop. Possible solution: move the if else block into the end of the for loop's body. I don't think the while loop is really needed. I strongly recommend that the while loop, is removed, but keep the body. Problem: Moving the if else block into the for loop, and above the scanner.close() means that the scanner.close() will never be run. Reason: once a return statement is executed, the flow of control immediatly exits the method, and returns t…
has comment: http://stackoverflow.com/comment/39079330
type: Answer
answers question: http://stackoverflow.com/q/25107074
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39101766

http://stackoverflow.com/comment/39220341
comment on: http://stackoverflow.com/a/25187292
has text: I never messed with the production modes.. This is my complete data source and I use the grails command wizard and just create a war file then deploy that to tomcat. Is there a special way that I should make it production? I cant see this being the problem though..
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25109576
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39076227
tagged with: mysql
type: Question
has body: I'm stuck on a couple of problems, and i've tried googlein, but to no sucsess.. i'm a starter in android development, and i've decided to make a pretty big app but useless, this is only training. But i'm stuck on a couple of things. i wish to connect to mysql database(i know how to do this), and from there get some information and save them to strings. For starters i want to get some names and i wish to save them to a strings. i wish to get 100 names, and i wanna save them to a1, a2, a3, etc. i use the following mysql command ("SELECT users.id, users.displayname, users.gender, picture.user_id FROM users, picture WHERE users.id=picture.user_id ORDER BY picture.finalsum LIMIT 100") how would i go about getting the displayname saved to the variable(s). also how do i store bytearray in my database? how would i go about getting images from my database into a listview? only pictures no text. Thanks in advance :)
has title: Questions regarding mysql and java
has comment: http://stackoverflow.com/comment/39076282
score: 0
has comment: http://stackoverflow.com/comment/39076229

http://stackoverflow.com/comment/39011900
has text: Instead of calling `setSize` before you add the pieces to the frame, try calling `pack` AFTER
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25075252

http://stackoverflow.com/q/25172137
tagged with: http://stackoverflow.com/tag/xml
tagged with: parse-platform
has title: ParseUser search
accepted answer: http://stackoverflow.com/a/25183019
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25183019
type: Question
has answer: http://stackoverflow.com/a/25172247
answer count: 2
has body: I am trying to create a simple user search page for my app. I tried to create a ParseQuery and display results in a Listview in my main activity page. However, when I run program, I could not get a result of a search, program displays nothing. I will be happy if I get an answer. Here is my MainActivity.java; package com.example.searchtest; import java.util.ArrayList; import java.util.List; import com.parse.*; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; public class MainActivity extends ActionBarActivity { private Button search; private EditText searchArea; private ListView userList; private String uName; private ArrayAdapter&lt;ParseUser&gt; mainAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Parse.initialize(this, "WHz2GmkGFIUxBir6ZEDt2FIG4WUcE1kfKZmPayxy", "IAs1RCaRt5LM1E1ZW7LFXy5uDjtZEQ5CDa3LKJt2"); setContentView(R.layout.activity_main); search = (Button) findViewById(R.id.searchButton); searchArea = (EditText) findViewById(R.id.searchField); userList = (ListView) findViewById(R.id.results); mainAdapter = new ArrayAdapter&lt;ParseUser&gt;(this, R.layout.activity_main, R.layout.search_list ); //mainAdapter.setTextKey("username"); userList.setAdapter(mainAdapter); //mainAdapter.loadObjects(); uName = searchArea.getText().toString(); search.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ParseQuery&lt;ParseUser&gt; query = ParseUser.getQuery(); query.whereEqualTo("username", uName); query.findInBackground(new FindCallback&lt;ParseUser&gt;() { public void done(List&lt;ParseUser&gt; objects, ParseException e) { if (e == null) { for(int i=0; i&lt;objects.size();i++) { mainAdapter.add((ParseUser)…
possible better answer: http://stackoverflow.com/a/25172247
score: 0
tagged with: android

http://stackoverflow.com/comment/39057630
score: 0
comment on: http://stackoverflow.com/a/25099391
type: AnswerComment
type: Comment
has text: @hollandnumerics Sorry, the last post was more of an explanation of my intent. I see you are already downloading something at startup. If the display information can be embedded in that, then just update the display from there.

http://stackoverflow.com/a/28667157
downvote count: 0
answers question: http://stackoverflow.com/q/25215127
has comment: http://stackoverflow.com/comment/62167571
type: Answer
has comment: http://stackoverflow.com/comment/55623834
score: 18
has body: To install all plugins of WTP, compatible with Luna, you have to select the software site http://download.eclipse.org/releases/luna instead of the WTP site. Here select at Web, XML, Java EE and OSGi Enterprise Development the plugins included in WTP 3.1.2, but up to date: Axis2 Tools 1.1.300.v201405061940-78-FPZDZRDKYKDReDDRe Dali Java Persistence Tools - EclipseLink JPA Support 3.4.1.v201409111648 Dali Java Persistence Tools - JPA Support 3.4.0.v201405081709-7V7dEpFC7sReAYthMgWBL39c7 Eclipse Java EE Developer Tools 3.6.1.v201409042158 Eclipse Java Web Developer Tools 3.6.1.v201409111852 Eclipse XML Editors and Tools 3.6.1.v201409111852 Eclipse XSL Developer Tools 1.3.401.v201409111855 JavaScript Development Tools 1.6.100.v201409111605 JSF Tools - Tag Library Metadata (Apache Trinidad) 2.5.0.v201405281344-23-7w312516392455 JSF Tools - Web Page Editor 2.6.1.v201409111805
has comment: http://stackoverflow.com/comment/62279772
has comment: http://stackoverflow.com/comment/62204881
upvote count: 18

http://stackoverflow.com/comment/39241714
type: AnswerComment
comment on: http://stackoverflow.com/a/25198025
score: 0
type: Comment
has text: @Pureferret - Check that it all compiles. If it does, I'm fairly confident it will work.

http://stackoverflow.com/comment/39207912
type: AnswerComment
has text: @dotvav, you were absolutely right when marked your own answer as wrong. I just wonder why have you posted it?
type: Comment
comment on: http://stackoverflow.com/a/25178793
score: 0

http://stackoverflow.com/comment/39262632
has text: To quickly answer your question: If Version has a method called test(), and Version1 and Version2 both have thier own implementation of test() as well, then `Version version = new Version1()` will call Version1's test(). (Note: class variables behave differently).
type: Comment
comment on: http://stackoverflow.com/a/25209166
score: 0
type: AnswerComment

http://stackoverflow.com/q/25205813
favorite count: 0
tagged with: service
has answer: http://stackoverflow.com/a/25206048
tagged with: android
has answer: http://stackoverflow.com/a/25206051
score: 2
type: AnsweredQuestion
has title: refresh activity from service after notification
tagged with: java
type: Question
has body: I have a service public class GcmIntentService extends IntentService{...} that manages the notifications. When a notification arrives if the user is out of the application, with a tap on the notification the main activity is resumed and updated public class MainActivity extends Activity { ... lv = (ListView) findViewById(R.id.lv); adapter = new Adapter(this, item); lv .setAdapter(adapter); ... } but how can I update the activity if the user is already on it?
possible better answer: http://stackoverflow.com/a/25206051
upvote count: 2
accepted answer: http://stackoverflow.com/a/25206048
answer count: 2
tagged with: notifications
has comment: http://stackoverflow.com/comment/39332493
downvote count: 0
tagged with: android-activity

http://stackoverflow.com/a/25143683
type: Answer
answers question: http://stackoverflow.com/q/25143627
has body: return false ends the method. When we say return, that means "stop what you're doing and give this value back to the method that called us." Cases where this doesn't happen try-finally blocks, any return statement or exception thrown in the finally block of a try block will override the returned value. System.exit, this method never returns, so any statements after an exit call will not be executed.
score: 0

http://stackoverflow.com/comment/39235371
has text: I forgot to say that I'm using OSGi version 4.0.2 , I saw your solution somewhere but 4.0.2 have no apdapt() function for Bundle
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25182583
type: Comment

http://stackoverflow.com/comment/39295852
type: AnswerComment
score: 0
type: Comment
has text: It is just for your case, because you want to use javascript from external file. And I want to let you know it is not basically javascript file. It is just a .jsp file whose matter is to be added after parsing it by container. So browser cannot get the expected result if you call this file directly.
comment on: http://stackoverflow.com/a/25182632

http://stackoverflow.com/q/25221885
has comment: http://stackoverflow.com/comment/39285693
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/25221943
has comment: http://stackoverflow.com/comment/39285817
has comment: http://stackoverflow.com/comment/39285533
tagged with: integer
has comment: http://stackoverflow.com/comment/39285927
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25221943
has comment: http://stackoverflow.com/comment/39285889
has title: get page method java
has body: I am making a project of memory management. I made a class for pages and now I'm making the RAM class that will handle pages. I have an alert on this method: public Page&lt;byte[]&gt;[] getPages(Integer[] pageIds){ Page&lt;byte[]&gt;[] getPages = new Page[pageIds.length]; for(int i=0; i&lt;pageIds.length ; i++){ getPages[i] = pages.get(pageIds[i]); } return getPages; } The problem is when I create getPages that should save the pages for all the ids in the array of Integers. How do I fix it?
tagged with: java
has comment: http://stackoverflow.com/comment/39285794

http://stackoverflow.com/a/25105397
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: I would not expose the Stage at all. Doing so couples your FXML-Controller pair to your Main class and prevents you ever using it without that class. Instead, do something like @FXML private Button someButton ; // ... public void someButtonController{ Window window = someButton.getScene().getWindow(); if (window instanceof Stage) { Parent root = FXMLLoader.load(getClass().getResource("/View/ShowWidget.fxml")); Scene scene = new Scene(root,300,300); Stage stage = (Stage) window ; stage.setScene(scene); stage.show(); // isn't it necessarily showing already? } } Here I'm assuming that the controller is the controller for an FXML file representing Nodes that are displayed in the Stage you're trying to access. If that's not the case, you can still do something similar though it will be more complex.
answers question: http://stackoverflow.com/q/25103026

http://stackoverflow.com/q/25200664
upvote count: 1
answer count: 1
favorite count: 0
tagged with: thread-local
has title: Thread Local - What am I doing wrong?
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25200751
tagged with: servlets
tagged with: httprequest
type: Question
has body: [IMG]http://i60.tinypic.com/121bww0.jpg[/IMG] (Request to a high rep user, please link the image, it would support the question.) Hi, The image depicts the web-app flow as I understand it. The browser sends a request to the spring dispatcher servlet. The servlet spawns a new thread per request(I am assuming it does that by default. I don't know how that is controlled.) The code is as following: public class Result{ private List&lt;String&gt; response = new ArrayList&lt;String&gt;(); public setResponse(List&lt;String&gt; list){ this.response = list; } public list&lt;String&gt; getResponse(){ return response ; } } public class ResponseUtil { private static final ThreadLocal&lt;Result&gt; responseObject = new InheritableThreadLocal&lt;Result&gt;(); public static void initialize(){ if(responseObject.get() == null){ Result result= new Result(); result.setResponse(new ArrayList&lt;String&gt;()); responseObject.set(result); } } public static void addMessage(String message){ List&lt;String&gt; messages = responseObject.get().getResponse(); messages.add(message); } public static Response getResponse(){ return responseObject.get(); } } @Component public class OnboardingEndPointImpl { public Result processOnBoardingFile() { ResponseUtil.initialize(); ResponseUtil.addMessage("a"); return ResponseUtil.getResponse(); } } On sending two rest calls, the output is "a", "a". the string is getting appending to the same list despite it being a thread local. My understanding is that, each http request(rest call) spawns a new thread. Each call starts by calling the initialize() method. Since each request is a new Thread, the threadLocal must be separate for each http request, but practically I am the threads are writing to the same list. So all the messages are getting added to the same list. This behaviour can only happen if the both the calls are the same thread. Thanks
downvote count: 0
has answer: http://stackoverflow.com/a/25200751

http://stackoverflow.com/q/25110419
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39078698
has comment: http://stackoverflow.com/comment/39078681
has comment: http://stackoverflow.com/comment/39078116
tagged with: java
tagged with: mysql
tagged with: prepared-statement
type: Question
has title: MySQL prepared statement in Java not returning a value
has answer: http://stackoverflow.com/a/25110718
answer count: 3
has comment: http://stackoverflow.com/comment/39078548
has answer: http://stackoverflow.com/a/25110811
has answer: http://stackoverflow.com/a/25111081
has body: I have a web service method that executes a prepared statement against a MySQL database. When I run this statement in MySQL I get a returned value: SELECT first_name FROM lytthouse_airlines.passenger WHERE passenger_id = 1 ; but when I run this prepared statement in my java class, it doesn't work: PreparedStatement getName = connection.prepareStatement( "SELECT first_name " + " FROM lytthouse_airlines.passenger " + " WHERE passenger_id = ? " ); getName.setInt(1, passengerId); rs = getName.executeQuery(); returnValue = "After executing query"; if (rs.next()) { returnValue = "inside rs.next"; returnValue = rs.getString("first_name"); } When I test this what I get in the returnValue contains "After executing query"; which would imply that there is no ResultSet (rs) returned and therefore not getting into the if (rs.next()) logic. Anyone have any clue what's wrong? New Content After Guo's response I changed the code a bit so I could see the value of passengerId. When I run a Test of the web service I get this very interesting result. Method parameter(s) Type Value int 1 Method returned java.lang.String : "After executing query, with a passengerId of 0" I have double-checked and I am not changing the value of passengerId anywhere in the method before it gets to they query. Another new comment I think the problem has nothing to do with the prepared statement it seems to have to do with the method itself. I change the very beginning of the method to look like this @WebMethod(operationName = "getPassengerName") public String getPassengerName(@WebParam(name = "passengerId ") int passengerId) { //MySQL elements Connection connection; ResultSet rs = null; String returnValue = "start method with passengerId having a value of: " + passengerId; and when I run the test I get this: getPassengerName Method invocation Method parameter(s) Type Value int 1 Method returned java.lang.String : "start method with passengerId having a value of: 0" I think this calls for a new question. I wi…

http://stackoverflow.com/a/25216913
downvote count: 1
score: -1
has body: If you wish to call static method of another class then you have to write class name while calling static method You have to use root.dir(1);
upvote count: 0
answers question: http://stackoverflow.com/q/25216867
type: Answer
has comment: http://stackoverflow.com/comment/39276280

http://stackoverflow.com/q/25104400
has answer: http://stackoverflow.com/a/25104446
tagged with: angularjs
has body: We are using AngularJS to do like/unlike behavior for our app. Code for HTML: Like Code for the controller: myApp.controller("newsFeedCtrl", function ($scope, $http) { console.log("inside newsFeedCtrl"); $scope.post() = function() { console.log("posting"); } $scope.likePost = function(postId) { console.log("liking post"); } }); The problem is, when we click on like, it also calls post() function, that should not be happening. Are we missing anything here?
accepted answer: http://stackoverflow.com/a/25104603
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39066474
downvote count: 1
has comment: http://stackoverflow.com/comment/39066303
type: Question
tagged with: java
score: -1
has title: Why using anchor's ng-click is also calling a post()?
has answer: http://stackoverflow.com/a/25104603
answer count: 2
upvote count: 0
tagged with: javascript
has comment: http://stackoverflow.com/comment/39066355
favorite count: 0
possible better answer: http://stackoverflow.com/a/25104446

http://stackoverflow.com/comment/39011948
type: QuestionComment
score: 0
has text: @AlexandreSantos how would I deal then with my CI implementation? (I am using Travis CI + automatic deployment when I create tagged commit). Each submodule is also in a separate Git repo, in this case I would need to put them all together in one repo otherwise I lose the advantage of CI and CD approaches.
comment on: http://stackoverflow.com/q/25075154
type: Comment

http://stackoverflow.com/comment/123437504
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25163132
has text: This should be the answer, but with the non-standard statement removed
type: AnswerComment

io
tags question: http://stackoverflow.com/q/25139959
tags question: http://stackoverflow.com/q/25175882
tags question: http://stackoverflow.com/q/25201409
tag name: io
tags question: http://stackoverflow.com/q/25074108
tags question: http://stackoverflow.com/q/25224604
tags question: http://stackoverflow.com/q/25149228
tags question: http://stackoverflow.com/q/25117313
tags question: http://stackoverflow.com/q/25070390
tags question: http://stackoverflow.com/q/25125798
tags question: http://stackoverflow.com/q/25099593
type: Tag
tags question: http://stackoverflow.com/q/25223562
tags question: http://stackoverflow.com/q/25110829
tags question: http://stackoverflow.com/q/25113572
tags question: http://stackoverflow.com/q/25207667
tags question: http://stackoverflow.com/q/25113274
tags question: http://stackoverflow.com/q/25187319
tags question: http://stackoverflow.com/q/25223599
tags question: http://stackoverflow.com/q/25100813
tags question: http://stackoverflow.com/q/25110538
tags question: http://stackoverflow.com/q/25230086
tags question: http://stackoverflow.com/q/25100852
tags question: http://stackoverflow.com/q/25100955
tags question: http://stackoverflow.com/q/25111054

http://stackoverflow.com/comment/39038598
comment on: http://stackoverflow.com/a/25087117
score: 0
type: AnswerComment
type: Comment
has text: It doesn't precisely produce the ciphertext for that plaintext, so this answer is plain wrong (for ECB and CBC mode of operation anyway).

http://stackoverflow.com/q/25175488
has comment: http://stackoverflow.com/comment/39200191
has answer: http://stackoverflow.com/a/25175870
has comment: http://stackoverflow.com/comment/39198747
has comment: http://stackoverflow.com/comment/39199186
has comment: http://stackoverflow.com/comment/39199061
has comment: http://stackoverflow.com/comment/39200273
has comment: http://stackoverflow.com/comment/39199373
has title: How to replace a Date that I add to an ArrayList
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25176712
has body: ArrayList member = new ArrayList(); member.add(new Member("V0001","Amy","0000-0000-0000","012-3456789","01-01-2014","01-01- 2015")); private String memberId=V0001; private String memberName=Amy; private String icNo = 0000-0000-0000; private String hpNo = 012-3456789; private String joiningDate = 01-01-2014; private String expiredDate = 01-01-2015; System.out.printf("\nEnter New Expired Date: "); String expiredDate =inputS12.nextLine(); member.get(inputS12).set(6,"expiredDate"); // This is the problem The problem now is, I can enter the new expired date which is ("01-01-2016") that I want, but the new expired date did not change to 01-01-2016, it still remains 01-01-2015. Can anyone help me solve this problem?
has comment: http://stackoverflow.com/comment/39198695
type: Question
possible better answer: http://stackoverflow.com/a/25175870
has answer: http://stackoverflow.com/a/25176712
has answer: http://stackoverflow.com/a/25177095
tagged with: java
has comment: http://stackoverflow.com/comment/39200551
tagged with: date
has comment: http://stackoverflow.com/comment/39199576
score: 0
answer count: 3
tagged with: arrays

http://stackoverflow.com/comment/39205442
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25179032
has text: Yeah it seems like it is creating them in the current working directory.
score: 0

http://stackoverflow.com/q/25196867
tagged with: servlet-filters
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25197006
tagged with: jakarta-ee
upvote count: 12
type: AnsweredQuestion
has title: How filter chain invocation works?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25197006
score: 12
type: Question
linked to: http://stackoverflow.com/q/2057607
has body: I am trying to understand filter chaining.As defined in this question All filters are chained (in the order of their definition in web.xml). The chain.doFilter() is proceeding to the next element in the chain. The last element of the chain is the target resource/servlet. I am interested to know behind the scene in container that how container handles filter chaining.Can someone explain that how Filter chaining is handled inside container?

http://stackoverflow.com/q/25189208
has title: selenium upload file java ChromeDriver/FirefoxDriver
type: Question
has body: I'm trying to automate a test that uploads a picture. I can add text to the 'Title' box, but when I enter the location of the file, I can successfully enter the text, but the website tells me that I have not uploaded a valid .jpg file. When I do the test manually, I can't enter the text, but I can browse for the file and it uploads successfully. Here is my code: driver.findElement(By.xpath("//input[@id='FakeInputName2']")).sendKeys("C:\\Users\\MyUsername\\Pictures\\Lighthouse.jpg"); Here is what the HTML code looks like: Image: label label I also tried the Runtime.getRuntime() thing that other answers to similar questions suggested. That didn't work at all. Can anyone help? Here is the console output and stack trace (To clarify (MyClass line 114 is where the line String filePath = url.getFile(); goes): Creating Chrome webdriver... Starting ChromeDriver (v2.8.241075) on port 14489 Process took 2 seconds. java.lang.NullPointerException at builderselenium.MyClass.runUseCase(MyClass.java:114) at builderselenium.UseCase.run(UseCase.java:104) at builderselenium.TestDriver.runUseCase(TestDriver.java:165) at builderselenium.MyGUI.runUseCase(MyGUI.java:410) at builderselenium.MyGUI.actionPerformed(MyGUI.java:299) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6527) at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) at java.awt.Component.processEvent(Component.java:6292) at java.awt.Container.processEvent(Container.java:2234) at java.awt.Component.dispatchEventImpl(Component.java:4883) at java.awt.Container.dispatchEventImpl(Container.java:2292) at java.awt.…
accepted answer: http://stackoverflow.com/a/25203606
score: 0
answer count: 1
tagged with: selenium-chromedriver
type: AnsweredQuestion
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/25203606

http://stackoverflow.com/q/25217996
has comment: http://stackoverflow.com/comment/39278360
has comment: http://stackoverflow.com/comment/39286988
favorite count: 0
has body: I have a huge loop that I wanted to split up into 4 threads. I've done so using a little bit noobish method(or maybe not?) and split up the counter of the for loops into 4 intervals, created a new Printwriter, and CrucibleOptimizer for each thread so that there are no conflicts, like this: public static void main(String[] args) { Runnable run1 = new Runnable() { @Override public void run() { PrintWriter writer1; try { writer1 = new PrintWriter("test_result1.txt"); CrucibleOptimizer optimizer1 = new CrucibleOptimizer(); int[] loop1boundries = new int[]{1, 7}; opt(optimizer1, writer1, loop1boundries[0], loop1boundries[1]); } catch (FileNotFoundException e) { System.out.println("File not found"); e.printStackTrace(); } } }; Runnable run2 = new Runnable() { @Override public void run() { PrintWriter writer2; try { writer2 = new PrintWriter("test_result2.txt"); CrucibleOptimizer optimizer2 = new CrucibleOptimizer(); int[] loop2boundries = new int[]{8, 14}; opt(optimizer2, writer2, loop2boundries[0], loop2boundries[1]); } catch (FileNotFoundException e) { System.out.println("File not found"); e.printStackTrace(); } } }; Runnable run3 = new Runnable() { @Override public void run() { PrintWriter writer3; try { writer3 = new PrintWriter("test_result3.txt"); CrucibleOptimizer optimizer3 = new CrucibleOptimizer(); int[] loop3boundries = new int[]{15, 22}; opt(optimizer3, writer3, loop3boundries[0], loop3boundries[1]); } catch (FileNotFoundException e) { System.out.println("File not found"); e.printStackTrace(); } } }; Runnable run4 = new Runnable() { @Override public void run() { PrintWriter writer4; try { writer4 = new PrintWriter("test_result4.txt"); CrucibleOptimizer optimizer4 = new CrucibleOptimizer(); int[] loop4boundries = new int[]{23, 30}; opt(optimizer4, writer4, loop4boundries[0], loop4boundries[1]); } catch (FileNotFoundException e) { System.out.println("File not found"); e.printStackTrace(); } } }; Thread[] threads = new Thread[]{new Thread(run1), new Thread(run2),…
has comment: http://stackoverflow.com/comment/39278318
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39278302
accepted answer: http://stackoverflow.com/a/25218048
score: 1
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/25218037
tagged with: loops
upvote count: 1
has title: Is a static method containing loops thread-safe?
has answer: http://stackoverflow.com/a/25218037
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/39284704
answer count: 2
has comment: http://stackoverflow.com/comment/39283815
has answer: http://stackoverflow.com/a/25218048
downvote count: 0

http://stackoverflow.com/q/25097928
has comment: http://stackoverflow.com/comment/39054594
has comment: http://stackoverflow.com/comment/90240796
has title: currentThread() is always the currentThread()?
has comment: http://stackoverflow.com/comment/39054650
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/25099502
has answer: http://stackoverflow.com/a/25097936
tagged with: java
has body: In Java Thread, the method currentThread() returns the memory reference of the "currently executing thread". "Currently executing thread" here is the thread that invoked this currentThread(). I'm wondering whether there is an exceptional case to this, i.e. whether currentThread() returns some other thread than the one invoked it. Eg.: suppose, in the main method, i'm invoking Thread.currentThread().toString() to see it-- and it returns the toString() representation of the main thread. The Q is, can there be a case that it returns some other thread that is running in memory? I can't think of one. currentThread() here is executing on main thread-- thus whenever it is up &amp; running, it is the main thread space it is executing on. I don't see how else it could be unless there are some slips. currentThread() is native-- can' see these in the code.
type: Question
downvote count: 4
has answer: http://stackoverflow.com/a/25097979
score: -2
favorite count: 0
has comment: http://stackoverflow.com/comment/64417497
answer count: 3

http://stackoverflow.com/a/25213817
type: Answer
has comment: http://stackoverflow.com/comment/39270871
has comment: http://stackoverflow.com/comment/39271049
answers question: http://stackoverflow.com/q/25213636
has comment: http://stackoverflow.com/comment/39270951
has comment: http://stackoverflow.com/comment/39270509
has comment: http://stackoverflow.com/comment/39270656
downvote count: 1
has comment: http://stackoverflow.com/comment/39270550
has comment: http://stackoverflow.com/comment/39270452
has comment: http://stackoverflow.com/comment/39270696
score: 0
has body: The more you use static, the further you drift away from object orientation. Static is not subject to polymorphisim, and rarely does using a state promote data hiding (as all the instances tend to cross-communicate when going through static variables). In addition, many (not all) details of arrays are at odds with object oriented programming too, as arrays are holders of data without the possibility of combining code and data. As a result, arrays lack behavior and delegate the responsibility of data correctness to other non-related pieces of code. For an object oriented solution: public class RandomIntList { private int[] values; public RandomIntList(int size) { values = new int[size]; Random random = new Random(); for (int i = 0; i &lt; size; i++) { values[i] = random.nextInt(); } } } Note that now you can cleanly identify which objects are RandomIntLists and which are not, which is not really possible with int[]s. Of course, if you add something like public int[] asArray() { return values; } You let the cat out of the bag, because other code could modify the internal state of the class without going through the class's boundary (aka interface or methods). So to keep your classes object oriented, you sometimes need to copy (when the data can be mutated). public int[] asArray() { return Arrays.copyOf(values, values.size); }
upvote count: 1
has comment: http://stackoverflow.com/comment/39270845

http://stackoverflow.com/comment/39232733
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25193686
has text: If you use MMM. The date input must be "05May1998". Not "05051988"
type: QuestionComment

http://stackoverflow.com/q/25087895
upvote count: 1
has body: I have been running jobs on a Hadoop cluster version 0.20.2 and everything was going fine until recently for no reason and without any errors the last couple of percent of map tasks take much longer than the rest of the job, where the last 2% takes 30 seconds and the rest of the job is less than 30 seconds. This has been happening to all jobs now regardless of input size here is an example with input data of 4GB, before this problem the entire job from submission to completion was taking 37 seconds but now takes over a minute: 14/08/01 20:57:12 INFO input.FileInputFormat: Total input paths to process : 1 14/08/01 20:57:12 INFO mapred.JobClient: Running job: job_201407301409_0033 14/08/01 20:57:13 INFO mapred.JobClient: map 0% reduce 0% 14/08/01 20:57:33 INFO mapred.JobClient: map 1% reduce 0% 14/08/01 20:57:34 INFO mapred.JobClient: map 7% reduce 0% 14/08/01 20:57:35 INFO mapred.JobClient: map 13% reduce 0% 14/08/01 20:57:36 INFO mapred.JobClient: map 21% reduce 0% 14/08/01 20:57:37 INFO mapred.JobClient: map 33% reduce 0% 14/08/01 20:57:38 INFO mapred.JobClient: map 39% reduce 0% 14/08/01 20:57:39 INFO mapred.JobClient: map 45% reduce 0% 14/08/01 20:57:40 INFO mapred.JobClient: map 54% reduce 0% 14/08/01 20:57:41 INFO mapred.JobClient: map 60% reduce 0% 14/08/01 20:57:42 INFO mapred.JobClient: map 65% reduce 0% 14/08/01 20:57:43 INFO mapred.JobClient: map 72% reduce 0% 14/08/01 20:57:44 INFO mapred.JobClient: map 77% reduce 0% 14/08/01 20:57:45 INFO mapred.JobClient: map 79% reduce 0% 14/08/01 20:57:46 INFO mapred.JobClient: map 86% reduce 0% 14/08/01 20:57:47 INFO mapred.JobClient: map 87% reduce 0% 14/08/01 20:57:48 INFO mapred.JobClient: map 88% reduce 0% 14/08/01 20:57:49 INFO mapred.JobClient: map 90% reduce 0% 14/08/01 20:57:51 INFO mapred.JobClient: map 92% reduce 0% 14/08/01 20:57:52 INFO mapred.JobClient: map 93% reduce 0% 14/08/01 20:57:53 INFO mapred.JobClient: map 94% reduce 0% 14/08/01 20:57:54 INFO mapred.JobClient: map 95% reduce 0% 14/08/01 20:57:55…
score: 1
tagged with: java
type: Question
tagged with: hadoop
has title: Hadoop Job gets really slow at the last couple of percentage?
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25103240
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25178843
tagged with: osgi
has title: OSGi - Adding bundle's classes to specific classloader
has comment: http://stackoverflow.com/comment/39205388
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25179365
has body: I have bundle A.jar installed in OSGi and I can get this bundle using BundleContext Bundle bundleA = context.getBundle() And a specific classloader B How can I adding all class from bundleA to my classloader B
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25182583
score: 0
tagged with: groovy

http://stackoverflow.com/a/25188801
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25169957
score: 1
upvote count: 1
has body: I followed @Kenster's recommendation and ended up doing something like below. session = jsch.getSession(user, agent, port); session.connect(); channel = session.openChannel("sftp"); channel.connect(); ((ChannelSftp) channel).put(new ByteArrayInputStream(args[0].getBytes()), args[1]);
accepted answer of: http://stackoverflow.com/q/25169957
type: AcceptedAnswer

http://stackoverflow.com/comment/39125810
has text: I am working on project in final year so it is important for me.
comment on: http://stackoverflow.com/q/25131922
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25101954
answers question: http://stackoverflow.com/q/25101871
type: Answer
has body: The answers recommending shuffle show the right way, as it is elegant and fast. Just for the sake of completeness: you can also slightly alter your code. Add any random number found to an array. Then check the next random number if it is already in the array. If yes, drop the number and get a new one. Do this until the array is filled with 13 numbers. Like this: List&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(); Random r = new Random(); while (numbers.size() &lt; 14) { randomNum = r.nextInt(13); if (!numbers.contains(randomNum)) { numbers.add(randomNum); } }
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/25138314
accepted answer: http://stackoverflow.com/a/25157097
has answer: http://stackoverflow.com/a/59509581
has body: I am trying to develop an application in libGDX for iOS. In my Java class I have written this line private Texture texture = new Texture(Gdx.files.internal("data/folder_name_1/folder_name_2/abcd.png")); and my robovm.xml looks like this- Info.plist.xml ../android/assets ** true data When I try to run the code on iOS simulator it runs fine. But when I try to run it on an iOS device i.e. iPhone. It generates an error which looks like this- com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: data/folder_name_1/folder_name_2/abcd.png Can someone help me with this ? Note:- in my iOS project in the data folder, there is another 'data' folder in which there is another folder named 'folder_name_1', then inside it I have 'folder_name_2' folder and inside it I have my png file 'abcd.png'.
has comment: http://stackoverflow.com/comment/39131284
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/37289177
tagged with: java
has answer: http://stackoverflow.com/a/37289177
type: Question
tagged with: iphone
tagged with: libgdx
tagged with: ios
has answer: http://stackoverflow.com/a/25157097
score: 0
answer count: 3
has title: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: - Error
tagged with: robovm

http://stackoverflow.com/a/25208127
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25199571
upvote count: 7
answers question: http://stackoverflow.com/q/25199571
score: 7
has body: Take a look at Project Lombok which has a @Delegate annotation which does exactly what you want. @Delegate documentation I think you would be able to do this: import lombok.Delegate; class Wrapper { //the types field in the annotation says //to only auto generate deleagate methods //for only the public methods in the ObjectToWrap class //and not any parent classes if ObjectToWrap extended something @Delegate(types = ObjectToWrap.class) private ObjectToWrap obj; }
type: AcceptedAnswer

http://stackoverflow.com/comment/39105696
score: 0
has text: Dear Arcy, thank you for your reply. I have not run the programme yet. Let's start from here, I am using Eclipse. I have added the 2013 library to the referenced library. I downloaded a 2009 code which I needed to use. But the issue was this code needed eleven classes from 2009 as a source to import, and they do not exist in the 2013 library. Fortunately, I found those classes. But I do not know how to add these eleven classes to the current library.
comment on: http://stackoverflow.com/a/25125007
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25093870
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39056943
type: Answer
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/39058636
accepted answer of: http://stackoverflow.com/q/25092855
answers question: http://stackoverflow.com/q/25092855
has body: I do not know Spring, but AspectJ LTW. As the weaver seems to be the same, I guess you also configure it the same way via META-INF/aop.xml (or META-INF/aop-ajc.xml, respectively). Maybe you already have such a config file without knowing about it and it says something like &lt;weaver options="-verbose -showWeaveInfo"&gt; If so, just remove the additional options. The one causing what you have quoted is -verbose. See also AspectJ LTW documentation.

http://stackoverflow.com/comment/39087784
score: 0
has text: @Cains If the variable is an attribute of a class, you can get the declared type by using reflection. For local variables you don't have the language tools to do that.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25115187

http://stackoverflow.com/a/25208700
answers question: http://stackoverflow.com/q/25208461
has body: You have this if statement: if(candidatefour.contains("go")){ //z by thirds, point .33 if(z &lt; 0.33){ } else if(z &lt; 0.66 &amp;&amp; z &gt; 0.33){ } else if(z &lt; 1.00 &amp;&amp; z &gt; 0.66){ } else{ // lots of code } // close all open blocks, method, class. You associated the last else with the wrong if.
accepted answer of: http://stackoverflow.com/q/25208461
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/39261306

http://stackoverflow.com/q/25108315
tagged with: java
score: -1
has title: How to retroactively make a java app fit different screens
upvote count: 0
answer count: 1
tagged with: resize
favorite count: 0
has answer: http://stackoverflow.com/a/25108353
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39073835
tagged with: screen
downvote count: 1
type: Question
has body: I have a fairly large (6000 lines) java application with over 40 buttons etc. and fixed window size. This is creating problem for people who wants to use it for some it is too small for others it is too large with no scrolling! How can I retroactively make it fit different screens? Thanks

http://stackoverflow.com/comment/39174589
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25154118
has text: yeah i am asking only for email...isn't it possible with @pattern annotation as it is my dependency

http://stackoverflow.com/comment/39180569
comment on: http://stackoverflow.com/a/25156540
has text: Yes, ASCII consists of just 128 characters, including latin letters, numbers, punctuation and control codes, but no Chinese. ASCII only goes up to 127, so there is no “character which has a code of 233” in this encoding. Chinese has many thousands of characters so there is no way it can be communicated using a single-byte encoding (max 255). Encodings that support Chinese, like UTF-8 and GBK/cp936, use multiple byte codes to signal a single character. Most assign the codes 0-127 to the same characters as ASCII, then use multiple bytes with the lead in the range 128-255 to encode others.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39237571
type: QuestionComment
comment on: http://stackoverflow.com/q/25195988
has text: @Haresh holy smokes - it no longer looks like a button, but it clicks! How did you know this, and is there any way to keep the button style?
score: 0
type: Comment

http://stackoverflow.com/a/25081208
answers question: http://stackoverflow.com/q/25080951
has comment: http://stackoverflow.com/comment/39023505
upvote count: 11
score: 11
has comment: http://stackoverflow.com/comment/39023422
has body: when I select the row on the table, and I want method to only set color at specific column Try with overridden prepareRenderer() method as suggested by @mKorbel. sample code: Object[] columnNames = { "A", "B", "C", "D" }; Object[][] data = { { "abc", new Double(850.503), 53, true }, { "lmn", new Double(36.23254), 6, false }, { "pqr", new Double(8.3), 7, false }, { "xyz", new Double(246.0943), 23, true } }; JTable table = new JTable(data, columnNames) { @Override public Component prepareRenderer(TableCellRenderer renderer, int row, int col) { Component comp = super.prepareRenderer(renderer, row, col); Object value = getModel().getValueAt(row, col); if (getSelectedRow() == row) { if (value.equals(false)) { comp.setBackground(Color.red); } else if (value.equals(true)) { comp.setBackground(Color.green); } else { comp.setBackground(Color.white); } } else { comp.setBackground(Color.white); } return comp; } }; When selected first row: When selected second row. Read more... EDIT As per your last comment Is it possible to change color with out clicking (selecting) row on the table? Yes just remove the check of selected row. Object value = getModel().getValueAt(row, col); if (value.equals(false)) { comp.setBackground(Color.red); } else if (value.equals(true)) { comp.setBackground(Color.green); } else { comp.setBackground(Color.white); }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/68897079
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25080951
has comment: http://stackoverflow.com/comment/39023085
has comment: http://stackoverflow.com/comment/39025117
type: Answer

http://stackoverflow.com/a/25109127
upvote count: 1
has body: Call setVisible of the JFrame last, after you have constructed the UI, also, call pack just before you call setVisible, this way you're gurneteed to get a better size calculation as it is based the content. Beware that KeyListener is well know for only responding to key strokes when the component it is registered to is focusable AND has focus, it normally better to use the key bindings API. Also, adding a MouseListener to the window directly could be ignored if any of the components higher in the component hierarchy also have MouseListeners
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25109068

http://stackoverflow.com/a/25070422
type: Answer
score: 3
downvote count: 0
has body: There is no base64 in your samples. I would recommend you use a Office format lib (like POI) to extract text/data from Office documents.
has comment: http://stackoverflow.com/comment/39004049
has comment: http://stackoverflow.com/comment/39003529
upvote count: 3
answers question: http://stackoverflow.com/q/25070402
has comment: http://stackoverflow.com/comment/39003879

http://stackoverflow.com/a/25237028
has body: EDIT yep ContextResolverFactory does caching for context resolvers... I got this working in different way, Hope this helps - Create XMLAdapter for Date as spring bean import java.util.Date; import javax.inject.Inject; import javax.inject.Named; import javax.xml.bind.annotation.adapters.XmlAdapter; import org.apache.commons.lang3.time.DateFormatUtils; @Named public class RequestBasedXMLAdapter extends XmlAdapter&lt;String, Date&gt; { @Inject private RequestData requestData; @Override public String marshal(Date value) throws Exception { return DateFormatUtils.format(value, requestData.getMyDateFormat()); } @Override public Date unmarshal(String value) throws Exception { // i am not interested in incoming date return new Date(); } } Create request scoped bean import javax.inject.Named; import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.ScopedProxyMode; @Named @Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS) public class RequestData { private String myDateFormat; public String getMyDateFormat() { return myDateFormat; } public void setMyDateFormat(String myQueryParam) { this.myDateFormat = myQueryParam; } } Create context resolver for JAXBContext Inject spring application context Get your XMLAdapter defined as spring bean from context return custom jaxbcontext (implemented as decorator) by modifying below methods public JAXBMarshaller createMarshaller() throws JAXBException { JAXBMarshaller marshaller = delegate.createMarshaller(); marshaller.setAdapter(adapter); return marshaller; } public JAXBUnmarshaller createUnmarshaller() throws JAXBException { JAXBUnmarshaller unmarshaller = delegate.createUnmarshaller(); unmarshaller.setAdapter(adapter); return unmarshaller; } Now in your Resource class (where you have defined your GET/POST methods) Inject request scoped bean RequestData Set dateformat from query/header param in RequestData Annotate your Date field in Response class as @XmlJavaTypeAdapter(RequestB…
type: Answer
has comment: http://stackoverflow.com/comment/39785159
score: 0
answers question: http://stackoverflow.com/q/25122464

http://stackoverflow.com/a/25123241
accepted answer of: http://stackoverflow.com/q/25121743
answers question: http://stackoverflow.com/q/25121743
score: 0
type: AcceptedAnswer
has body: jitain sharma's idea of solution of cancelling the asynctask did not work(when force quitting the app, its not called). So, in the end, I used sharedPreferences to 'mark' the end of file download in my AsyncTask's onPostExecute() method.I am just checking for the result, if all is fine(then string will be null), I am adding a SharedPreference with the file name with the value "DONE". Before executing the AsyncTask, I am checking if file exists AND if the sharedPreference exists. public class DownloadTask extends AsyncTask&lt;String, Integer, String&gt; { ProgressDialog mProgressDialog; private Context context; private PowerManager.WakeLock mWakeLock; String fileName=null; public DownloadTask(Context context,ProgressDialog Dialog) { this.context = context; this.mProgressDialog=Dialog; } @Override protected String doInBackground(String... sUrl) { InputStream input = null; OutputStream output = null; HttpURLConnection connection = null; try { URL url = new URL(sUrl[0]); connection = (HttpURLConnection) url.openConnection(); connection.setReadTimeout(3000); connection.setConnectTimeout(5000); connection.connect(); if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) { return "Server returned HTTP " + connection.getResponseCode() + " " + connection.getResponseMessage(); } String raw = connection.getHeaderField("Content-Disposition"); if(raw != null &amp;&amp; raw.indexOf("=") != -1) { fileName = raw.split("=")[1]; fileName=fileName.split(";")[0]; fileName=fileName.substring(1, fileName.length()-1); } else { } File f=new File(context.getFilesDir()+"/"+fileName); if(!f.exists()) {Log.d("TAG","DOES NOT EXIST , downloading"); int fileLength = connection.getContentLength(); input = connection.getInputStream(); Log.d("Tag", raw); Log.d("Tag",fileName); output = new FileOutputStream(context.getFilesDir()+"/"+fileName); byte data[] = new byte[4096]; long total = 0; int count; while ((count = input.read(data)) != -1) { if (isCancelled()) { input.close(); File check =new…
type: Answer

http://stackoverflow.com/a/25157621
has comment: http://stackoverflow.com/comment/39167811
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39168954
has body: The problem here is that can't download the corpus 20newsgroups with the curl command because it doesn't find in the operating system, look at the following line error : bin/classify-20newsgroups.sh: line 68: curl: command not found.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25155795
has comment: http://stackoverflow.com/comment/39166934
answers question: http://stackoverflow.com/q/25155795
type: Answer

http://stackoverflow.com/comment/39267293
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25211335
has text: I see this error: `Artifact Sample-Debug-IntelliJ:war exploded: Error during artifact deployment. See server log for details.` Did you check the logs?
type: Comment

http://stackoverflow.com/comment/39074929
has text: Then you may want to update your question with that information, especially the `NumberFormatException`, since "no output appears to me nor exception" is no longer true.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25108655

http://stackoverflow.com/a/25174722
has comment: http://stackoverflow.com/comment/39197830
answers question: http://stackoverflow.com/q/25174440
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25174440
has comment: http://stackoverflow.com/comment/39197811
type: Answer
upvote count: 3
has body: How can Spring AOP be configured to get access to the request and response objects created by the container to redirect the user? You won't be able to get the same exact behavior as servlet Filters. A Filter operates around the target Servlet by passing in the ServletRequest and ServletResponse objects. In that sense, you can get similar behavior since AOP advice can operate around the joinpoint and intercept arguments that get passed around. However, the AOP advice can't magically have access to the request and response. It either needs to advise a method that receives them or get them from some ThreadLocal or other container. For example, Spring has RequestContextHolder which you can use to get the HttpServletRequest. But it doesn't have anything to give you the HttpServletResponse (not technically true, but it's not reliable). You could write something similar that does. Once the advice has access to the objects, it can simply invoke HttpServletResponse#sendRedirect(..) or forward() or whatever.
score: 3

http://stackoverflow.com/comment/39079540
has text: Compilation Test: Passed.Number of Test Case Groups Passed:1/1 The Content of Input File for Testing: environment environmental environmentally_friendly peace peaceful peacefully Test Case Passed: (4/4) Given the user input is environmentally_friendly The expected result is true.Your code returns true.Passed Given the user input ispeace The expected result is true.Your code returns true.Passed Given the user input isThe_object_is_created.The expected result is false.Your code returns false.Passed Given the user input isenvironmentally The expected result is false.Your code returns false.Passed
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25108224
type: Comment

http://stackoverflow.com/comment/39102056
score: 1
comment on: http://stackoverflow.com/a/25111270
type: AnswerComment
has text: @user3904781 If this answer solves your problem, you should click the check mark to mark the question as resolved.
type: Comment

http://stackoverflow.com/comment/39270265
type: Comment
type: QuestionComment
has text: If this is a graphical program, you're going to have to learn to use threads.
comment on: http://stackoverflow.com/q/25211966
score: 0

http://stackoverflow.com/comment/39282675
type: AnswerComment
has text: then what for if(count==3) ? and yes I tried as count=1 initialization
comment on: http://stackoverflow.com/a/25220304
type: Comment
score: 0

http://stackoverflow.com/comment/39213130
has text: Yes, both of them exist. It works in my browser (chrome).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25183405
score: 0

http://stackoverflow.com/q/25202134
has comment: http://stackoverflow.com/comment/39258821
tagged with: elasticsearch
has comment: http://stackoverflow.com/comment/39302476
tagged with: java
has title: ElasticSearch: is there a way to get new documents inserted in all indexes after a previous SearchRequest?
tagged with: observer-pattern
has body: I have multiple ElasticSearch indices sharded over multiple machines into which I ingest logs using logstash. I expose the data via a REST API. The API layer searches for several terms (using the ElasticSearch Java API) and presents the user with the results. Now, if the user is looking at the results in a browser, there may be new logs ingested which match the same queries and filters that the user is now looking at. I would like the API layer to be notified that there are new items which match the query. So, if I get the same API request, I can send back only new data (the delta) or send a HTTP 304 "Not modified" response. I looked at the percolator API but this does not seem to do what I want - it appears to give the list of queries a given document that is about to be inserted will match. My requirements are these: The same user may want to check for new log messages after a few seconds or a few days. Multiple users may search for the same terms but they will be in different pages (I will implement pagination using the SearchRequestBuilder.setSize API.) So, the changed items will be different for different users as they are on different pages of the same output. Is there any way to do this in a scalable manner?
type: Question
accepted answer: http://stackoverflow.com/a/25236972
type: AnsweredQuestion
upvote count: 5
possible better answer: http://stackoverflow.com/a/46778946
has answer: http://stackoverflow.com/a/46778946
answer count: 2
score: 5
downvote count: 0
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/25236972

spring
tags question: http://stackoverflow.com/q/25209319
tags question: http://stackoverflow.com/q/25114755
tags question: http://stackoverflow.com/q/25091221
tags question: http://stackoverflow.com/q/25182540
tags question: http://stackoverflow.com/q/25105357
tags question: http://stackoverflow.com/q/25142607
tags question: http://stackoverflow.com/q/25071933
tags question: http://stackoverflow.com/q/25177864
tags question: http://stackoverflow.com/q/25208024
tags question: http://stackoverflow.com/q/25219683
tags question: http://stackoverflow.com/q/25197356
tags question: http://stackoverflow.com/q/25152109
tags question: http://stackoverflow.com/q/25097957
tags question: http://stackoverflow.com/q/25144017
tags question: http://stackoverflow.com/q/25142513
tags question: http://stackoverflow.com/q/25154039
tags question: http://stackoverflow.com/q/25165468
tags question: http://stackoverflow.com/q/25172331
tags question: http://stackoverflow.com/q/25113216
tags question: http://stackoverflow.com/q/25198944
tags question: http://stackoverflow.com/q/25165575
tags question: http://stackoverflow.com/q/25202211
tags question: http://stackoverflow.com/q/25152152
tags question: http://stackoverflow.com/q/25217504
tags question: http://stackoverflow.com/q/25125022
tags question: http://stackoverflow.com/q/25137467
tags question: http://stackoverflow.com/q/25166951
tags question: http://stackoverflow.com/q/25115546
tags question: http://stackoverflow.com/q/25073490
tags question: http://stackoverflow.com/q/25155222
tags question: http://stackoverflow.com/q/25109945
tags question: http://stackoverflow.com/q/25087630
tags question: http://stackoverflow.com/q/25085950
tags question: http://stackoverflow.com/q/25226314
tags question: http://stackoverflow.com/q/25181107
tags question: http://stackoverflow.com/q/25079724
tags question: http://stackoverflow.com/q/25075683
tags question: http://stackoverflow.com/q/25213963
tags question: http://stackoverflow.com/q/25141487
tags question: http://stackoverflow.com/q/25170163
tags question: http://stackoverflow.com/q/25119446
tags question: http://stackoverflow.com/q/25219061
tags question: http://stackoverflow.com/q/25085310
tags question: http://stackoverflow.com/q/25115883
tags question: http://stackoverflow.com/q/25082244
tags question: http://stackoverflow.com/q/25165507
tags question: http://stackoverflow.com/q/25171186
tags question: http://stackoverflow.com/q/25085141
tags question: http://stackoverflow.com/q/25080593
tags question: http://stackoverflow.com/q/25136346
tags question: http://stackoverflow.com/q/25089376
tags question: http://stackoverflow.com/q/25198249
tags question: http://stackoverflow.com/q/25172658
tags question: http://stackoverflow.com/q/25166410
tags question: http://stackoverflow.com/q/25135042
tags question: http://stackoverflow.com/q/25121392
tags question: http://stackoverflow.com/q/25178454
tags question: http://stackoverflow.com/q/25113554
tags question: http://stackoverflow.com/q/25118286
tags question: http://stackoverflow.com/q/25222341
type: Tag
tags question: http://stackoverflow.com/q/25205031
tags question: http://stackoverflow.com/q/25204725
tags question: http://stackoverflow.com/q/25174440
tags question: http://stackoverflow.com/q/25072491
tags question: http://stackoverflow.com/q/25124968
tags question: http://stackoverflow.com/q/25115290
tags question: http://stackoverflow.com/q/25151264
tags question: http://stackoverflow.com/q/25213027
tags question: http://stackoverflow.com/q/25205552
tags question: http://stackoverflow.com/q/25094851
tags question: http://stackoverflow.com/q/25091978
tags question: http://stackoverflow.com/q/25073675
tags question: http://stackoverflow.com/q/25077800
tags question: http://stackoverflow.com/q/25200511
tags question: http://stackoverflow.com/q/25092118
tags question: http://stackoverflow.com/q/25190140
tags question: http://stackoverflow.com/q/25148327
tags question: http://stackoverflow.com/q/25173542
tags question: http://stackoverflow.com/q/25180788

http://stackoverflow.com/comment/39271601
type: AnswerComment
has text: I apologize for the delay. Inside playVideoAtSelection(), I tried mPlayer = new YouTubePlayer(); however it is telling me that YouTubePlayer is abstract and cannot be instantiated. Also, I have the correct version for sure since the player worked when onInitializationSuccess was placed outside of onCreate. You can find the code I based off from here, if it helps. [YouTube Sample GITHUB](https://github.com/youtube/yt-android-player/blob/master/src/com/examples/youtubeapidemo/PlayerControlsDemoActivity.java)
type: Comment
comment on: http://stackoverflow.com/a/25213916
score: 0

http://stackoverflow.com/comment/39016805
type: QuestionComment
has text: @udalmik the value itself Time implements Comparable<Time>
score: 0
comment on: http://stackoverflow.com/q/25077543
type: Comment

http://stackoverflow.com/a/25214686
answers question: http://stackoverflow.com/q/25214663
score: 0
accepted answer of: http://stackoverflow.com/q/25214663
type: AcceptedAnswer
type: Answer
has body: EOFException just means you got to the end of the stream. It's normal. Your problem is that you're reading twice for every object written: once to get its class and again to get the object. You don't get the same object again, you get the next object, so you run out eventually. You need to store the result of readObject() in a variable, then test its class, then cast it appropriately.

http://stackoverflow.com/a/25116825
answers question: http://stackoverflow.com/q/25113363
upvote count: 1
downvote count: 0
has body: Add this code in your spring beans configuration file &lt;context:component-scan basePackage="Your base package name"/&gt; &lt;context:annotation-config/&gt;
type: Answer
score: 1

http://stackoverflow.com/comment/39285109
type: QuestionComment
comment on: http://stackoverflow.com/q/25220854
type: Comment
score: 0
has text: The line 73 is this: ruta = SAXXMLParser.parse(getAssets().open("linija109.xml")); there are my lat, long, name and address of markers that I am puting on the map.

http://stackoverflow.com/q/25072146
has comment: http://stackoverflow.com/comment/39240018
has answer: http://stackoverflow.com/a/70200996
has answer: http://stackoverflow.com/a/35208120
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
score: 6
upvote count: 6
tagged with: java
type: Question
answer count: 2
tagged with: xml-parsing
has body: I'm doing it in Java XML Parser, then I got this error when parsing an xml file... [Fatal Error] jira.xml:192:64: The content of elements must consist of well-formed character data or markup. org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup. at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(Unknown Source) at com.icomteq.ReadXMLFile.main(ReadXMLFile.java:20) Any clue what could be the problem? Thank you. Here is the code used -> http://s29.postimg.org/tjbzvsn3b/xmlreader.jpg Here is my jira.xml -> &lt;?xml version="1.0" ?&gt; &lt;DATA_RECORD&gt; &lt;DESCRIPTION&gt; &amp;lt;&lt; inside &amp;amp;&amp; the description tag &amp;lt;&lt; &lt;/DESCRIPTION&gt; &lt;/DATA_RECORD&gt; Temporary solution -> I figured out that XML Norms &lt; should not be in the xml, so I will use contents.toString().replaceAll("&amp;lt;&lt;", "&amp;lt;").replaceAll("&amp;amp;&amp;", "&amp;amp;")
downvote count: 0
has title: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup

http://stackoverflow.com/a/25204798
score: 1
has comment: http://stackoverflow.com/comment/39257535
answers question: http://stackoverflow.com/q/25204199
accepted answer of: http://stackoverflow.com/q/25204199
upvote count: 1
type: AcceptedAnswer
has body: What about this approach? The difference from you posted code is that you need to do all your custom drawing onto your BufferedImage. Then you draw just one thing onto the component: the BufferedImage. public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; BufferedImage imageBuffer = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB); Graphics imageG2 = imageBuffer.createGraphics(); // do custom painting onto imageG2... // save imageBuffer g2.drawImage(imageBuffer, 0, 0, this); // draw onto component }
type: Answer
downvote count: 0

http://stackoverflow.com/a/26100108
answers question: http://stackoverflow.com/q/25098307
type: Answer
has comment: http://stackoverflow.com/comment/41044480
has comment: http://stackoverflow.com/comment/93035350
has comment: http://stackoverflow.com/comment/95662053
upvote count: 9
has comment: http://stackoverflow.com/comment/40976814
score: 9
has comment: http://stackoverflow.com/comment/41044267
has comment: http://stackoverflow.com/comment/95684209
has comment: http://stackoverflow.com/comment/40974970
downvote count: 0
has body: The maven-achiver plugin documentation seems pretty clear that you cannot remove properties, only set them to blank as described in Alex Chernyshev's answer. In order to get more control over the MANIFEST.MF you should not use the maven-archiver plugin. One alternative would be to use the maven antrun plugin and the Ant Jar Task to build the Jar. In pom.xml: ... maven-antrun-plugin 1.7 package <include name="build"/> <attribute name="Manifest-Version:" value="1.0"/> run ... Another alternative is calling the Jar tool directly using the Maven exec plugin. I don't like recommending antrun, as I think it's a dirty hack, but it seems that maven-archiver does not meet your requirements. It might be worth raising a feature request for maven-archiver. EDIT: 2014-10-06 Raised Jira MSHARED-362 EDIT: 2018-06-18: Updated link to Jira and to Maven Exec plugin EDIT: 2019-01-14: Fix targeted for maven-archiver-3.4.0
has comment: http://stackoverflow.com/comment/41103985

http://stackoverflow.com/comment/39151416
type: Comment
has text: Be careful with the use of **contains**. It returns true if and only if the same object is there. Notice that you are creating different objects when adding them into the vectors (new Inty(0) and so...). I suggest. When you do two times **new Inty(0)** you are creating two different objects even when the content of the object stores a zero in both cases. If you try adding the same object when referring to the same number it will work properly.
comment on: http://stackoverflow.com/a/25149297
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39198124
has text: Are you sure you want to do this? **You could get into legal trouble** *for not showing any code*. :P
comment on: http://stackoverflow.com/q/25175168
score: 5
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39222005
has text: Ok, Do you try putting two Edittext in your XML One for your title, and another for the Error?
type: Comment
comment on: http://stackoverflow.com/a/25187836
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39236660
score: 1
has text: @alfasin Yes this is just what I needed. I could care less about getting the number for project euler. The whole reason is to learn through the process of creating it and push myself to figure it out. Thanks for saving the fun part of implementation for me :)
type: AnswerComment
comment on: http://stackoverflow.com/a/25195719
type: Comment

http://stackoverflow.com/comment/39136356
comment on: http://stackoverflow.com/a/25140868
type: Comment
score: 0
type: AnswerComment
has text: I would not recommend this, this will give you a less detailed feedback from the error. Rather use the Mockito verification.

http://stackoverflow.com/comment/39146387
score: 0
has text: @nexus searching a solution I found this video: https://www.youtube.com/watch?v=6hz630Oz2Q0 he use `@Embbedable` and after `@ElementCollection`, when he changed to collection a table was added, how he did this ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25143422

http://stackoverflow.com/q/25110085
has body: I have written a javafx app and build an jar file through the "build artifacts" function of Intellij. Now if I run the jar file in the output folder like this: java -jar IdeaProjects/Transclip/out/artifacts/Transclip/Transclip.jar everything works perfectly, but if I copy it somewhere else: cp IdeaProjects/Transclip/out/artifacts/Transclip/Transclip.jar .IdeaProjects/Transclip/out/artifacts/Transclip/Transclip.jar -&gt; ./Transclip.jar java -jar Transclip.jar Then I get a whole lot of errors: Exception in Application constructor java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:367) at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767) Caused by: java.lang.RuntimeException: Unable to construct Application instance: class sample.Main at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:884) at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56) at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.r…
has title: Jar file output from intellij can't be run outside its original location
type: UnansweredQuestion
tagged with: intellij-13
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25122179
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/39078925
answer count: 1
score: 0
tagged with: javafx-8

http://stackoverflow.com/q/25170115
tagged with: google-maps-api-2
has comment: http://stackoverflow.com/comment/39189586
score: 0
has comment: http://stackoverflow.com/comment/39189524
has title: Subclass of Android Google Maps API MapView being laggy
tagged with: android
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39189626
type: Question
tagged with: java
has body: I am working on a making a custom MapView class by extending the MapView class in the google maps API v2 for Android. One of the purposes of the class is that it will be able to be used without necessarily having to be part of an OnCreate function. I am able to connect to google maps and display the map but it will only respond to a touch if I touch the map a second time after the movement (Example having to tap 3 times for it to recognize a double tap) Here is the starter code for the class (not including the imports at the top): public class MyMapViewTest extends MapView { public MyMapViewTest (Context context) { super (context); this.onCreate(null); MapsInitializer.initialize(context); this.getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(40,-80),15)); this.invalidate(); } } and here is an example of how I am using it in a fragment: bob = new MyMapViewTest(this.getApplicationContext()); this.addContentView(bob, new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.FILL_PARENT)); Is there something else I am missing in my class that could be causing the lag? I have tried the class in several applications and the lag is always present, it almost seems like it only gets the touch input after being touched a second time. Thanks.
tagged with: touch
tagged with: google-maps

http://stackoverflow.com/q/25164329
linked to: http://stackoverflow.com/q/12348932
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39178775
duplicate of: http://stackoverflow.com/q/12348932
has comment: http://stackoverflow.com/comment/39201651
answer count: 0
score: 1
upvote count: 1
tagged with: swing
tagged with: renderer
type: Question
has comment: http://stackoverflow.com/comment/39187970
has comment: http://stackoverflow.com/comment/39201605
tagged with: java
has body: highlight the cell in jtable Continuing from my earlier post, just help me to give the idea of selecting just the cell on clicking the button. The idea was to make use of getTableCellRendererComponent , but TableColumn class is being used which selects the whole Column. So how to make use of just highlighting the cell Prob1 : Need to highlight just a cell on a button click. Prob 2: I couldnt move on with the project without solving the above. please help. Courtesy :@Zyion package helped; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.table.*; public class Main extends JFrame { public Main() { super("Table Demo"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setPreferredSize(new Dimension(300, 300)); setLocationRelativeTo(null); setLayout(new BorderLayout()); DefaultTableModel model = new DefaultTableModel(); model.setColumnCount(5); model.setRowCount(5); JTable table = new JTable(); table.setModel(model); //Get an instance of the column and the style to apply and hold a default style instance final TableColumn column = table.getColumnModel().getColumn(1); final CellHighlighterRenderer cellRenderer = new CellHighlighterRenderer(); final TableCellRenderer defaultRenderer = column.getCellRenderer(); //Now in your button listener you can toggle between the styles JButton button = new JButton("Click!"); button.addActionListener(new ActionListener() { private boolean clickedd = false; public void actionPerformed(ActionEvent e) { if (clickedd) { column.setCellRenderer(cellRenderer); clickedd = false; } else { column.setCellRenderer(defaultRenderer); clickedd = true; } repaint(); //edit } }); getContentPane().add(table, BorderLayout.CENTER); getContentPane().add(button, BorderLayout.NORTH); pack(); setVisible(true); } public static void main(String[] args) { new Main(); } } class CellHighlighterRenderer extends DefaultTableCellRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object obj, boolean isSele…
has title: Highlight only a cell in Jtable
tagged with: cell
linked to: http://stackoverflow.com/q/25093985
has comment: http://stackoverflow.com/comment/39186016
linked to: http://stackoverflow.com/q/24555289
downvote count: 0
tagged with: tablecolumn
linked to: http://stackoverflow.com/q/16814512
has comment: http://stackoverflow.com/comment/39180941
favorite count: 0
has comment: http://stackoverflow.com/comment/39180994

http://stackoverflow.com/comment/39273022
type: AnswerComment
has text: add these to your top root view android:descendantFocusability="beforeDescendants" android:focusableInTouchMode="true"
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25215052

http://stackoverflow.com/comment/39105919
comment on: http://stackoverflow.com/a/25125425
score: 0
type: AnswerComment
type: Comment
has text: What do you meant "get" info? It's a constant string.

http://stackoverflow.com/comment/39292086
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25225581
has text: Don't use an inner class. Pass tree instance to node constructor.
score: 0

http://stackoverflow.com/q/25081506
upvote count: 0
has comment: http://stackoverflow.com/comment/39023653
favorite count: 0
type: Question
has title: Java: Descending to Ascending
has comment: http://stackoverflow.com/comment/39023553
score: -1
tagged with: java
has comment: http://stackoverflow.com/comment/39023785
answer count: 1
downvote count: 1
has body: I made this with my friend and would like to know if. How can we change the condition where if someone would let us change it to ascending order? public class EXP2 { public static void main(String args[]){ int nInputs; int kth; int temporarystorage; System.out.print("Number of inputs: "); nInputs = new Scanner(System.in).nextInt(); int inputs[] = new int[nInputs]; do{ System.out.print("Enter Kth Largest Number: "); kth = new Scanner(System.in).nextInt(); } while(!(kth&gt;0&amp;&amp;kth&lt;=nInputs)); for(int o = 0; o &lt; nInputs; o++){ System.out.print("Enter Input#: "+(o+1)+": "); inputs[o] = new Scanner(System.in).nextInt(); } for(int o = 0; o &lt; nInputs; o++) for(int i = o + 1; i &lt; nInputs; i++) if(inputs[o]&lt;inputs[i]){ temporarystorage = inputs[i]; inputs[i] = inputs[o]; inputs[o] = temporarystorage; } System.out.println("Inputs in descending order: "); for(int i = 0; i &lt; nInputs; i++) System.out.print(inputs[i]+","); System.out.println("Kth position " + kth +" is "+inputs[kth-1]); } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25081546

http://stackoverflow.com/a/25650036
has body: I found the problem. It seems a JQUERY issue on Internet Explorer. $.getJSON('Grafico', function(data) { ... } doesn't work in IE11. I changed it with $.ajax({ type: $('#form1').attr('method'), url: "Grafico", cache:false, dataType:'json', success: function(data){ for (var i = 0; i &lt; data.DeltaRealTime.length; i++){ chart1.series[i].addPoint([parseInt(data.DeltaRealTime[i].key),parseFloat(data.DeltaRealTime[i].value)]); } } }); and all works very well.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25125620

http://stackoverflow.com/a/25321327
downvote count: 0
answers question: http://stackoverflow.com/q/25107605
accepted answer of: http://stackoverflow.com/q/25107605
has comment: http://stackoverflow.com/comment/120166261
has body: You have to specify which message attributes you want in your request (or use "All" to get all message attributes). So in your case you could use either List&lt;Message&gt; messages = sqs.receiveMessage(receiveMessageRequest.withMessageAttributeNames("attributeTest")).getMessages(); or List&lt;Message&gt; messages = sqs.receiveMessage(receiveMessageRequest.withMessageAttributeNames("All")).getMessages(); If you want the standard attributes (ApproximateFirstReceiveTimestamp, ApproximateReceiveCount, SenderId, and SentTimestamp) along with your messages, use withAttributeNames("All"). You can find more detail in the Javadocs for ReceiveMessageRequest.
upvote count: 77
type: AcceptedAnswer
type: Answer
score: 77
has comment: http://stackoverflow.com/comment/102144071

http://stackoverflow.com/comment/39106422
score: 0
type: AnswerComment
has text: @Biscuit128 - there may be _additional_ firewall issues, but this is also a requirement to get it working. it presumes, of course, that your server is running on jdk 7u4 or later.
type: Comment
comment on: http://stackoverflow.com/a/25124738

http://stackoverflow.com/comment/39117473
type: QuestionComment
has text: Intense calculations is a mix of looping through same operations again and again for which include the operation explained above as well as DB insertions, although I am using transactions to perform DB operations (insertions) These can vary from a few hundreds to a thousand. There is enough of code and putting that here will only increase the complexity.
score: 0
comment on: http://stackoverflow.com/q/25131530
type: Comment

http://stackoverflow.com/comment/39123283
type: QuestionComment
comment on: http://stackoverflow.com/q/25134920
score: 0
type: Comment
has text: Is it possible to do in java code ?I actually want to perform it in my java code

http://stackoverflow.com/q/25170278
score: 2
has answer: http://stackoverflow.com/a/25170385
tagged with: java
tagged with: glassfish-4
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/39189570
has title: best way to load external files in j2EE?
has body: I am trying to deploy a REST web service. I use glassfish as a web server. I have a problem when i try to open an external file. in other words I want to read a file that is in the web-inf folder named "config.xml". When I used a Java application (not web application), I used the following code to open the file but now it does not work String path = new File (".") GetCanonicalPath () + "/ config.xml". Cordially
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/18156991
favorite count: 0
tagged with: rest
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39191997

http://stackoverflow.com/comment/39003323
has text: in every project, i write same code and only changing template.Should we create template engine and back-end is a framework(spring,struts etc)? I don't want same code in same every project.İ just want it
comment on: http://stackoverflow.com/q/25070360
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25093235
answer count: 1
favorite count: 0
has body: I have an object that must be created using a factory method: public class FrameFactory { public static Frame createFrame() throws IOException, SerializationException { BXMLSerializer bxmlSerializer = new BXMLSerializer(); return (Frame)bxmlSerializer.readObject(FrameFactory.class, "/gui/MainFrame.bxml"); } } The Spring call to get the mean will be something like this: &lt;bean id="frame" class="Frame" factory-method="createFrame"/&gt; However, I want this object to be singleton. My question is that does Spring has some ready-made method to make a singleton OR I have to implement the singleton pattern myself in the FrameFactory? Thank you very much.
tagged with: spring
type: AnsweredQuestion
score: 2
has title: How to make a factory that creates singleton in Spring
downvote count: 0
linked to: http://stackoverflow.com/q/2637864
tagged with: java
has comment: http://stackoverflow.com/comment/39046740
type: Question
has answer: http://stackoverflow.com/a/25093274
accepted answer: http://stackoverflow.com/a/25093274
upvote count: 2

http://stackoverflow.com/comment/39278315
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25164283
has text: Greg, thanks - it should be posted as an answer. So in my example, shlCheckOut.close(); ?
type: Comment

http://stackoverflow.com/comment/39018476
score: 0
comment on: http://stackoverflow.com/q/25078119
has text: I just wanted to mark the line for you to find it easier-Somayeh
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39025052
comment on: http://stackoverflow.com/a/25082137
has text: yeah but sorry but i want to open another cmd that display helloWorld
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25227951
has comment: http://stackoverflow.com/comment/39299205
type: Answer
answers question: http://stackoverflow.com/q/25227324
score: 0
has body: The AttributeConverter is a Generic type class. See the Java Doc below: /** * A class that implements this interface can be used to convert * entity attribute state into database column representation * and back again. * Note that the X and Y types may be the same Java type. * * @param &lt;X&gt; the type of the entity attribute * @param &lt;Y&gt; the type of the database column */ public interface AttributeConverter&lt;X,Y&gt; Try changing your LocalDateConverter to public class LocalDateConverter implements AttributeConverter&lt;LocalDate, String&gt; where LocalDate is the type of the attribute in your entity bean and String is the type the database expects as a varchar or char or text field.

http://stackoverflow.com/comment/39087072
type: Comment
has text: Yes, you're right, each time will return a new array. I'm Just provide the very useful ArrayUtils class to use. :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25115331

http://stackoverflow.com/comment/39124924
score: 1
type: QuestionComment
type: Comment
has text: The response you got means GCM server accepted your message. Therefore the problem must be in your app. Please include your code. And make sure your network doesn'k block ports 5228-5230.
comment on: http://stackoverflow.com/q/25134497

http://stackoverflow.com/comment/39156458
has text: i did not get you but i am first binding service and then starts it. Am i doing any wrong ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25141194

http://stackoverflow.com/q/25176605
has comment: http://stackoverflow.com/comment/39200872
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/19173195
has comment: http://stackoverflow.com/comment/39223736
has comment: http://stackoverflow.com/comment/39200631
tagged with: popup
answer count: 0
has comment: http://stackoverflow.com/comment/39213218
tagged with: java
tagged with: selenium
tagged with: webdriver
type: Question
score: 0
has title: Random popup survey
tagged with: random
has body: I have a website that generates a random survey popup. I have to refresh the browser about 20 to 50 times to get that pop up. But Selenium does not report it if it sees it anyways. What's the best way to write this code using selenium webdriver and java. I've tried switchTo.frame(frameid) or window. I've tried getting window handles. Nothing seems to work. I need to verify that the popup appears for certain urls in the site.

http://stackoverflow.com/comment/39141684
type: AnswerComment
has text: @Holger - Actual measurements with a modern VM: 2^31 checked accesses = 1,672 ms. 31 exceptions = 0 ms. (10,000 exceptions measured at 15 ms.) Exceptions are more expensive than normal flow of control, but they're not the same as waiting for Christmas. :) This is an academic exercise that one would not use in the real world with the extant String API. If it were an actual performance hack with some other strangely lacking API, one would want to switch over to linear search once the search space decreased below a threshold.
type: Comment
comment on: http://stackoverflow.com/a/25143688
score: 0

http://stackoverflow.com/comment/39260617
has text: ok, Added the jar +1. now getting `Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/oci8/OCIDBAccess` . let me try maven to find dependencies
comment on: http://stackoverflow.com/a/25208495
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25221332
favorite count: 0
has answer: http://stackoverflow.com/a/25221586
tagged with: sql
possible better answer: http://stackoverflow.com/a/25221777
has answer: http://stackoverflow.com/a/25221777
upvote count: 1
has title: Java EE jta hibernate.hbm2ddl.import_files does not work
accepted answer: http://stackoverflow.com/a/25221586
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
has body: I try to import sql file when web application runs. I placed import.sql into src/main/resources/import.sql. Then I modified my persistence.xml by adding import_files directive: <?xml version="1.0" encoding="UTF-8" standalone="no"?> SP Persistence Unit org.hibernate.jpa.HibernatePersistenceProvider java:jboss/datasources/SpDS <property name="hibernate.hbm2ddl.auto" value="create"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="false"/> <property name="hibernate.hbm2ddl.import_files" value="import.sql"/> But after redeploy or restart server nothing to uploads in database. I use WildFly 8.1.0, Hibernate 4.3.5.Final, Database h2database 1.3.161. I tried to remove blank lines from import.sql and change hibernate.hbm2ddl.auto to create-drop. Any idea why import.sql does not load in database?
downvote count: 0

http://stackoverflow.com/q/25165471
tagged with: string-formatting
has comment: http://stackoverflow.com/comment/39197846
has comment: http://stackoverflow.com/comment/39180358
tagged with: java-8
type: AnsweredQuestion
tagged with: java-stream
tagged with: java
has comment: http://stackoverflow.com/comment/102604072
upvote count: 1
accepted answer: http://stackoverflow.com/a/25165550
type: Question
has comment: http://stackoverflow.com/comment/39180293
tagged with: optimization
has title: What is a performant way to make Java8 streams produce a formatted string
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25165550
has comment: http://stackoverflow.com/comment/39184371
has body: Context: given a directory, I'd like to list all the files in there that contain a pattern in their name, ordered by lastModified timestamp, and format this list in a Json string where I'd get the name and timestamp of each file: [{"name": "somefile.txt", "timestamp": 123456}, {"name": "otherfile.txt", "timestamp": 456789}] I've got the following code: private StringBuilder jsonFileTimestamp(File file) { return new StringBuilder("{\"name\":\"") .append(file.getName()) .append("\", \"timestamp\":") .append(file.lastModified()) .append("}"); } public String getJsonString(String path, String pattern, int skip, int limit) throws IOException { return Files.list(Paths.get(path)) .map(Path::toFile) .filter(file -&gt; { return file.getName().contains(pattern); }) .sorted((f1, f2) -&gt; { return Long.compare(f2.lastModified(), f1.lastModified()); }) .skip(skip) .limit(limit) .map(f -&gt; jsonFileTimestamp(f)) .collect(Collectors.joining(",", "[", "]")); } This is working well. I am just concerned on the performance of the StringBuilder instantiation (or String concatenation). It is OK as long as the number of files keeps small (which is my case, so I'm fine) but I am curious : what would you suggest as an optimization ? I feel like I should use reduce with the correct accumulator and combiner but I can't get my brain around it. Thanks. UPDATE I finally went with the following "optimization": private StringBuilder jsonFileTimestampRefactored(StringBuilder res, File file) { return res.append(res.length() == 0 ? "" : ",") .append("{\"name\":\"") .append(file.getName()) .append("\", \"timestamp\":") .append(file.lastModified()) .append("}"); } public String getJsonStringRefactored(String path, String pattern, int skip, int limit) throws IOException { StringBuilder sb = Files.list(Paths.get(path)) .map(Path::toFile) .filter(file -&gt; file.getName().contains(pattern)) .sorted((f1, f2) -&gt; Long.compare(f2.lastModified(), f1.lastModified())) .skip(skip) .limit(limit) .reduce(new …

http://stackoverflow.com/q/25208024
tagged with: applicationcontext
favorite count: 0
accepted answer: http://stackoverflow.com/a/25684518
has comment: http://stackoverflow.com/comment/39259639
upvote count: 2
has comment: http://stackoverflow.com/comment/39293372
tagged with: spring-annotations
tagged with: spring
has comment: http://stackoverflow.com/comment/39259925
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39292011
tagged with: java
has title: testing applicationContext: org.springframework.core.annotation.AnnotationUtils.getAnnotationAttributes
has body: So I have this helper class for getting the application context: public class ApplicationContextProvider implements ApplicationContextAware{ private static ApplicationContext context; public static ApplicationContext getApplicationContext() { return context; } public void setApplicationContext(ApplicationContext context) throws BeansException { this.context = context; } } and its unit test: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration() public class ApplicationContextProviderTest { @Test public void getApplicationContextInstance(){ assertNotNull(ApplicationContextProvider.getApplicationContext()); } } with the following resource file (same package with test class): ApplicationContextProviderTest-context.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns: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/util http://www.springframework.org/schema/util/spring-util.xsd"&gt; &lt;util:map id="contextProperties" /&gt; &lt;bean id="applicationContextProvider" class="com.ideyatech.morphlynx.application.ApplicationContextProvider" /&gt; &lt;/beans&gt; When I run the test, I get this error: java.lang.IllegalStateException: Failed to introspect annotations: class com.ideyatech.morphlynx.application.listener.ApplicationContextProviderTest at org.springframework.core.annotation.AnnotatedElementUtils.process(AnnotatedElementUtils.java:169) at org.springframework.core.annotation.AnnotatedElementUtils.getAnnotationAttributes(AnnotatedElementUtils.java:93) at org.springframework.core.annotation.AnnotatedElementUtils.getAnnotationAttributes(AnnotatedElementUtils.java:87) at org.springframework.test.context.MetaAnnotationUtils$AnnotationDescriptor.&lt;init&gt;(MetaAnnotationUtils.java:305) …
has answer: http://stackoverflow.com/a/25765602
has comment: http://stackoverflow.com/comment/39299334
type: Question
has answer: http://stackoverflow.com/a/25684518
possible better answer: http://stackoverflow.com/a/25247489
answer count: 3
has answer: http://stackoverflow.com/a/25247489
downvote count: 0
has comment: http://stackoverflow.com/comment/39260085

http://stackoverflow.com/comment/39305613
type: Comment
has text: You can also experiment with `firstNameCol.setCellValueFactory( data -> JavaBeanStringPropertyBuilder.create().bean(data.getValue()).name("firstName").build());` which also eliminates the "here's what to do when the editing completes" code. I haven't thought through whether or not that creates a memory leak though.
score: 0
comment on: http://stackoverflow.com/a/25232149
type: AnswerComment

http://stackoverflow.com/comment/39033292
type: Comment
has text: The problem is in your code somewhere. You can see that in Line 4 of your stack trace. Can you post your MainActivity code?
score: 0
comment on: http://stackoverflow.com/q/25086362
type: QuestionComment

http://stackoverflow.com/q/25098726
answer count: 4
downvote count: 0
type: UnansweredQuestion
tagged with: inheritance
has body: I'm just learning Java and design patterns and I am trying to get my head around when to use interfaces and abstract classes. I am wondering in the Strategy design pattern, why is it preferable to use an interface for the behaviour/algorithm subclasses rather than an abstract superclass? Is it simply because there is no need for an abstract class because each behaviour/algorithm subclasses have their own implementation and therefore an abstract superclass would just provide extra functionality that won't be used? Wouldn't an abstract class mean that there is an extra possibilty to use this extra functionality in the future if needed, for instance adding a method to the abstract superclass which is shared by the behaviour/algorithm subclasses if this is needed. Is there any reason why this is a bad idea? Or is there another reason?
has answer: http://stackoverflow.com/a/25109215
has comment: http://stackoverflow.com/comment/125677716
has title: Using an abstract class instead of the interface in the Strategy design pattern
score: 3
has comment: http://stackoverflow.com/comment/39056057
favorite count: 0
has answer: http://stackoverflow.com/a/25098776
type: Question
tagged with: interface
has answer: http://stackoverflow.com/a/25099524
tagged with: design-patterns
has answer: http://stackoverflow.com/a/25098768
has comment: http://stackoverflow.com/comment/39056392
tagged with: oop
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/71095703
has comment: http://stackoverflow.com/comment/39056013

http://stackoverflow.com/q/25122796
upvote count: 2
has title: Joda date formatter
type: AnsweredQuestion
score: 2
has body: Does anyone know how to parse a date such as: Mon Aug 04 16:07:00 CEST 2014 to dd/MM/YYYY HH:MM:SS using DateTime formatter from Joda. I've tried that: final DateTimeFormatter sdf = DateTimeFormat.forPattern(DATE_FORMAT); DateTime lastDateOnline = sdf.parseDateTime(lastCommunicationToDisplay.getDateOnLine().toString()); return lastDateOnline.toString(); DATE_FORMAT = dd/MM/YYYY HH:MM:SS and lastCommunicationToDisplay.getDateOnLine().toString() = Mon Aug 04 16:07:00 CEST 2014 I can't find clear explanations about that library. I'm requested to use that instead of SimpleDateFormat because it's not threadsafe.
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/39101084
type: Question
tagged with: jodatime
downvote count: 0
has answer: http://stackoverflow.com/a/25126614
has comment: http://stackoverflow.com/comment/39101102
tagged with: datetime
answer count: 1
accepted answer: http://stackoverflow.com/a/25126614
favorite count: 0

http://stackoverflow.com/q/25126423
tagged with: label
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25126462
favorite count: 0
has body: I have a duplicate case label in the following code. The java compiler is saying that I have a duplicate case label in case 79-70. I'm a new java programmer, so could you please explain what I did wrong using less java terminology? public class Unit4Test2 { public static void main( String [] args) { int test_Score = 80; int test_Score2 = 40; int Grade_Average = (test_Score + test_Score2) / 2 ; switch( Grade_Average ) { case 100-90: System.out.println( " Your average test score is " + Grade_Average ); System.out.println( "Your letter grade is an A." ); break; case 89-80: System.out.println( " Your average test score is " + Grade_Average ); System.out.println( "Your letter grade is a B." ); break; case 79-70: System.out.println( " Your average test score is " + Grade_Average ); System.out.println( "Your letter grade is a C." ); break; case 69-65: System.out.println( " Your average test score is " + Grade_Average ); System.out.println( "Your letter grade is a D." ); break; case 64-0: System.out.println( " Your average test score is " + Grade_Average ); System.out.println( "Your letter grade is a F." ); break; default: System.out.println( " Invalid test score. "); break; } } }
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25126462
score: 1
tagged with: java
upvote count: 1
type: Question
has title: duplicate case label in case 79-70
tagged with: case

http://stackoverflow.com/comment/39163110
type: Comment
type: QuestionComment
has text: @xgeorgekx I think it does, although it has nothing to do with the lack of brackets.
comment on: http://stackoverflow.com/q/25156337
score: 0

http://stackoverflow.com/q/25084955
tagged with: java
has title: Using a DataSource in multiple servlets with resource injection
has body: I have a javax.sql.DataSource that I want to use in multiple servlets. I don't like the idea of specifying: @Resource(name="live-connection", lookup="java:/live-connection", description="Live DB Connection") private DataSource liveDataSource_; in every servlet as it seems to me that the framework will have to be looking up the DataSource for every servlet and if the name of the DataSource changes, every servlet will have to change too. My idea is to declare a Singleton EJB that can then be declared in each servlet: @Startup @Singleton @ConcurrencyManagement(ConcurrencyManagementType.BEAN) public class DataSources { @Resource(name="live-connection", lookup="java:/live-connection", description="Live DB Connection") private DataSource liveDataSource_; public synchronized Connection getLiveConnection() throws SQLException { return liveDataSource_.getConnection(); } } Is this a reasonable way of solving the issue? I feel it's a bit heavy handed for something I would have thought would be a common issue.
tagged with: datasource
tagged with: servlets
accepted answer: http://stackoverflow.com/a/25085389
type: Question
tagged with: jakarta-ee
answer count: 2
tagged with: ejb
possible better answer: http://stackoverflow.com/a/25613007
downvote count: 0
has answer: http://stackoverflow.com/a/25085389
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25613007
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/39241636
comment on: http://stackoverflow.com/a/25192387
type: AnswerComment
has text: The curly braces can **not** be omitted for a single statement, only for an expression. It works for method invocations because a method invocation is both, a statement *and* an expression. E.g. `()->throw x;` does not work. On the other hand, the parentheses around the parameters may be omitted for a single parameter.
type: Comment
score: 1

http://stackoverflow.com/q/25109595
score: 0
has title: How to conver (cast) double[] to byte[] in Java?
has comment: http://stackoverflow.com/comment/39076317
tagged with: java
tagged with: base64
type: Question
has answer: http://stackoverflow.com/a/25109774
answer count: 1
tagged with: arrays
linked to: http://stackoverflow.com/q/13109588
has comment: http://stackoverflow.com/comment/39076221
tagged with: type-conversion
tagged with: binary
has body: I want to encode double[] with Base64 or similar. For this I need to have byte[] how to convert/represent/cast double array to byte array with minimal copying? I was considering to use ByteBuffer and DoubleBuffer but this will require copying.
type: UnansweredQuestion

http://stackoverflow.com/comment/39185556
type: QuestionComment
has text: I would point out that you're not showing us the real code. You can't have a valueless return in one place in your method and a return with value in another.
comment on: http://stackoverflow.com/q/25168024
score: 0
type: Comment

http://stackoverflow.com/comment/39058680
comment on: http://stackoverflow.com/q/25100023
score: 0
has text: Can you give a code example how you set up your windows and controllers? The answer is "it depends" so we have to see how your code works.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39197926
has text: Only if this wasn't done within a loop ;) +1 otherwise
score: 0
comment on: http://stackoverflow.com/a/25175024
type: AnswerComment
type: Comment

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

http://stackoverflow.com/q/25196974
tagged with: ubuntu
score: 0
has title: problems with dectection of camera while using the SARXOS api in java
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/25479192
accepted answer: http://stackoverflow.com/a/25479192
type: Question
type: AnsweredQuestion
tagged with: camera
has body: Webcam webcam = Webcam.getDefault(); if (webcam != null) { System.out.println("Webcam: " + webcam.getName()); } else { System.out.println("No webcam detected"); } I am facing problem with the exception describe below while using the SARXOS Webcam api. I am using the ACER Laptop with the webcam and Ubuntu 12 Os. Stacktrace: [main] INFO com.github.sarxos.webcam.Webcam - WebcamDefaultDriver capture driver will be used Exception in thread "main" com.github.sarxos.webcam.WebcamException: java.util.concurrent.ExecutionException: com.github.sarxos.webcam.WebcamException: Cannot execute task at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:118) at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:692) at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:755) at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:732) at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:710) at com.convoy.gpack.pack.DetectWebcamExample.main(DetectWebcamExample.java:7) Caused by: java.util.concurrent.ExecutionException: com.github.sarxos.webcam.WebcamException: Cannot execute task at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:188) at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:110) ... 5 more

http://stackoverflow.com/comment/39146073
comment on: http://stackoverflow.com/q/25140010
score: 0
has text: Having spent a good deal of the day looking into this, it appears that there is an issue with an internal package which has classes which extend JSONObject and JSONArray. I appreciate all of the helpful comments and suggestions. I will delete this post if asked to do so, but I think there may be some helpful info for future readers so I won't do it out-of-hand.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39038862
comment on: http://stackoverflow.com/a/25087987
type: AnswerComment
score: 0
type: Comment
has text: Nm, I figured it out. Thanks a ton for the help again. :)

http://stackoverflow.com/a/25194657
has body: The main reason you can use SwingUtilities.invokeLater is that the EDT has a task queue that its processing loop picks off and runs tasks from, and invokeLater simply posts the given task to that queue. Most threads do not have a processing loop or a task queue, though, so you can't post tasks to arbitrary threads. You can code in such a loop for your threads, of course.
accepted answer of: http://stackoverflow.com/q/25194582
answers question: http://stackoverflow.com/q/25194582
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer

http://stackoverflow.com/comment/39191311
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25171205
has text: See also http://stackoverflow.com/questions/860187/access-restriction-on-class-due-to-restriction-on-required-library-rt-jar
type: QuestionComment

http://stackoverflow.com/a/25129818
upvote count: 4
score: 4
answers question: http://stackoverflow.com/q/25129781
has body: Lambda Expressions are newly added into Java 8. They are not available for JRE7. Try to upgrade your eclipse project's JRE to 8 (window -> preferences->java->compiler).
downvote count: 0
type: Answer

http://stackoverflow.com/q/25111239
possible better answer: http://stackoverflow.com/a/25111254
tagged with: java
accepted answer: http://stackoverflow.com/a/25111489
has answer: http://stackoverflow.com/a/25111254
has body: I am working with the bugsense SDK and want to be aware if my API backend goes down. Exception information is obligatory. I have searched the Java Exception library for exceptions related to server availability but could not find any. Are there any Exceptions from Java or Android related to this? If not would it be advisable to create my own Exception class?
type: Question
answer count: 2
score: 0
tagged with: exception
tagged with: android
has title: Throw exception when server is not available
tagged with: bugsense
has answer: http://stackoverflow.com/a/25111489
type: AnsweredQuestion

http://stackoverflow.com/q/25186653
tagged with: dao
score: 0
linked to: http://stackoverflow.com/q/650238
has comment: http://stackoverflow.com/comment/39244728
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39219241
has comment: http://stackoverflow.com/comment/39219633
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39263754
has comment: http://stackoverflow.com/comment/39219897
has title: MySQL Corruption when Java Application Terminates
answer count: 0
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/39219849
has body: When i run my java application which accesses a MySQL database sometimes when the application terminates with an exception a couple rows of my table i was working with are deleted. I am only using SELECT on the table in my code. What could cause this to happen? Connection leak? If so whats the best way to diagnose and fix the problem?

http://stackoverflow.com/comment/39174938
type: AnswerComment
has text: im new to java and was mainly wondering if you could actually get them to name variables but i have seen the comments like these which will help me with my textbased RPG i plan on making
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25162738

http://stackoverflow.com/comment/103324352
type: Comment
has text: Using the creative way one should be careful with primitive types. First example is ok: `System.out.println(Arrays.asList( new Integer[]{1,2,3,4,5}));` `[1, 2, 3, 4, 5]` Second example is a list containing one single element which is the whole array: `System.out.println(Arrays.asList( new int[]{1,2,3,4,5}));` `[[I@53b32d7]`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25077786

http://stackoverflow.com/q/25228911
has comment: http://stackoverflow.com/comment/39332916
score: 2
downvote count: 0
tagged with: java
has body: I'm writing a system where the frontend is in AngularJS and the backend is in Java with Jersey. But I am having problems using $locationProvider.html5Mode (true);to remove the "#" in url. If I click in a link on the page, the correct view is shown. But if I press F5 or copy and paste the URL in the browser, the server looks for a resource that doesn't exist and says that it is not available. I can't redirect, on the server, links to the entry point of the webapp, such as requested here https://docs.angularjs.org/guide/$location. Also, I tried doing what they said here about servlets AngularJS HTML5 Mode - How do direct links work without server specific changes?, but for me it didn't work. Does anyone have idea how to make it work? In NodeJS, it would use app.use ('/', express.static (__ dirname + '/ public')) ;. Below is the code I'm using: appRoutes.js angular.module('appRoutes', []) .config( [ '$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $routeProvider .when('/', { templateUrl : 'views/home.html', controller : 'HomeController' }) .when('/login', { templateUrl : 'views/login.html', controller : 'LoginController' }).otherwise({ redirectTo : '/' }); $locationProvider.html5Mode(true); } ]) .run(function($rootScope, $location, Login) { $rootScope.$on("$locationChangeStart", function(event, next, current) { if (!Login.isLogged()) { $location.path('/login'); } }); }); web.xml <?xml version="1.0" encoding="UTF-8"?> index.html Resources org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages sammubr.resources jersey.config.server.provider.classnames sammubr.filtro.FiltroSeguranca;org.glassfish.jersey.filter.LoggingFilter 1 Resources /api/* Login org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages sammubr.authenticate Login /authenticate/* Logout org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages sammubr.logout Logout /logout/* index.html …
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/39299152
answer count: 1
has title: AngularJS + Java in HTML5 mode
has answer: http://stackoverflow.com/a/25362461
tagged with: http://stackoverflow.com/tag/html
linked to: http://stackoverflow.com/q/17646843
tagged with: url-rewriting
favorite count: 0
tagged with: angularjs
type: UnansweredQuestion
tagged with: http-redirect

http://stackoverflow.com/comment/39210640
type: Comment
comment on: http://stackoverflow.com/a/25180655
score: 0
type: AnswerComment
has text: @hudi - Could you create a standalone JAXB example (eliminate Spring for the moment) to track down the issue. Creating the JAXBContext on the ObjectFactory classes would be best.

http://stackoverflow.com/q/25113504
upvote count: 2
has title: Can Joda format dates for Arabic locale using Arabic digits?
answer count: 2
has body: The story so far... We got sick of Java's Date API being generally bad and eventually ended up adopting Joda Time, which works much more sanely (although it is not perfect.) Recently we have been noticing issues in Java's NumberFormat with respect to Arabic locale. Essentially, it uses the "latin" digits instead of the more natural "arab" digits. So I have been adopting ICU's formatters as drop-in replacements for Java's. Now I have noticed that Joda's formatters for dates print the numbers in Latin as well. For example, if you take the following program: import java.util.Date; import java.util.Locale; import com.ibm.icu.text.DateFormat; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import org.junit.Test; public class TestJoda { @Test public void test() { Locale locale = new Locale("ar", "SA"); DateFormat icuDateFormat = DateFormat.getDateTimeInstance( DateFormat.LONG, DateFormat.LONG, locale); System.out.println("ICU: " + icuDateFormat.format(new Date())); DateTimeFormatter jodaDateTimeFormatter = DateTimeFormat.longDateTime().withLocale(locale); System.out.println("Joda: " + jodaDateTimeFormatter.print(DateTime.now())); } } The output will be as follows: ICU: ٤ أغسطس، ٢٠١٤ ٥:٠٧:١٤ م جرينتش+١٠ Joda: 04 أغسطس, 2014 EST 05:07:14 م Is there some way to coerce Joda's formatters into outputting a style consistent to ICU's? I guess in the worst case there would be a way to implement some kind of adapter, but one of the nice things about Joda's classes is their immutability, a feature which ICU has unfortunately been slow to adopt.
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25150667
has answer: http://stackoverflow.com/a/41419233
tagged with: internationalization
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: icu
type: Question
tagged with: jodatime
possible better answer: http://stackoverflow.com/a/41419233
accepted answer: http://stackoverflow.com/a/25150667

http://stackoverflow.com/q/25081630
tagged with: java
has comment: http://stackoverflow.com/comment/39024775
type: Question
tagged with: inheritance
tagged with: class
tagged with: static
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/29707136
type: UnansweredQuestion
has title: Accessing implementing class in a static context
has comment: http://stackoverflow.com/comment/39024128
has body: is it possible to determine the class of an implementing class in a static context. Given i want to create a logger in the superclass which logs its messages under the class name of the implementing classes. Currently i'm trying to use this approach: public abstract class GenericDao&lt;T, ID extends Serializable&gt; { protected static Logger logger = Logger.getLogger(new Object() { }.getClass().getEnclosingClass()); ... } But i still get the superclass. Is there any way to do this or should i give up and include the class in the actual logging method when i have access to "this".

http://stackoverflow.com/q/25143592
tagged with: netbeans
score: 0
tagged with: jax-ws
tagged with: web-services
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/25163429
has body: I have made a web service in Netbeans. I am trying to understand why the methods of the bean does not get generated by the client. Here is the bean. package OnlineAuction; import java.io.Serializable; import java.math.BigDecimal; import java.sql.Timestamp; import java.util.Calendar; import java.util.Date; public class Auction implements Serializable { private static final long serialVersionUID = 1L; private Long id; private Product product; private Timestamp added; private Timestamp expire; private BigDecimal startingBid; private BigDecimal reserve; /** * * @return */ public Long getId() { return id; } /** * * @param id */ public void setId(Long id) { this.id = id; } @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 Auction)) { return false; } Auction other = (Auction) 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 "OnlineAuction.Auction[ id=" + id + " ]"; } /** * * @return */ public Product getProduct() { return product; } /** * * @param product */ public void setProduct(Product product) { this.product = product; } /** * * @return */ public Timestamp getAdded() { return added; } /** * * @param added */ public void setAdded(Timestamp added) { this.added = added; } /** * */ public void setAddedNow() { this.added = getTimestampNow(); } private Timestamp getTimestampNow() { java.util.Date date = new java.util.Date(); return new Timestamp(date.getTime()); } /** * * @return */ public Timestamp getExpire() { return expire; } /** * * @param expire */ public void setExpire(Timestamp expire) { this.expire = expire; } /** * Sets the expiry time of the auction by adding the hours to the added date. * If the added date is not set…
accepted answer: http://stackoverflow.com/a/25163429
type: AnsweredQuestion
has title: JAX-WS passing bean methods to clients
type: Question

http://stackoverflow.com/comment/39016790
score: 0
type: Comment
type: QuestionComment
has text: yes it is already configured, yet i am getting the error
comment on: http://stackoverflow.com/q/25077654

http://stackoverflow.com/comment/39288150
has text: Oh snap of course. The recovered would register a callback but wouldn't change that promise reference. Thanks so much - I'm going back to java from scala and it's weird :P
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25223259

http://stackoverflow.com/q/25121307
tagged with: java
tagged with: command-line-arguments
has comment: http://stackoverflow.com/comment/39098149
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/367706
has comment: http://stackoverflow.com/comment/39098184
accepted answer: http://stackoverflow.com/a/25121629
has answer: http://stackoverflow.com/a/25121667
score: 0
has answer: http://stackoverflow.com/a/25123273
favorite count: 0
possible better answer: http://stackoverflow.com/a/25123273
answer count: 5
has answer: http://stackoverflow.com/a/25122117
has answer: http://stackoverflow.com/a/25121719
has title: How can I give command line arguments in any order?
upvote count: 1
has comment: http://stackoverflow.com/comment/39098240
has comment: http://stackoverflow.com/comment/39098105
has answer: http://stackoverflow.com/a/25121629
type: AnsweredQuestion
has body: I have two enums, one for apps and one for environments. I want to be able to give the arguments for these in any order, so I can give either -app app1 app1 -env env1 env2 or -env env1 env2 -app app1 app2. Right now I can only do the first one. I would also like to be able to just say -app app1 app2 and it runs all the apps I list in all environments and the same for the environments but I'm more concerned about being able to give them in either order. for(int i = 0; i&lt;args.length; i++) { if(args[i].equals("-app")) { indexOfApp = i; }else if(args[i].equals("-env")) { indexOfEnv = i; } } int countOfApp = -1; int countOfEnv = -1; if(indexOfApp != -1 &amp;&amp; indexOfEnv != -1) { countOfApp = indexOfEnv - 1; countOfEnv = args.length - (indexOfEnv + 1); } System.out.println(countOfApp); System.out.println(countOfEnv); for(int appIndex = indexOfApp + 1; appIndex &lt; countOfApp + 1; appIndex++){ appList.add(args[appIndex]); } for(String item : appList ) { Application app = Application.valueOf(Application.class, item); appList2.add(app); } for(int envIndex = indexOfEnv + 1; envIndex &lt; args.length; envIndex++){ envList.add(args[envIndex]); } for(String item : envList ) { Environment env = Environment.valueOf(Environment.class, item); envList2.add(env); } } System.out.println(appList); System.out.println(envList); Application.chooseAppTest(appList2, envList2);

http://stackoverflow.com/q/25209559
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25212064
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39266960
type: Question
tagged with: hl7-fhir
has body: This is a follow-up to a previous question from 4 months ago. I also need to use the FHIR org.hl7.fhir.instance.formats.JsonParser to parse JSON strings that have the value "Bundle" assigned to their resourceType fields. Here are my 2 questions: While I wait for gForce access approval, is the only file that I need to download to patch the problem JsonParser.java? I'm currently using FHIR 0.81. Can I assume that this single file patch will be compatible with the rest of version 0.81? Wouldn't it be more consistent if an aggregation of Resources, such as Bundle, were also itself a Resource? Unfortunately, assigning a non-resource value ("Bundle") to the resourceType field requires special handling in code that type checks different representations of resources, that persists those representations, and that transforms those representations.
has title: parsing FHIR bundles in Java using JSON (cont.)
answer count: 1
linked to: http://stackoverflow.com/q/22976087

http://stackoverflow.com/q/25188182
has comment: http://stackoverflow.com/comment/39224959
tagged with: jface
answer count: 0
tagged with: java
tagged with: swt
tagged with: treeview
type: Question
has comment: http://stackoverflow.com/comment/39224339
has comment: http://stackoverflow.com/comment/39224463
score: 0
has comment: http://stackoverflow.com/comment/39225114
has body: I'm new to eclipse plugin development. I'm working on an issue in which the UI blocked for long time for treeViewer filtering. In this process, Namepatterfilter is apply to the treeviewer and first few nodes are expanded programmatically to show the result. On analysing the namepattern is called only when the node is expanded. If a node has large number of children, the time taken for expanding is too long. since expanding a node runs in UI thread, the UI is blocked for other UI activities. I wonder, is there any other way of filtering without depending on the UI?. Like filtering the model, then apply it to Treeviewer?
tagged with: eclipse-plugin
has title: Jface: How to filter a treeviewer without blocking the UI?
type: UnansweredQuestion

http://stackoverflow.com/a/59658512
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25097435
downvote count: 1
has body: You should set the data, before putting alert box. currently alert box is not getting any data
score: 0

http://stackoverflow.com/a/25100013
type: AcceptedAnswer
downvote count: 0
upvote count: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/25099004
score: 3
answers question: http://stackoverflow.com/q/25099004
has body: You are trying to define a method without defining it. Methods (when not being abstract or declared in interfaces) always need the method head (void method()) and a body ({ ... }). In the lines you have marked, you are only defining the head but not the body. If you want to have this method declared without instantly defining the body, you need to make them abstract.

http://stackoverflow.com/comment/39063400
type: Comment
comment on: http://stackoverflow.com/a/25102027
has text: @Laune but c++ may or may not use a different algorithm. In between those words you quoted were "a particular language uses". Also, I could write a new prng in java.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/39278266
type: Comment
comment on: http://stackoverflow.com/a/25217516
type: AnswerComment
score: 0
has text: @user3789200 - No. `Synchronization` works only if threads try to have Lock on the *same* object. Both `letter` and 'Number` threads should Lock on *same* object. Once one thread gets the lock, another has to wait for the lock as there is only **one lock**.

http://stackoverflow.com/q/25182596
has body: After browsing through the whole internet I ended up asking this question, although I find it a bit difficult to describe the situation. I have a little application here which runs on embedded Tomcat server (v7), and uses servlets and JSPs; I try to internationalize them with JSTL tags. The final project is deployed as JAR, and when I run it from the console with java -jar, the embedded server starts nicely, everything works just fine. The problem is when I try to run it in the IDE (I use IntelliJ Idea v13.1.2): again, it starts, but instead of the values from the bundle, the pages show values such as ???default.username???. Here is how my JSPs mostly look like: &lt;!DOCTYPE html&gt; &lt;%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %&gt; &lt;%@ page contentType="text/html;charset=UTF-8" %&gt; &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; &lt;c:set var="language" value="${not empty param.language ? param.language : not empty language ? language : pageContext.request.locale}" scope="session"/&gt; &lt;fmt:setLocale value="${language}"/&gt; &lt;fmt:setBundle basename="messages" scope="session" var="bund"/&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;fmt:message bundle="${bund}" key="default.title" /&gt;&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="../css/tdb.css" media="all"&gt; &lt;/head&gt; And so on. The &lt;fmt:message bundle="${bund}" key="default.title" /&gt; and similar parts work perfectly fine when I use the JAR, and result in ???default.title??? when from IDE. In one case I use the bundle file from the servlet, and when ran from JAR, it works fine, and when from IDE, it causes java.util.MissingResourceException. What have I tried so far? I added my messages.properties and messages_en_US.properties files in various locations (in resources folder, on the same level with the java and webapp folders; in separate package in the com.my.example package; as simple properties files in the com.my.example packa…
tagged with: internationalization
score: 3
tagged with: java
tagged with: servlets
type: Question
linked to: http://stackoverflow.com/q/4136403
answer count: 2
tagged with: intellij-idea
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/41055104
upvote count: 3
has title: JSP cannot find default bundle for i18n
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25433836

http://stackoverflow.com/q/25222603
type: Question
has comment: http://stackoverflow.com/comment/39286918
has body: I'm not sure I've phrased the title correctly, but hopefully my pseudo code is nearly self explanatory. I don't know how to test if a SomeType object is an instance of MyClass (or a descendent). How could this be achieved? public class MyClass&lt;SomeType&gt; { //... public void a(SomeType st) { if (SomeType extendsOrIs MyClass&lt;?&gt;) // Need help with this line { MyClass&lt;?&gt; mc = (MyClass&lt;?&gt;) st; mc.b(); } } public void b() { //... } } One solution I've found is to do this, but it's possible the object is null, in which case I'd still like to know if SomeType is equivalent to MyClass&lt;?&gt; for the sake of calling a method for future objects: public void a(SomeType st) { if (st instanceof MyClass&lt;?&gt;) { MyClass&lt;?&gt; mc = (MyClass&lt;?&gt;) st; mc.b(); } }
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25223537
tagged with: generics
tagged with: instanceof
has title: Test if class's generic parameter is itself the same class with its own generic parameter
has answer: http://stackoverflow.com/a/25223537
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39287312

http://stackoverflow.com/comment/39143637
type: Comment
type: QuestionComment
has text: Have you tried using the onPostExecute method of the AsyncTask to call your refresh functionality?
comment on: http://stackoverflow.com/q/25145738
score: 0

http://stackoverflow.com/q/25081781
answer count: 4
possible better answer: http://stackoverflow.com/a/25081905
has answer: http://stackoverflow.com/a/25082087
has answer: http://stackoverflow.com/a/25081908
type: Question
type: AnsweredQuestion
has title: Outputstream is an abstract class so we cannot instantiate it.Why then a default constructor is provided for Outputstream class?
accepted answer: http://stackoverflow.com/a/25081911
score: 10
upvote count: 11
favorite count: 0
has body: here is the link for API documentation of Outputstream abstract class .You will find a default constructor http://docs.oracle.com/javase/7/docs/api/java/io/OutputStream.html#OutputStream%28%29
has comment: http://stackoverflow.com/comment/39024180
downvote count: 1
has comment: http://stackoverflow.com/comment/39024195
has comment: http://stackoverflow.com/comment/39024179
tagged with: java
has answer: http://stackoverflow.com/a/25081905
has answer: http://stackoverflow.com/a/25081911

http://stackoverflow.com/comment/84580509
score: 0
type: QuestionComment
type: Comment
has text: fyi as of 2/14/18 eclipse oxygen still will only support versions of GlassFish 3 and 4, so don't bother downloading 5 yet.
comment on: http://stackoverflow.com/q/25200410

http://stackoverflow.com/comment/39207624
type: AnswerComment
has text: you can see the all code now ans thanks for your help
score: 0
comment on: http://stackoverflow.com/a/25168321
type: Comment

http://stackoverflow.com/comment/39076980
comment on: http://stackoverflow.com/q/25109222
score: 0
type: Comment
type: QuestionComment
has text: I would suggest the "Lesson: Laying Out Components Within a Container" part to learn about layout managers. See http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html

http://stackoverflow.com/comment/60766714
comment on: http://stackoverflow.com/a/25079415
score: 0
type: AnswerComment
has text: What I put over there is `jvmArgs = ["-Dloader.path=/Users/xyz/Documents/keys"]`
type: Comment

http://stackoverflow.com/comment/39062185
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25102051
has text: can you share example?
score: 0

http://stackoverflow.com/comment/39269096
type: AnswerComment
has text: @committedandroider Correct. There is usually no special byte value _in a file_ to indicate the end of the file.
type: Comment
comment on: http://stackoverflow.com/a/25213063
score: 1

http://stackoverflow.com/comment/39039281
comment on: http://stackoverflow.com/q/25089580
score: 0
type: Comment
type: QuestionComment
has text: i am using spring jdbc

http://stackoverflow.com/comment/39127992
type: QuestionComment
has text: If the only dynamic parts of this sentence are the bold parts it might make more sense to use a substring + regex as you know the preceeding character lengths. Remove x characters. Regex match everything until "MB" repeat.
score: 0
comment on: http://stackoverflow.com/q/25137483
type: Comment

http://stackoverflow.com/comment/39272408
has text: Yeah, me too I was hoping that there was a way to do it without overriting the onStartup method.
comment on: http://stackoverflow.com/a/25214812
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39062341
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25101906
has text: You're still creating the `Random` instance in a loop, though. If you want a general review of your code, there's also codereview.stackexchange.com you could ask. The comments are getting long here, so you should open a new question if you want further assistance.
type: AnswerComment

http://stackoverflow.com/a/25116519
has body: The DispatcherServlet by default will load and register all HandlerExceptionResolver implementations within the ApplicationContext to help with processing Exceptions from your Controllers. You'll notice that AbstractHandlerExceptionResolver class implements Ordered. Most HandlerExceptionResolver implementations extend this class and DispatcherServlet uses this to order the list of HandlerExceptionResolver implementations when it comes to handling Exceptions thrown by your Controllers. As you might suspect, the processing of @ExceptionHandler annotations on your Controllers is also handled by a HandlerExceptionResolver implementation. To be precise: org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver What I would suggest is happening in your case is that the sort of HandlerExceptionResolver by the DispatcherServlet is causing your implementation to be invoked before the AnnotationMethodHandlerExceptionResolver meaning that your @ExceptionHandler annotations are effectively ignored. To counteract this, we need to do two things: Directly register the AnnotationMethodHandlerExceptionResolver as a bean within your ApplicationContext Set the Order value of this bean to be greater than that of your custom HandlerExceptionResolver implementation This will mean that when it comes to handling Exceptions for your Controllers, Spring will first see if the AnnotationMethodHandlerExceptionResolver can handle the Exception, and if not, fall back to your custom HandlerExceptionResolver implementation. As an example of the setting the order on a HandlerExceptionResolver (assuming you're using XML configuration somewhere): &lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver" p:order="1" /&gt; You may also want to take a look at list of HandlerExceptionResolver implementations registered with DispatcherServlet by default and decide upon the order that most suits your application.
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25092118
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25092118
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/61588362

http://stackoverflow.com/q/25088930
score: 1
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/118021961
has title: Videoconferencing using JMF and RTP transmission
tagged with: video-conferencing
has answer: http://stackoverflow.com/a/38333311
has comment: http://stackoverflow.com/comment/118082744
tagged with: jmf
type: AnsweredQuestion
has body: I am working on a videoconference program using java and JMF. I implemented the two classes AVReceive2 and AVTransmit2 to broadcast live audio and video from the web cam. The text chat works just fine but when I start the video on one client, the other one prints "waiting for RTP to arrive" (which is my output when the receiver client doesn't get anything). So the problem is that the client can't send data to the other one. I have tried the following: - launching the server and the two clients on the same machines. - using two then 3 different machines connected in an ad-hoc network, one is a server and a client the second is only a client. -same thing but with 3 different machines 1 server an 2 clients. - using manual ip address (like 172.168.90.60 for the server, 172.168.90.62 and 172.168.90.64 for the two clients with 255.255.0.0 as subnet mask for all the machines). same problem in all tries. Here is the AVTransmit2 class if you can suggest something. Thank you. AVTansmit2 import java.awt.*; import java.io.*; import java.net.InetAddress; import javax.media.*; import javax.media.protocol.*; import javax.media.protocol.DataSource; import javax.media.format.*; import javax.media.control.TrackControl; import javax.media.control.QualityControl; import javax.media.rtp.*; import javax.media.rtp.rtcp.*; import com.sun.media.rtp.*; public class AVTransmit2 { // Input MediaLocator // Can be a file or http or capture source private MediaLocator locator; private String ipAddress; private int portBase; private Processor processor = null; private RTPManager rtpMgrs[]; private DataSource dataOutput = null; public AVTransmit2(MediaLocator locator, String ipAddress, String pb, Format format) { this.locator = locator; this.ipAddress = ipAddress; Integer integer = Integer.valueOf(pb); if (integer != null) this.portBase = integer.intValue(); } /** * Starts the transmission. Returns null if transmission started ok. * Otherwise it returns a string with the reason why the setup failed…
tagged with: java
tagged with: rtp
type: Question
downvote count: 0
answer count: 1
tagged with: transmission
accepted answer: http://stackoverflow.com/a/38333311

http://stackoverflow.com/comment/39239723
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25197423
has text: @Fildor I have been asked to create an executable file. So, exe it is.

http://stackoverflow.com/comment/39183942
type: Comment
has text: There's cases where that makes sense and cases where it doesn't. It depends on whether other activities/services could be changing the database and how many things are in the database.
comment on: http://stackoverflow.com/q/25167207
score: 1
type: QuestionComment

http://stackoverflow.com/a/73928152
answers question: http://stackoverflow.com/q/25102156
downvote count: 0
has body: You can use this sample in kotlin: radioGroup.setOnCheckedChangeListener { _, checkedId -&gt; when (checkedId) { R.id.radioButton1 -&gt; { } R.id.radioButton2 -&gt; { } } }
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/25220613
score: 1
has body: You can simply write a public static void main-function and read your console-input (from PHP) - just pass the image path as parameter and you're done
upvote count: 1
answers question: http://stackoverflow.com/q/25219261
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39075341
score: 0
has text: Thanks, I solved using a Document Listener as you said. I also used Document Listener before too, but I associated it to a wrong event (KeyPressed)
type: Comment
comment on: http://stackoverflow.com/a/25108466
type: AnswerComment

http://stackoverflow.com/q/25098829
type: Question
has comment: http://stackoverflow.com/comment/39056227
duplicate of: http://stackoverflow.com/q/22899497
has comment: http://stackoverflow.com/comment/39056234
answer count: 0
type: UnansweredQuestion
score: 0
linked to: http://stackoverflow.com/q/22899497
tagged with: java
has title: JBoss 7 with JAVA 8
tagged with: jboss
has body: I noticed that when I upgraded my JDK from JAVA 7 to 8, my JBoss Server would no longer startup. I reverted back to JAVA 7, and JBoss works fine. Has anyone seen this behavior in your JBoss installations? I'm guessing JBoss isn't compatible with JBoss 7 at the moment?

http://stackoverflow.com/a/25169962
type: Answer
score: 1
upvote count: 1
has body: Ok so with help in the WinAmp forum I found out that this url needs to be requested with the user agent "Mozilla". So I added: method.setHeader("User-Agent","Mozilla"); And now I get a 200 OK response. Maybe this will help someone else with this type of problem. Joe
answers question: http://stackoverflow.com/q/25165524
downvote count: 0

http://stackoverflow.com/a/25209067
answers question: http://stackoverflow.com/q/25207561
score: 12
type: Answer
has comment: http://stackoverflow.com/comment/39262938
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/39263049
has body: I'm afraid the command you are looking for does not exist in vanilla Eclipse. You can try Shift+Alt+↑&nbsp;, which will select the enclosing element. It should eventually select to whole block. ←&nbsp; then moves the cursor to the beginning, →&nbsp; moves it to the end. But it really isn't any faster than: End to jump to the end of the line Ctrl+Shift+P to go to end of the block Ctrl+Shift+P again to go to start of the block If your code is somewhat reasonably formatted (i.e. not everything on one line), this should always work. Also check the list of possible shortcuts in Preferences->General->Keys, there isn't one that does what you want.

swing
tags question: http://stackoverflow.com/q/25222501
tags question: http://stackoverflow.com/q/25092306
tags question: http://stackoverflow.com/q/25196766
tags question: http://stackoverflow.com/q/25181937
tags question: http://stackoverflow.com/q/25131587
tags question: http://stackoverflow.com/q/25105330
tags question: http://stackoverflow.com/q/25076133
tags question: http://stackoverflow.com/q/25087035
tags question: http://stackoverflow.com/q/25188926
tags question: http://stackoverflow.com/q/25152523
tags question: http://stackoverflow.com/q/25145047
tags question: http://stackoverflow.com/q/25164177
tags question: http://stackoverflow.com/q/25104349
tags question: http://stackoverflow.com/q/25105375
tags question: http://stackoverflow.com/q/25169063
tags question: http://stackoverflow.com/q/25072621
tags question: http://stackoverflow.com/q/25227045
tags question: http://stackoverflow.com/q/25181929
tags question: http://stackoverflow.com/q/25109068
tags question: http://stackoverflow.com/q/25100297
tags question: http://stackoverflow.com/q/25071685
tags question: http://stackoverflow.com/q/25115143
tags question: http://stackoverflow.com/q/25198280
tags question: http://stackoverflow.com/q/25100798
tags question: http://stackoverflow.com/q/25175536
tags question: http://stackoverflow.com/q/25151677
tags question: http://stackoverflow.com/q/25120254
tags question: http://stackoverflow.com/q/25150488
tags question: http://stackoverflow.com/q/25174498
tags question: http://stackoverflow.com/q/25229429
tags question: http://stackoverflow.com/q/25164446
tags question: http://stackoverflow.com/q/25100768
tags question: http://stackoverflow.com/q/25098557
tags question: http://stackoverflow.com/q/25147384
tags question: http://stackoverflow.com/q/25109961
tags question: http://stackoverflow.com/q/25108447
tags question: http://stackoverflow.com/q/25185222
tags question: http://stackoverflow.com/q/25219423
tags question: http://stackoverflow.com/q/25162658
tags question: http://stackoverflow.com/q/25224792
tags question: http://stackoverflow.com/q/25136103
tags question: http://stackoverflow.com/q/25199764
tags question: http://stackoverflow.com/q/25147632
tags question: http://stackoverflow.com/q/25167235
tags question: http://stackoverflow.com/q/25100366
tags question: http://stackoverflow.com/q/25090273
tags question: http://stackoverflow.com/q/25109590
tags question: http://stackoverflow.com/q/25205130
tags question: http://stackoverflow.com/q/25188161
tags question: http://stackoverflow.com/q/25119211
tags question: http://stackoverflow.com/q/25100461
tags question: http://stackoverflow.com/q/25107393
tags question: http://stackoverflow.com/q/25154064
tags question: http://stackoverflow.com/q/25163805
tags question: http://stackoverflow.com/q/25159067
tags question: http://stackoverflow.com/q/25189269
tags question: http://stackoverflow.com/q/25103191
tags question: http://stackoverflow.com/q/25146601
tags question: http://stackoverflow.com/q/25078184
tags question: http://stackoverflow.com/q/25118785
tags question: http://stackoverflow.com/q/25183968
tags question: http://stackoverflow.com/q/25184138
tags question: http://stackoverflow.com/q/25084248
tags question: http://stackoverflow.com/q/25134263
tags question: http://stackoverflow.com/q/25227777
tags question: http://stackoverflow.com/q/25222404
tags question: http://stackoverflow.com/q/25111632
tags question: http://stackoverflow.com/q/25130608
tags question: http://stackoverflow.com/q/25225401
tags question: http://stackoverflow.com/q/25199083
tags question: http://stackoverflow.com/q/25161843
tags question: http://stackoverflow.com/q/25148287
tags question: http://stackoverflow.com/q/25147141
tags question: http://stackoverflow.com/q/25194609
tags question: http://stackoverflow.com/q/25071307
tags question: http://stackoverflow.com/q/25116722
tags question: http://stackoverflow.com/q/25218790
tags question: http://stackoverflow.com/q/25131904
tags question: http://stackoverflow.com/q/25198496
tags question: http://stackoverflow.com/q/25117232

http://stackoverflow.com/q/25199578
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39246931
has answer: http://stackoverflow.com/a/25257982
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/25201101
tagged with: jbutton
tagged with: java
type: Question
has title: How to place Jbuttons at a desired location and change colour between them?
has body: I am trying to place four buttons in the following order, but the buttons are sticking to the top and I want them to be placed at a different location. Here is my code: { JLabel back = new JLabel(new ImageIcon("C:\\Users\\file\\Desktop\\background.png")); JPanel p1 = new JPanel(); p1.setLayout(new GridLayout(2, 2, 80, 15)); p1.setBorder(BorderFactory.createLineBorder(Color.WHITE, 0)); add(back); back.setLayout(new FlowLayout()); p1.add(jbtstart); p1.add(jbtabout); p1.add(jbtcredits); p1.add(jbtexit); back.add(p1); jbtstart.addActionListener(this); jbtabout.addActionListener(this); jbtcredits.addActionListener(this); jbtexit.addActionListener(this); setContentPane(back); setTitle("Cooking App"); setSize(300, 250); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setLocationByPlatform(true); setVisible(true); } What have I to do?
tagged with: layout-manager

http://stackoverflow.com/q/25219504
favorite count: 0
has comment: http://stackoverflow.com/comment/39292164
tagged with: php
type: AnsweredQuestion
tagged with: uuid
score: 1
upvote count: 3
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/25345967
type: Question
has title: Get minecraft uuid by PHP script without API
tagged with: minecraft
accepted answer: http://stackoverflow.com/a/25345967
has body: How to get Minecraft player UUID for players with UTF-8 names, such as "игрок"? Any known API works incorrectly in this case. All the more so, API uses connection with externally resources, as I want to use only one PHP script. In Java code of getting UUID of player is: UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)) Need help for creating function analogue.
has comment: http://stackoverflow.com/comment/39289673
answer count: 1

http://stackoverflow.com/comment/39119444
type: Comment
has text: i do not want to retrieve data from DAO i just want to store data in DAO but ipsDetail values all are NULL.
comment on: http://stackoverflow.com/a/25132303
type: AnswerComment
score: 0

http://stackoverflow.com/q/25104784
answer count: 1
tagged with: oracle-database
tagged with: sql
has body: I am getting date in html 5 input type = "date" format..in mm/dd/yyyy format. Then I am getting it String fDate = request.getParameter("fromDate"); room.setFromDate(fDate); Then while trying to run query insert into tbl_room_under_maintenance(room_id,room_number,from_date,to_date) values(?,?,to_date(?,'MM/DD/YYYY'),to_date(?,'MM/DD/YYYY')) PS1.setString(3,room.getFromDate().trim()); PS1.setString(4,room.getToDate().trim()); it shows error : java.sql.SQLException: ORA-01843: not a valid month
favorite count: 0
has title: java.sql.SQLException: ORA-01843: not a valid month error
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39067053
has comment: http://stackoverflow.com/comment/39067821
upvote count: 0
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/39067107
type: Question
has comment: http://stackoverflow.com/comment/39067063
downvote count: 2
has answer: http://stackoverflow.com/a/25105465
tagged with: to-date
has comment: http://stackoverflow.com/comment/39068079
score: -2

http://stackoverflow.com/comment/39007474
has text: show your servlet code. check in browser network tab is your ajax call success or not.
score: 0
comment on: http://stackoverflow.com/q/25072453
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39068625
has text: Thank you brother, that has solved the issue. My takeaway from this is that setting setContentView(R.layout.activity_profile_creation); confused the users.
comment on: http://stackoverflow.com/a/25105548
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39052254
type: Comment
has text: Again, post the full stack trace with the full error message.
score: 1
comment on: http://stackoverflow.com/q/25096608
type: QuestionComment

http://stackoverflow.com/q/25168871
accepted answer: http://stackoverflow.com/a/25169205
linked to: http://stackoverflow.com/q/14757553
downvote count: 0
duplicate of: http://stackoverflow.com/q/14757553
tagged with: java.util.date
has body: I have been successfully using java.util.Date, and I would prefer to keep using it. Basically, I am having trouble forming the method calls to a class. I basically want to feed a date like 2014-08-06 into my Clojure program which will override using today as the date. This is so I can form a SQL query. I'm just not sure how to use the Java calls in Clojure. (def x1 (SimpleDateFormat. "yyyy-MM-dd")) I just don't know how to form the parse. Here's my core.clj (ns util.core ^{:author "Charles M. Norton", :doc "util is a Clojure utilities directory containing things most Clojure programs need, like cli routines. Created on April 4, 2012"} (:require [clojure.string :as cstr] [clojure.data.csv :as csv] [clojure.java.io :as io]) (:import java.util.Date) (:import java.text.SimpleDateFormat) (:import java.text.ParseException) (:import java.io.File) (:use clojure-csv.core)) Here is the Java code import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; public class MainClass { public static void main(String[] args) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); GregorianCalendar gc = new GregorianCalendar(); java.util.Date d = sdf.parse("12/12/2003");
has title: How to form java.util.Date calls in Clojure
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39188770
has comment: http://stackoverflow.com/comment/39187117
favorite count: 0
has answer: http://stackoverflow.com/a/25169205
type: Question
upvote count: 2
answer count: 1
tagged with: clojure
tagged with: java

http://stackoverflow.com/comment/39086812
type: AnswerComment
has text: @Matt: why don't you run the code. check whether it gives desired result or not?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25114540

http://stackoverflow.com/q/25088414
tagged with: java
accepted answer: http://stackoverflow.com/a/25096144
tagged with: .class-file
type: Question
tagged with: bytecode
downvote count: 0
score: 4
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/25096144
has answer: http://stackoverflow.com/a/25088664
favorite count: 0
has title: What are CONSTANT_MethodHandle, CONSTANT_MethodType, and CONSTANT_InvokeDynamic?
has body: I was looking into how the Java bytecode worked, and I started on Wikipedia. On the page focusing on the .class file, it mentions 11 constant types that appear in the Constant Pool. However, in The Java Virtual Machine Specifications (JVMS) it mentions 3 more: CONSTANT_MethodHandle CONSTANT_MethodType CONSTANT_InvokeDynamic The 11 mentioned on the Wikipedia page seem fairly self-explanatory, and I understand their purpose and use. However, I'm confused by the 3 extra described in the JVMS. What are they, and for what are they used?
possible better answer: http://stackoverflow.com/a/25088664
type: AnsweredQuestion

http://stackoverflow.com/comment/77856503
type: QuestionComment
comment on: http://stackoverflow.com/q/25163252
has text: By the way it is com.mysql.jdbc.Driver Not com.mysql.jdc.Driver :) Just mentioning. :)
score: 0
type: Comment

http://stackoverflow.com/a/25072096
has body: I see that you already have a few good literal translations of the code in other answers, but what you really want to write is the following, which is clear, readable, and relies on a trusted library: public static int dow(int y, int m, int d) { Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, y); c.set(Calendar.MONTH, m - 1); c.set(Calendar.DAY_OF_MONTH, d); return (c.get(Calendar.DAY_OF_WEEK) - 1); } The - 1 at the end is only to map the numeric day-of-week representation that Java uses (where Sunday=1 and Saturday=7) to the same mappings as in the original code. Similar with the m - 1 too.
type: Answer
answers question: http://stackoverflow.com/q/25071547
score: 0

http://stackoverflow.com/a/25175549
score: 1
type: Answer
has body: A wildcard generic can be used with any generic type, for example Class&lt;?&gt; public void myFunction(Class&lt;?&gt; theObject) { // your code goes here }
upvote count: 1
answers question: http://stackoverflow.com/q/25175511
downvote count: 0

http://stackoverflow.com/a/25175349
has comment: http://stackoverflow.com/comment/39205306
has comment: http://stackoverflow.com/comment/39198680
type: Answer
has comment: http://stackoverflow.com/comment/39198579
upvote count: 1
has comment: http://stackoverflow.com/comment/39239673
answers question: http://stackoverflow.com/q/25172331
has comment: http://stackoverflow.com/comment/39217324
has body: Basically you shouldn't try to share a single hibernate Session between threads. Hibernate sessions, nor the entity objects, are threadsafe and that can lead to some suprising problems. Here and [here]3[] is a small but nice read there is also some value in the comments. Basically don't try to share a Session between threads. There is also another problem as the whole transaction management is based around ThreadLocal objects, the same goes for obtaining the current session and underlying JDBC connection. Now trying to spawn threads will lead to suprising problems, one of them would be connection pool starvation. (Note: don't open too many connections, more information here). Next to not to opening to much connections you should be aware of starting to many threads. A Thread is bound to a cpu (or core if you have multiple cores). Adding to many threads might lead to heavy sharing of a single cpu/core between to many threads. This can kill your performance instead of increasing it. In short IMHO your approach is wrong, each thread should simply read the entity it cares about, do its thing and commit the transaction. I would suggest using something like Spring Batch for this instead of inventing your own mechanism. (Although if it is simple enough I would probably go for it).
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39257400

http://stackoverflow.com/comment/39284483
type: Comment
has text: thanks for your reply ,,yes i tried to do the sub-panels but am afraid if the code change or something happen to code
type: AnswerComment
comment on: http://stackoverflow.com/a/25221281
score: 0

http://stackoverflow.com/a/25143188
type: Answer
has body: Why couldn't regex: &lt;post\\s*author=\"([^\"]+)\"[^&gt;]+&gt;[^&lt;/post&gt;]*&lt;/post&gt; extract the author in following text. Because [^&lt;/post&gt;]* represents a character class and will match everything but the characters &lt;, /, p, o, s, t, and &gt; 0 or more times. That doesn't happen in your text. As for how to fix it, consider using the following regex &lt;post\s*author=\"([^\"]+?)\"[^&gt;]+&gt;(.|\s)*?&lt;\/post&gt; // obviously, escape appropriate characters in Java String literals with a multiline flag.
score: 1
has comment: http://stackoverflow.com/comment/39140447
upvote count: 1
has comment: http://stackoverflow.com/comment/39141113
accepted answer of: http://stackoverflow.com/q/25142957
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39138716
has comment: http://stackoverflow.com/comment/39138750
answers question: http://stackoverflow.com/q/25142957

http://stackoverflow.com/a/25084605
has comment: http://stackoverflow.com/comment/44060177
answers question: http://stackoverflow.com/q/25073276
has comment: http://stackoverflow.com/comment/39215112
type: Answer
has comment: http://stackoverflow.com/comment/39215392
has comment: http://stackoverflow.com/comment/39408919
has comment: http://stackoverflow.com/comment/39444757
has comment: http://stackoverflow.com/comment/63230475
has comment: http://stackoverflow.com/comment/39357419
score: 2
has comment: http://stackoverflow.com/comment/39102267
upvote count: 2
has comment: http://stackoverflow.com/comment/39218086
has comment: http://stackoverflow.com/comment/39093050
has comment: http://stackoverflow.com/comment/63305458
has comment: http://stackoverflow.com/comment/39374867
has comment: http://stackoverflow.com/comment/39303677
has comment: http://stackoverflow.com/comment/63222695
has comment: http://stackoverflow.com/comment/63340210
has comment: http://stackoverflow.com/comment/39414878
has comment: http://stackoverflow.com/comment/63299912
has comment: http://stackoverflow.com/comment/39367707
has body: SCEP is quite complex protocol. You can't just send a .pem back or plist. As I remember you have to send a certificate encrypted/signed in PKCS7 envelope. Frankly, you don't want to spend time figuring out this protocol and implementing it. I would recommend to go with jSCEP library which implements it or EJBCA which implements it either. BTW. You can just send a random certificate in the response to this SCEP request, you actually need to extract get CSR which is part of this request, sign it and send this newly created certificate back. Your other option is use PKCS12. In this case, you don't need to have SCEP server. You just send certificate + private key in PKCS12 form. However, it's less secure option (because your server knows private key of a device).
downvote count: 0

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

http://stackoverflow.com/q/25087449
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/39035669
has title: How to remove non-breaking spaces from HTML hard coding
tagged with: java
tagged with: hard-coding
downvote count: 1
has comment: http://stackoverflow.com/comment/39036534
type: Question
has comment: http://stackoverflow.com/comment/39037906
score: -1
has answer: http://stackoverflow.com/a/25087710
upvote count: 0
answer count: 1
has body: I know this has been asked before in different ways, however, I am new to Javascript coding and don't entirely understand how to tailor the advice for my issue. I am trying to remove the "&amp;nbsp" from the line of hard coding below... actually, if I could remove the whole table row that would be great. &lt;tr class="Contents"&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; I cannot edit the HTML code to remove the space or table row myself because it is hard-coded into the system I'm working with. However, I can add CSS and Javascript codes to override formatting and hide things. I cannot hide the class "Contents" or the "tr, td" attributes because other elements within the code are using those identifiers. How can I go about hiding this specific line of coding, or others like it, using CSS or Javascript? Edit: The original HTML code itself cannot be modified. The system I am using restricts modification of the html hard coding because some of the elements are necessary for the program to work. However, this specific code is used as a line break to create space above and below a "register" button, and it is not needed on a new design. I can use CSS or javascript to impose modifications, but the original coding cannot be touched.
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39037797

http://stackoverflow.com/q/25160556
has answer: http://stackoverflow.com/a/25160680
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/25160621
accepted answer: http://stackoverflow.com/a/25160621
tagged with: c#
possible better answer: http://stackoverflow.com/a/25160624
downvote count: 0
upvote count: 13
has body: I have been looking for a way to make a "package folder" in visual studio express 2013, the way I might do it in java is a "package" I know that I can make whole new projects called "Visual Studio Package Projects" via a wizards but all I really want is a ~container~ that puts a dot in the class name! A folder by any other name! THIS IS WHAT I AM LOOKING FOR THIS IS WHAT I AM PRESENTED WITH
answer count: 3
has title: Equivalent to java packages in C#
favorite count: 0
tagged with: visual-studio-2013
tagged with: package
has answer: http://stackoverflow.com/a/25160624
score: 13
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/39008279
comment on: http://stackoverflow.com/a/25072901
type: AnswerComment
score: 0
type: Comment
has text: The code above does not have this kind of behavior you described. If the user enters "0" it will exit (return).

http://stackoverflow.com/q/25081761
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25082137
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/39024534
has comment: http://stackoverflow.com/comment/39024285
has comment: http://stackoverflow.com/comment/39024102
has title: how to execute cmd command using another program in java
type: AnsweredQuestion
score: 2
has body: I want to make a program that open another java programs.how can i run/execute the cmd command in compiling and running java programs. for example c:\Users\Burnok> javac HelloWorld.java and c:\Users\Burnok> java HelloWorld how can i do that inside the java program? please help. I tried this code but it compiled successfully but if i tried to run the HelloWorld.class it says that the could not find or load main class. import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import javax.tools.JavaCompiler; import javax.tools.ToolProvider; public class Test { private static void printLines(String name, InputStream ins) throws Exception { String line = null; BufferedReader in = new BufferedReader( new InputStreamReader(ins)); while ((line = in.readLine()) != null) { System.out.println(name + " " + line); } } private static void runProcess(String command) throws Exception { Process pro = Runtime.getRuntime().exec(command); printLines(command + " stdout:", pro.getInputStream()); printLines(command + " stderr:", pro.getErrorStream()); pro.waitFor(); } public static void main(String[] args) { try { runProcess("javac src/HelloWorld.java"); runProcess("java src/HelloWorld"); } catch (Exception e) { e.printStackTrace(); } } } here is the error java src/HelloWorld stderr: Error: Could not find or load main class src.HelloWorld
tagged with: java
linked to: http://stackoverflow.com/q/4842684
has comment: http://stackoverflow.com/comment/39024199
has comment: http://stackoverflow.com/comment/39024701
linked to: http://stackoverflow.com/q/1190018
type: Question
has answer: http://stackoverflow.com/a/25082137

http://stackoverflow.com/comment/39007982
type: Comment
comment on: http://stackoverflow.com/a/25073110
has text: it shows error. mt tokenlist is of type List<List<String>> tokenList
score: 0
type: AnswerComment

http://stackoverflow.com/q/25162215
has title: cannot alter action bar background
has comment: http://stackoverflow.com/comment/39174572
favorite count: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
score: 1
tagged with: android-actionbar
upvote count: 1
has body: I am trying to change the background color of my action bar into a solid color but it just wont change. Here is the code that I have: /res/values/themes.xml <?xml version="1.0" encoding="utf-8"?> res/values/styles.xml: (where the color is) #8793FF /AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.example.fragment.MainActivity" /> When I change the parent in themes.xml, it does apply it, i.e. if I change it to AppCompat.Light, however I do not know how to change the background color. I have looked around on the internet and Stack Overflow and none of the answers addressed my issue.
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25163187
answer count: 1
downvote count: 0

opennlp
type: Tag
tags question: http://stackoverflow.com/q/25085569
tags question: http://stackoverflow.com/q/25157935
tag name: opennlp

http://stackoverflow.com/a/25094033
upvote count: 6
has comment: http://stackoverflow.com/comment/139300037
has body: Advisors seem to be an old "AOP lite" type of defining cross-cutting concerns from Spring 1.2 when Java 5 usage was still somewhat uncommon and thus @AspectJ syntax (via Java annotations) not used in Spring. The concept has still survived for lovers of schema-based AOP rather than annotation-based AOP or pure AspectJ syntax, see Spring documentation on advisors. The concept of "advisors" comes from the AOP support defined in Spring and does not have a direct equivalent in AspectJ. An advisor is like a small self-contained aspect that has a single piece of advice. The advice itself is represented by a bean and must implement one of the advice interfaces described in Advice Types in Spring. Advisors can take advantage of AspectJ pointcut expressions.
answers question: http://stackoverflow.com/q/25092302
type: Answer
score: 6
downvote count: 0
has comment: http://stackoverflow.com/comment/122975288

servlets
tags question: http://stackoverflow.com/q/25183297
tags question: http://stackoverflow.com/q/25161448
tags question: http://stackoverflow.com/q/25094113
tags question: http://stackoverflow.com/q/25179806
tags question: http://stackoverflow.com/q/25175289
tags question: http://stackoverflow.com/q/25116808
tags question: http://stackoverflow.com/q/25141858
tags question: http://stackoverflow.com/q/25168254
tags question: http://stackoverflow.com/q/25086906
tags question: http://stackoverflow.com/q/25097408
tags question: http://stackoverflow.com/q/25081504
tags question: http://stackoverflow.com/q/25184806
tags question: http://stackoverflow.com/q/25122660
tags question: http://stackoverflow.com/q/25125781
tags question: http://stackoverflow.com/q/25151264
tags question: http://stackoverflow.com/q/25104930
tags question: http://stackoverflow.com/q/25083831
tags question: http://stackoverflow.com/q/25095943
tags question: http://stackoverflow.com/q/25191547
tags question: http://stackoverflow.com/q/25104755
tags question: http://stackoverflow.com/q/25094333
tags question: http://stackoverflow.com/q/25227581
tags question: http://stackoverflow.com/q/25069869
tags question: http://stackoverflow.com/q/25121216
tags question: http://stackoverflow.com/q/25091736
tags question: http://stackoverflow.com/q/25155747
tags question: http://stackoverflow.com/q/25072453
tags question: http://stackoverflow.com/q/25084955
tags question: http://stackoverflow.com/q/25164932
tags question: http://stackoverflow.com/q/25219263
tags question: http://stackoverflow.com/q/25226343
tags question: http://stackoverflow.com/q/25115262
tags question: http://stackoverflow.com/q/25182650
tags question: http://stackoverflow.com/q/25137790
tags question: http://stackoverflow.com/q/25150470
tags question: http://stackoverflow.com/q/25193278
tags question: http://stackoverflow.com/q/25137791
tags question: http://stackoverflow.com/q/25199107
tags question: http://stackoverflow.com/q/25223175
tags question: http://stackoverflow.com/q/25176514
tags question: http://stackoverflow.com/q/25161073
tags question: http://stackoverflow.com/q/25121506
tags question: http://stackoverflow.com/q/25196984
tags question: http://stackoverflow.com/q/25195128
tags question: http://stackoverflow.com/q/25075503
tags question: http://stackoverflow.com/q/25182986
tags question: http://stackoverflow.com/q/25215379
tags question: http://stackoverflow.com/q/25138517
tags question: http://stackoverflow.com/q/25187843
tags question: http://stackoverflow.com/q/25085458
tags question: http://stackoverflow.com/q/25200664
tags question: http://stackoverflow.com/q/25205517
tags question: http://stackoverflow.com/q/25077402
tags question: http://stackoverflow.com/q/25140571
tags question: http://stackoverflow.com/q/25070639
tags question: http://stackoverflow.com/q/25225137
tags question: http://stackoverflow.com/q/25179723
tags question: http://stackoverflow.com/q/25100122
tags question: http://stackoverflow.com/q/25200112
tags question: http://stackoverflow.com/q/25103254
tags question: http://stackoverflow.com/q/25105907
tags question: http://stackoverflow.com/q/25139974
tags question: http://stackoverflow.com/q/25198367
tags question: http://stackoverflow.com/q/25126980
tags question: http://stackoverflow.com/q/25165047
tags question: http://stackoverflow.com/q/25130820
tags question: http://stackoverflow.com/q/25188272
tags question: http://stackoverflow.com/q/25114192
tags question: http://stackoverflow.com/q/25195907
tags question: http://stackoverflow.com/q/25121116
tags question: http://stackoverflow.com/q/25168519
tags question: http://stackoverflow.com/q/25097435
tags question: http://stackoverflow.com/q/25209084
tags question: http://stackoverflow.com/q/25158481
tags question: http://stackoverflow.com/q/25139019
tags question: http://stackoverflow.com/q/25114549
tags question: http://stackoverflow.com/q/25202581
tags question: http://stackoverflow.com/q/25193217
tag name: servlets
tags question: http://stackoverflow.com/q/25219135

http://stackoverflow.com/q/25106584
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/39076785
has body: I'm looking for an example of a real-time graph data visualizatior in Java, but i've only found this one, and it's not a dynamic real time visualizator: import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.RenderingHints; import java.awt.Stroke; import java.util.ArrayList; import java.util.List; import java.util.Random; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class GraphPanel extends JPanel { private int width = 800; private int heigth = 400; private int padding = 25; private int labelPadding = 25; private Color lineColor = new Color(44, 102, 230, 180); private Color pointColor = new Color(100, 100, 100, 180); private Color gridColor = new Color(200, 200, 200, 200); private static final Stroke GRAPH_STROKE = new BasicStroke(2f); private int pointWidth = 4; private int numberYDivisions = 10; private List<Double> scores; public GraphPanel(List<Double> scores) { this.scores = scores; } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); double xScale = ((double) getWidth() - (2 * padding) - labelPadding) / (scores.size() - 1); double yScale = ((double) getHeight() - 2 * padding - labelPadding) / (getMaxScore() - getMinScore()); List<Point> graphPoints = new ArrayList<>(); for (int i = 0; i < scores.size(); i++) { int x1 = (int) (i * xScale + padding + labelPadding); int y1 = (int) ((getMaxScore() - scores.get(i)) * yScale + padding); graphPoints.add(new Point(x1, y1)); } // draw white background g2.setColor(Color.WHITE); g2.fillRect(padding + labelPadding, padding, getWidth() - (2 * padding) - labelPadding, getHeight() - 2 * padding - labelPadding); g2.setColor(Color.BLACK); // create hatch marks and grid lines for y axis. …
has comment: http://stackoverflow.com/comment/39070909
type: Question
tagged with: graph
score: 3
has comment: http://stackoverflow.com/comment/39070858
has comment: http://stackoverflow.com/comment/39070836
has title: Make Real-Time StreamGraph (Graph Data Visualization) in Java
upvote count: 4
linked to: http://stackoverflow.com/q/5048852
tagged with: stream-graph
linked to: http://stackoverflow.com/q/8693342
has comment: http://stackoverflow.com/comment/39070992
favorite count: 0
type: UnansweredQuestion
tagged with: data-visualization
has comment: http://stackoverflow.com/comment/39076746
has comment: http://stackoverflow.com/comment/39070955
has comment: http://stackoverflow.com/comment/39070754
answer count: 0

http://stackoverflow.com/q/25149353
downvote count: 2
has comment: http://stackoverflow.com/comment/39150840
has comment: http://stackoverflow.com/comment/39150528
has title: How do I find out of a certain character is the first or second or third occurrence in a string?
has comment: http://stackoverflow.com/comment/39150555
tagged with: java
has body: If I had a string like "telephone" and wanted the output to come back as tel*phon*, how would I do that? The program would print back out each letter in the string. If it's the first time that letter is appearing then I'd write it. But if it reappears, I would print an asterisk. hello would be hel*o goodbye would be go*dbye coordination would be co*rdinat*** (oops you're right) Please help thanks! And this is not homework... this is practice for the final coming up! Thanks!! I'm trying something like... but I just don't get how to get further... Please help Scanner keyboard = new Scanner(System.in); String s; int i, j, count; System.out.print("Enter string: "); s = keyboard.nextLine(); for(i=0; i &lt; s.length(); i++){ count = 0; for(j=i+1; i &lt; s.length(); j++){ if(s.charAt(i) == s.charAt(j)){ count++; } if(count &lt; 1) System.out.print(s.charAt(i)); else System.out.print("*"); } } Some told me to post my code so I did now. How would I edit this exact code to make it work? Please help :(
type: Question
has answer: http://stackoverflow.com/a/25149394
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25149403
favorite count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/25134774
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/39123091
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39123660
has answer: http://stackoverflow.com/a/25135243
has comment: http://stackoverflow.com/comment/39123565
has comment: http://stackoverflow.com/comment/39123150
type: Question
tagged with: jakarta-ee
answer count: 2
has body: I have set a List of book and set to the request.setAttribute("booksa", allbooks); and in jsp i try to print the List in table but no values printed only the empty table. This is my Servelet protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String userPath = request.getServletPath(); if (userPath.equals("/index")) { // TODO: Implement category request userPath = "/index"; } else if (userPath.equals("/books")) { List<Book> allbooks = bookFacade.findAll(); userPath = "/books"; request.setAttribute("booksa", allbooks); //System.out.print(allbooks); } else { } String url = userPath + ".jsp"; try { request.getRequestDispatcher(url).forward(request, response); } catch (Exception ex) { ex.printStackTrace(); } } This is my Book.jsp page ISBN TITLE PRICE YEARS LANGUAGE <c:forEach var="vehicle" items="${booksa}"> <c:out value="${vehicle.isbn}" /> <c:out value="${vehicle.title}" /> <c:out value="${vehicle.price}" /> <c:out value="${vehicle.years}" /> <c:out value="${vehicle.languages}" /> </c:forEach> But when i redirect to this page the view page source show like this <c:forEach var="vehicle" items="[ejb.Book[ isbn=SR001 ]]"> <c:out value="" /> <c:out value="" /> <c:out value="" /> <c:out value="" /> <c:out value="" /> </c:forEach> My Book class public Book() { } public Book(String isbn) { this.isbn = isbn; } public Book(String isbn, String title, double price, int years, String languages) { this.isbn = isbn; this.title = title; this.price = price; this.years = years; this.languages = languages; } public String getIsbn() { return isbn; } public void setIsbn(String isbn) { this.isbn = isbn; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getYears() { return years; } public void setYears(int years) { this.years = years; } public String getLangua…
score: 0
has title: Servelet set attribute doesn't print in jsp
has answer: http://stackoverflow.com/a/25135646
accepted answer: http://stackoverflow.com/a/25135646
tagged with: jsp
possible better answer: http://stackoverflow.com/a/25135243
has comment: http://stackoverflow.com/comment/39122939
has comment: http://stackoverflow.com/comment/39123722
linked to: http://stackoverflow.com/q/1521257

http://stackoverflow.com/comment/39270036
has text: @ChiefTwoPencils how come this is not an answer when it is getting rid the issue? and make the code more readable?
comment on: http://stackoverflow.com/a/25213575
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25154039
downvote count: 0
answer count: 1
favorite count: 0
has body: I've got an app that adds file's content row by row into data base. If file is not so big (smaller, than 100 kB) it will work well, but I can not say the same about big files. I found out that INSERT query takes about 1 msc, so 50k INSERT takes 50 sec. I find it very slow. This is my plan: if file is big enough, do INSERT in another thread if not, do it synchronously So, every user will run new thread, if file is big. I mean that I can not use one instance of this thread, every user will run new. Is it a good idea or not? How would you do?
has answer: http://stackoverflow.com/a/25154623
type: AnsweredQuestion
upvote count: 2
has title: Perfomance in Spring MVC app
tagged with: multithreading
tagged with: spring
type: Question
accepted answer: http://stackoverflow.com/a/25154623
tagged with: java
tagged with: servlets
has comment: http://stackoverflow.com/comment/39159845
score: 2

http://stackoverflow.com/q/25178474
has title: GWT: how to format number on server and client (Gin/Guice)
tagged with: number-formatting
favorite count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: google-app-engine
has body: In my GWT + App Engine project, I have a function that formats a double into a String that I need to use on the client and server side. As you cannot use DecimalFormat in GWT, you have to use NumberFormat on the client-side, and DecimalFormat on the server-side. I have a class that is used on both sides of the wire (UnitRate) which needs to use this function, so I implemented two classes: ClientUtilities and ServerUtilities which both implement the Utilities interface like so: public interface Utilities extends Serializable { public String formatUnitOnePlace(Double value); } public class ClientUtilities implements Utilities { @Override public String formatUnitOnePlace(Double value) { NumberFormat fmt = NumberFormat.getFormat("#0.0"); return fmt.format(value); } } public class ServerUtilities implements Utilities { @Override public String formatUnitOnePlace(Double value) { DecimalFormat oneDigit = new DecimalFormat("#0.0");// format to 1 decimal place return oneDigit.format(value); } } The initial idea was to bind the classes using Gin/Guice and inject Utilities into the UnitRate class so that the right implementation gets used depending which side of the wire we are on. UnitRate can be a child of Offer (server-side) and OfferDto (client-side), but this is seeming like a rather long-winded way to do it as the UnitRate entities need to be created by hand, and the only way to do it I have managed is using Assisted Injection. This however which is creating a ripple effect through the program meaning that more and more of my domain model has dependencies so need to be created by Gin/Guice which is obviously not ideal. See usage here: public class UnitRate implements Serializable, HasUnitType, Comparable&lt;HasUnitType&gt;, HasTotal { // omitted for brevity private Utilities utilities; @AssistedInject private UnitRate(@Assisted UnitType unitType, Utilities utilities) { this.unitType = unitType; this.price = ""; this.utilities = utilities; } @Override public String getTota…
tagged with: decimalformat
tagged with: gwt
score: 2
linked to: http://stackoverflow.com/q/6510039
tagged with: java
has comment: http://stackoverflow.com/comment/39220665
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/25188297
answer count: 1

http://stackoverflow.com/a/25194331
has comment: http://stackoverflow.com/comment/39235738
has comment: http://stackoverflow.com/comment/39285244
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39267798
has comment: http://stackoverflow.com/comment/39339201
answers question: http://stackoverflow.com/q/25194267
downvote count: 0
has comment: http://stackoverflow.com/comment/39234541
has comment: http://stackoverflow.com/comment/39237730
has comment: http://stackoverflow.com/comment/39339642
has comment: http://stackoverflow.com/comment/39235802
has comment: http://stackoverflow.com/comment/39267451
has comment: http://stackoverflow.com/comment/39235078
has body: There is an error in your appengine-application.xml file. The code and trace you listed in your question is not related to this problem.
type: Answer

storage
tag name: storage
tags question: http://stackoverflow.com/q/25153075
type: Tag
tags question: http://stackoverflow.com/q/25115706

http://stackoverflow.com/comment/39109159
type: Comment
type: QuestionComment
has text: is bufImg null in the finally clause?
comment on: http://stackoverflow.com/q/25126953
score: 0

http://stackoverflow.com/q/25124387
type: AnsweredQuestion
tagged with: inner-classes
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25124414
has answer: http://stackoverflow.com/a/25124417
answer count: 2
upvote count: 0
has title: Trouble with creating inner class
possible better answer: http://stackoverflow.com/a/25124417
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/39103968
has answer: http://stackoverflow.com/a/25124414
has body: I'm trying to make an inner class(button) inside the class "learn" but I'm getting an error.From my memory the way i'm doing it now used to work for me but now it's giving me an error.Am I doing something wrong? Here is the code: package Lib; import java.awt.BorderLayout; import java.awt.Dimension; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.net.UnknownHostException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.ScrollPaneConstants; public class learn { Socket s; PrintWriter pw; InputStreamReader read; BufferedReader reader; public void setUpNetworking(){ try { s = new Socket("24.7.31.101",5000); pw = new PrintWriter(s.getOutputStream()); read = new InputStreamReader(s.getInputStream()); reader = new BufferedReader(read); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public class button(){ } public void go(){ JFrame f = new JFrame(); JPanel p = new JPanel(); JPanel p2 = new JPanel(); JTextArea messages = new JTextArea(); JTextField userSend = new JTextField(); JButton sending = new JButton("Send"); JScrollPane message = new JScrollPane(messages); userSend.setPreferredSize(new Dimension(300,22)); messages.setLineWrap(false); messages.setPreferredSize(new Dimension(500,500)); messages.setEditable(false); message.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); message.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); p.add(message); p2.add(userSend); p2.add(sending); f.add(p,BorderLayout.NORTH); f.add(p2,BorderLayout.SOUTH); f.setVisible(true); f.setSize(new Dimension(600,600)); } public static void main(String args[]){ learn l = …

http://stackoverflow.com/comment/39283115
type: QuestionComment
has text: You have commented out **setContentView(R.layout.main);** in your code.please uncomment that line..
comment on: http://stackoverflow.com/q/25220592
score: 0
type: Comment

http://stackoverflow.com/comment/39054890
score: 0
type: Comment
type: QuestionComment
has text: Thanks, Any other way to put textfiles with "geophysical graduation 0.1321' in the hashmap?
comment on: http://stackoverflow.com/q/25098038

http://stackoverflow.com/q/25182650
favorite count: 0
has answer: http://stackoverflow.com/a/25182721
has comment: http://stackoverflow.com/comment/39211266
type: AnsweredQuestion
has body: hi i am new into jsp and servelet.i know jsp converted to servlet and servelet to class file.i want to know is that how jspfle.class converted into html?and how this response is gone at client level.i know life cyckle of jspbut dont know after .class file got. I gone through this site JSP life cycle! and this one Second link!. But didnt get idea how actually converted from .class file to html.what internally server is doing with .class file to show it to end user/client.
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/25182721
type: Question
tagged with: jakarta-ee
possible better answer: http://stackoverflow.com/a/25182724
has answer: http://stackoverflow.com/a/25182724
tagged with: servlets
answer count: 2
downvote count: 0
tagged with: jsp
has title: JSP class file to HTML

http://stackoverflow.com/comment/39207802
score: 0
type: AnswerComment
has text: Just do: new ArrayList<String>()
comment on: http://stackoverflow.com/a/25180746
type: Comment

http://stackoverflow.com/a/25086121
answers question: http://stackoverflow.com/q/25085590
score: 0
has comment: http://stackoverflow.com/comment/39032721
has body: The built-in Gallery scans the phones memory when it thinks it's necessary. You can't force it to. Normaly restarting the gallery should help. Edit: I might have found an intent to refresh the gallery: Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); Uri contentUri = Uri.fromFile(f); mediaScanIntent.setData(contentUri); getApplicationContext().sendBroadcast(mediaScanIntent); (f is the file wich has been added and should be scanned.) I haven't tried this yet, but it seems legit.
type: Answer

http://stackoverflow.com/a/25138686
downvote count: 0
has body: Because of dynamic dispatch, whenever you invoke a method like hashCode() or any other method, the particular function that is called depends on the runtime type of the object (not the declared type of the object). The ObjectInputStream/ObjectOutputStream will preserve the runtime type of objects (the runtime class is written on serialization and is thus used to instantiate the object on deserialization). Your cast operation just checks that the result is of the correct type (it isn't the reason that the deserialized data is of that type), and it isn't causing the data to be converted or truncated (if that was what you were worried or concerned was happening here). As for List&lt;T&gt;, the hash method is not tied to a particular type argument. The fact that the type was erased (which is how the structure is internally represented, anyway) does not change the behavior.
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25138414
type: Answer
accepted answer of: http://stackoverflow.com/q/25138414
score: 2

http://stackoverflow.com/q/25092695
has comment: http://stackoverflow.com/comment/39044969
upvote count: 1
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: mysql
has body: I was wondering if it's possible to grey out or render some rows in my JTable to be invisible using the data from my data base? These are the columns in my JTable: public DutyModel(ArrayList&lt;Duty&gt; listOfObjects) { rowCount = listOfObjects.size(); colCount = columnNames.length; data = new Object[rowCount][colCount]; for (int i = 0; i &lt; rowCount; i++) { /* Copy an ArrayList element to an instance of MyObject */ Duty d1 = (Duty) (listOfObjects.get(i)); data[i][0] = d1.getDutyId(); data[i][1] = d1.getDutyName(); data[i][2] = d1.getDutyDesc(); data[i][3] = d1.getDutySectorName(); data[i][4] = d1.getDutyStatus(); } } When my table is displayed, I want the rows with d1.getDutyStatus() where dutyStatus = "Inactive" to be greyed out. My table can currently be updated to either "Active" (By pressing an update button), or "Inactive" (By pressing a remove button). I don't want the user to be able to edit any of the duties that have the dutyStatus of "Inactive". Any assistance or help is greatly appreciated. Thanks! The below code is what happens when the user selects a row in the JTable and presses the "Update" and "Delete" button. Also, I'm trying to use a 3 tier architecture to run my codes, my controller class is RetrieveDutyControl and my entity is Duty. public void actionPerformed(ActionEvent e) { int rowSelected = tblDutyList.getSelectedRow(); if (rowSelected &gt;= 0) { String idDuty = tblDutyList.getValueAt(rowSelected, 0) .toString(); String name = tblDutyList.getValueAt(rowSelected, 1) .toString(); String desc = tblDutyList.getValueAt(rowSelected, 2) .toString(); String sector = tblDutyList.getValueAt(rowSelected, 3) .toString(); String status = tblDutyList.getValueAt(rowSelected, 4) .toString(); Duty duty = new Duty(Integer.parseInt(idDuty), name, desc, sector, status); RetrieveDutyControl rdc = new RetrieveDutyControl(); ArrayList&lt;Duty&gt; dutyList = rdc.processRetrieveDuties(duty); JPanel contentPane = new RemoveDutyForm(myFrame, duty); myFrame.getConten…
accepted answer: http://stackoverflow.com/a/25092750
type: Question
answer count: 1
downvote count: 0
tagged with: jtable
favorite count: 0
has answer: http://stackoverflow.com/a/25092750
has title: Disable particular row in JTable using data from database
has comment: http://stackoverflow.com/comment/39044958

http://stackoverflow.com/comment/39227437
comment on: http://stackoverflow.com/a/25190854
has text: please explain to me why do you use span1.length() on both span? @Rawa
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25079619
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25077196
has body: You can express equivalent query in JPA: SELECT * FROM A WHERE Id='A' AND EventType = 'Start' AND Id NOT IN ( SELECT Id from A WHERE Id='A' AND EventType = 'endEvent') using this approach.

http://stackoverflow.com/comment/39035870
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25087615
score: 0
has text: So you execute it directly from Tomcat...

http://stackoverflow.com/comment/39099384
comment on: http://stackoverflow.com/a/25120926
score: 1
has text: Got it. I am also having trouble understanding what exactly you meant by "so, by shifting an address 3 bits to the left, we can "compress" up to a 35 bits of a 64 bit address into a 32 bit word,".. How did you arrive at the number 35?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39006104
type: Comment
has text: hi friend, does this APIs can send those emails even if the PC is turned off.
comment on: http://stackoverflow.com/a/25071882
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39069986
comment on: http://stackoverflow.com/a/25106308
has text: Did you try invalidate and repaint? Maybe make it 100 milli seconds instead of 2 seconds.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25140341
linked to: http://stackoverflow.com/q/25083692
has title: User input not being captured on first attempt time batch file
tagged with: java
has comment: http://stackoverflow.com/comment/39140711
type: Question
has answer: http://stackoverflow.com/a/25144386
score: 0
tagged with: batch-file
answer count: 1
type: UnansweredQuestion
has body: I have this weird thing going on that I can't figure out. In my batch script I'm running a java cli program that connects to a server which I have no problems doing. But in order to run the program I have the user type in their server credentials. If the login fails, I get an "Error" string as a response from the java program which I then ask the user if they want to try again. After checking the response for "Error", my problem occurs when asking the user if they want to try again. For whatever reason nothing get captured/stored in my tryAgain variable. for /f %%i in ('java -jar cli-launcher.jar -a https://127.0.0.1:8000 -u admin -p admin -s someOtherScript.txt) do set response=%%i ::Something about this IF statement is causing an issue IF NOT %response::=%==Error (echo "No Error" ) else (SET /p tryAgain=Try Again: echo "%tryAgain%" ) EDIT: Looks like my problem has to with my checking of the response string. When I pull out the tryAgain user capture, it works fine. Can anyone see what I'm doing wrong? for /f %%i in ('java -jar cli-launcher.jar -a https://127.0.0.1:8000 -u admin -p admin -s someOtherScript.txt) do set response=%%i ::This works fine SET /p tryAgain=Try Again: echo "%tryAgain%"

http://stackoverflow.com/comment/39130545
type: Comment
has text: Without seeing the read method, a SwingWorker might be a better choice
comment on: http://stackoverflow.com/a/25137884
score: 2
type: AnswerComment

http://stackoverflow.com/comment/39125832
has text: did you place the .class file inside classes folder/
comment on: http://stackoverflow.com/q/25136412
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25147739
upvote count: 2
has body: Which library to choose for mapping JAXB generated objects to business/domain objects? I'm just thinking between Dozer, Apache Commons BeanUtils, Spring BeanUtils. I read that Dozer has some performance issues. Is that true? Is there anything better than those three? I'll mention that there will be something a little more than 100 JAXB classes.
score: 2
has answer: http://stackoverflow.com/a/25149754
type: AnsweredQuestion
tagged with: mapping
tagged with: java
tagged with: jaxb
possible better answer: http://stackoverflow.com/a/25149754
type: Question
has answer: http://stackoverflow.com/a/25211357
has title: JAXB generated objects to business/domain objects
answer count: 2
accepted answer: http://stackoverflow.com/a/25211357
downvote count: 0
tagged with: dozer
favorite count: 0
tagged with: apache-commons-beanutils

http://stackoverflow.com/comment/39029484
type: QuestionComment
has text: stampaVector2 syncronizate "this" the other the ilst
comment on: http://stackoverflow.com/q/25084453
score: 0
type: Comment

http://stackoverflow.com/a/25096285
has body: Look in your navigator. You should see "Other Components" in the component tree. You can delete them from there. Right click the component and delete If you don't see this window, go to Window->Navigator. Make sure you're in the design view
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/39054299
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/39054140
has comment: http://stackoverflow.com/comment/39054007
answers question: http://stackoverflow.com/q/25096217
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25096217
has comment: http://stackoverflow.com/comment/86128342

http://stackoverflow.com/comment/39017277
score: 0
type: Comment
type: QuestionComment
has text: "If I assume that the two CallInterface.class classes are the same (but probably in different package), how can I reference (casting) the one that is in the jar" - By importing the class that it is in the jar?
comment on: http://stackoverflow.com/q/25078174

http://stackoverflow.com/a/25120268
type: Answer
downvote count: 0
score: 1
has body: You could use regex like this : public static void main(String[] args) { // get each file name in that particular directory here String s = "update_04082014_something-something.txt"; // matches String s1 = "update_05082014_something-something.txt"; // doesnt match String ddmmyy = "04082014"; String pattern = ".*?_" + ddmmyy + ".*"; System.out.println(s.matches(pattern)); System.out.println(s1.matches(pattern)); } O/P : true false
accepted answer of: http://stackoverflow.com/q/25120178
upvote count: 1
answers question: http://stackoverflow.com/q/25120178
type: AcceptedAnswer

http://stackoverflow.com/comment/39188773
type: QuestionComment
has text: Exactly what is the error message you get when running on the JRE?
comment on: http://stackoverflow.com/q/25169946
score: 0
type: Comment

http://stackoverflow.com/comment/39098008
comment on: http://stackoverflow.com/a/25098398
score: 0
type: AnswerComment
type: Comment
has text: ah, this was dead simple. My bar was already an interface and I tried to do what you suggested using mockito (as mentioned in point #2 of my OP) but i missed completely creating my own mock. thank you

http://stackoverflow.com/comment/39242230
type: QuestionComment
has text: I am not sure what encoding it is but i am directly copying it from Microsoft Word
comment on: http://stackoverflow.com/q/25198890
score: 0
type: Comment

http://stackoverflow.com/q/25085950
accepted answer: http://stackoverflow.com/a/25086028
tagged with: spring
type: AnsweredQuestion
tagged with: java
type: Question
has title: Spring - Beans not getting injected
tagged with: dependency-injection
has answer: http://stackoverflow.com/a/25086028
score: 0
answer count: 1
has body: I'm new to Spring, and I don't entirely understand how to set up bean injection. I have a class: public class AClass { @Autowired private Class1 class1; @Autowired private Class2 class2; @Autowired private Class3 class3; public setClass1(Class1 class1) { this.class1 = class1; } public setClass2(Class2 class2) { this.class1 = class1; } public setClass3(Class3 class3) { this.class1 = class1; } public void doAThing() { class1.doSomething(); class2.doSomething(); class3.doSomething(); } } and I have a test for this class: public class AClassTest { @Test public void test() { AClass obj = new AClass(); obj.doAThing(); } } None of the @Autowired instances are set after the AClass instance is created. Obviously, there is something wrong I'm doing with Spring, and I'd like some tips on what needs to be done to get this working. (Btw, I am working with a code base at work where Spring configurations are set up in the background, so I don't need to initialize any configs as that is done for me) Here is my beans xml file: ...other beans that work for other classes... <property name="class1var" ref="class1var" /> <property name="class2var" ref="class2var" /> <property name="class3var" ref="class3var" />

http://stackoverflow.com/q/25171108
possible better answer: http://stackoverflow.com/a/25171477
has comment: http://stackoverflow.com/comment/39191063
has answer: http://stackoverflow.com/a/25171477
has answer: http://stackoverflow.com/a/25171289
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/25171289
tagged with: joptionpane
type: AnsweredQuestion
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/39191427
has comment: http://stackoverflow.com/comment/39191243
type: Question
has body: I'm developing a game and it asks for a username at the start which will then be added to a txt file and saved. But the problem is that the user can write absolutely anything. Their usernames are infinite and can contain special characters and numbers which I do not want. And I have no idea how to stop it. I am writing in Java The code I use to ask for a username is player = new Player(level, 0, 0, input, JOptionPane.showInputDialog(this, "Please enter a username")); And in the constructor for player it is simply public Player(Level level, x, y, InputHandler input, String username)
tagged with: java
linked to: http://stackoverflow.com/q/14961890
score: 0
answer count: 2
has title: How do I make a program that takes a string but disallows numbers?

http://stackoverflow.com/a/25097689
downvote count: 0
has comment: http://stackoverflow.com/comment/39054635
has comment: http://stackoverflow.com/comment/39054422
answers question: http://stackoverflow.com/q/25097408
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/39054441
has body: You can use Tomcat Default Servlet to serve static resources. web.xml: default /resources/* Better use c:url and use prefix / in the value to make the url relative the context path. <img id="logo" src="<c:url value='/resources/images/logo.png'/>" /> Dynamic project structure: WebContent | |__resources | | | |__images | | | |__logo.png | |__WEB-INF | |__web.xml EDIT Since the images are not part of the war hence you can try with Servlet. Just store the path somewhere in properties file or pass it as VM arguments or make it constant. JSP: Servlet: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String imageName=request.getParameter("name") String path = "absolute path of the image directory"+imageName; BufferedInputStream inputStream = null; try { inputStream = new BufferedInputStream(new FileInputStream(new File(path))); OutputStream outputStream = response.getOutputStream(); byte[] bytes = new byte[1024 * 2]; int bytesRead = -1; while ((bytesRead = inputStream.read(bytes)) != -1) { outputStream.write(bytes, 0, bytesRead); } outputStream.flush(); } finally { if (inputStream != null) { inputStream.close(); } } } Use The try-with-resources Statement to handle the resources, if you are using Java 7.
score: 2

http://stackoverflow.com/q/25121530
has comment: http://stackoverflow.com/comment/39100713
tagged with: java
type: Question
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/39101344
answer count: 1
has comment: http://stackoverflow.com/comment/39100379
has body: I have some code for connecting to a JClouds swift storage container which works fine in its own test area, but once I integrate into my project, I get an error: Exception in thread "main" java.util.ServiceConfigurationError: org.jclouds.apis.ApiMetadata: Provider org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata could not be instantiated: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException This is the code which fails on the ContextBuilder line: private SwiftApi swiftApi; public JCloudsConnector(String username, String password, String endpoint) { String provider = "openstack-swift"; Properties overrides = new Properties(); overrides.setProperty("jclouds.mpu.parallel.degree", "" + Runtime.getRuntime().availableProcessors()); swiftApi = ContextBuilder.newBuilder(provider) .endpoint(endpoint) .credentials(username, password) .overrides(overrides) .buildApi(SwiftApi.class); } I am using the same dependencies (JClouds version 1.7.3) so I can't understand what the problem might be since both are run in the same environment.
favorite count: 0
has answer: http://stackoverflow.com/a/25123035
tagged with: jclouds
has comment: http://stackoverflow.com/comment/39099117
type: UnansweredQuestion
has title: Error creating JClouds SwiftApi: Provider org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata could not be instantiated
has comment: http://stackoverflow.com/comment/39100600

http://stackoverflow.com/a/25227906
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25227777
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/39315991
has comment: http://stackoverflow.com/comment/39296494
has comment: http://stackoverflow.com/comment/39316049
has comment: http://stackoverflow.com/comment/39296605
has comment: http://stackoverflow.com/comment/39316085
type: Answer
has body: I'm not sure what problems you might be having, as you've not supplied an example of what you've tried, but the basic process would be to... Create the inner border requirements (EtchedBorder wrapping a EmptyBorder), for example, new CompoundBorder(emptyBorder, etchedBorder) Create the outer border requirements (EmptyBorder wrapping the inner compound border), for example, new CompoundBorder(inner, emptyBorder); Apply this outer border to the component... As an example... import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.EtchedBorder; public class Test1 { public static void main(String[] args) { new Test1(); } public Test1() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { public TestPane() { setLayout(new GridBagLayout()); EmptyBorder emptyBorder = new EmptyBorder(15, 15, 15, 15); EtchedBorder etchedBorder = new EtchedBorder(); CompoundBorder inner = new CompoundBorder(emptyBorder, etchedBorder); CompoundBorder outter = new CompoundBorder(inner, emptyBorder); JPanel panel = new JPanel(new GridBagLayout()); panel.setBorder(outter); panel.add(new JButton("Hello")); add(panel); } } }
has comment: http://stackoverflow.com/comment/39296467
has comment: http://stackoverflow.com/comment/39296538
answers question: http://stackoverflow.com/q/25227777
upvote count: 4
has comment: http://stackoverflow.com/comment/39316020
has comment: http://stackoverflow.com/comment/39296471

http://stackoverflow.com/comment/39074309
score: 1
has text: Does this should explain the trailing '/'? That has nothing to do with absolute or relative... am I missing your point?
comment on: http://stackoverflow.com/a/25095378
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39090959
has text: Actually.. It does answer your question.
comment on: http://stackoverflow.com/q/25117002
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39164373
type: Comment
comment on: http://stackoverflow.com/a/25156781
has text: Just upgraded to Hibernate 4.3 (from 4.2), and it's there now. Thanks!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39118671
type: AnswerComment
has text: @MMM - more like one is meant to be checked (at various places, among them is before insertion), and the other is meant to make the database column not nullable
comment on: http://stackoverflow.com/a/25130823
type: Comment
score: 0

http://stackoverflow.com/q/25191265
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39229687
accepted answer: http://stackoverflow.com/a/25191864
tagged with: java
tagged with: swing
type: Question
has body: After reading the documentation I don't see a good way to make the dialog modal while using showDialog(). Is there a good way to make a JFileChooser instance document-modal instead of application-modal?
has comment: http://stackoverflow.com/comment/39228406
has answer: http://stackoverflow.com/a/25191864
has title: Document-modal JFileChooser?
score: 0
tagged with: file-io
answer count: 1
has comment: http://stackoverflow.com/comment/39228557
has comment: http://stackoverflow.com/comment/39229738
has comment: http://stackoverflow.com/comment/39228678

http://stackoverflow.com/q/25206289
tagged with: java
has body: I have a byte array that is converted to a string in a known way. public String getValueString(byte[] data) { StringBuilder result = ""; for(int i = 0; i &lt; data.length; i++) { result.append(String.format("%02X", data[i])); } return result.toString; } I am looking for the way to convert String to byte array. Actually the byte array is UUID but it is represented in a strange way and method UUID.nameUUIDFromBytes(byte[] data) doesn't work in my case.
type: Question
has answer: http://stackoverflow.com/a/25206453
has title: How to convert value back from "%02x" in Java?
has answer: http://stackoverflow.com/a/25206335
tagged with: type-conversion
possible better answer: http://stackoverflow.com/a/25206453
answer count: 2
score: 2
accepted answer: http://stackoverflow.com/a/25206335
downvote count: 0
favorite count: 0
tagged with: primitive-types
upvote count: 2
type: AnsweredQuestion
tagged with: uuid

http://stackoverflow.com/q/25211094
has comment: http://stackoverflow.com/comment/39331579
upvote count: 1
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/39327536
has comment: http://stackoverflow.com/comment/39340381
favorite count: 0
has comment: http://stackoverflow.com/comment/39331322
type: AnsweredQuestion
has body: It's been a while since I've used Hibernate, and just now working with it again. I'm using Hibernate JPA. Edited Question How can I delete and add an object in the same transaction? I have a request mapped in the controller to a service layer that reaches to the dao layer. I would like to delete an object, make a copy of that object, and re-add the object, but I think the persistence context is getting flushed, so I can complete the delete, but then I get an detached entity exception when trying to re-add the object at the controller layer. This is probably a newbie mistake...help?! User &lt;- retain association &lt;- remove association &lt;- remove association &lt;- remove ... association &lt;- remove Original Question I'm trying to create a function that will remove all records that have a foreign key with MainRecord. Currently, all tables that have foreign keys with MainRecord are set to cascade on delete, so if I remove MainRecord, it will automatically delete everything. The state I want is to remove all records, except for the main record, so that it's like the MainRecord just got inserted into the system, and any associations made with it will be saved after this. There's A LOT of tables that use MainRecord though, and I don't want to write a custom query to remove the record from each of those tables, so I was thinking of deleting the MainRecord, creating a copy, and re-adding it to the database. Though I feel like there should be a way to do this without deleting the MainRecord. Is there a better way to do this?
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39331365
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/39331070
has answer: http://stackoverflow.com/a/25250741
accepted answer: http://stackoverflow.com/a/25250741
has title: Hibernate JPA, deleting and adding in the same transaction
has comment: http://stackoverflow.com/comment/39331266

http://stackoverflow.com/a/25148657
has comment: http://stackoverflow.com/comment/39150525
downvote count: 0
has comment: http://stackoverflow.com/comment/39150853
accepted answer of: http://stackoverflow.com/q/25148562
answers question: http://stackoverflow.com/q/25148562
has body: The problem is, paint is probably setting the font to use before up it paints the reset of the component, because you've overridden it, but failed to call super.paint, it has not had a chance to set these values Instead of overriding paint, override paintComponent instead... protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawString("TEST", 20, 100);// Where I draw the string } Painting is complex process of a series of chained method calls, if you break this Chain, be prepared for some serious weirdness Take a look at Performing Custom Painting and Painting in AWT and Swing for more details
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4

http://stackoverflow.com/a/51650181
answers question: http://stackoverflow.com/q/25134753
type: Answer
has body: private static String getIPAddress(boolean v6) throws SocketException { Enumeration&lt;NetworkInterface&gt; netInts = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface netInt : Collections.list(netInts)) { if (netInt.isUp() &amp;&amp; !netInt.isLoopback()) { for (InetAddress inetAddress : Collections.list(netInt.getInetAddresses())) { if (inetAddress.isLoopbackAddress() || inetAddress.isLinkLocalAddress() || inetAddress.isMulticastAddress()) { continue; } if (v6 &amp;&amp; inetAddress instanceof Inet6Address) { return inetAddress.getHostAddress(); } if (!v6 &amp;&amp; inetAddress instanceof InetAddress) { return inetAddress.getHostAddress(); } } } } return null; }
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/100087537
score: 0
type: Comment
comment on: http://stackoverflow.com/a/56765239
has text: If you would like to contest moderator actions on other posts, please flag the specific posts and explain. You can also raise a discussion on [meta].
type: AnswerComment

http://stackoverflow.com/a/25083990
type: Answer
has body: I would suggest instead: to download "Selenium Builder" from this url: http://www.saucelabs.com/addons/selenium-builder-latest.xpi 2 - Copy it into your VM 3 - Drag and drop the file directly into your FF 4 - Install it like usual Also, in a protected environment you will probably also want to run a Selenium Grid. I created some .bat scripts that can start a Grid and Node instance in the root directory of this OLD project I created: https://github.com/djangofan/WebDriverTestingTemplate Also, I created a framework for running Selenium Builder scripts on SauceLabs.com but you could, in theory, modify it to run tests on your own private Selenium Grid instead: http://djangofan.github.io/simple-selenium-builder-framework/
score: 0
answers question: http://stackoverflow.com/q/25072805

http://stackoverflow.com/comment/39271040
score: 0
has text: @DaoWen Yes it should. :)
type: Comment
comment on: http://stackoverflow.com/a/25214089
type: AnswerComment

http://stackoverflow.com/comment/71080247
type: AnswerComment
comment on: http://stackoverflow.com/a/36717747
type: Comment
has text: straight answer, thanx!!
score: 0

http://stackoverflow.com/a/25293330
has comment: http://stackoverflow.com/comment/39468080
score: 5
has body: This should work (although test.properties will not end up in your classes folder and test-classes would have both test.properties and main.properties with the replaced value which I think was what you wanted but wasn't sure). src/main/resources true src/test/resources true Also, you may want to have two properties, ${host} (referenced in host.properties) and ${test.host} (referenced in test.properties), otherwise if you specify -Dhost during an integration build it will replace the value in both the host.properties and the test.properties. This way you can specify -Dtest.host to change which host you are using for integration tests but not the host that is set when you deploy.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25206841
upvote count: 5
accepted answer of: http://stackoverflow.com/q/25206841
type: Answer
has comment: http://stackoverflow.com/comment/39448201

http://stackoverflow.com/comment/39195113
score: 0
comment on: http://stackoverflow.com/a/25172689
type: AnswerComment
has text: ParseQuery<ParseUser> query = new ParseQuery<ParseUser>("User"); Should be ParseQuery<ParseUser> query = ParseUser.getQuery();
type: Comment

http://stackoverflow.com/q/25089866
tagged with: android-viewpager
downvote count: 0
has answer: http://stackoverflow.com/a/28247342
has answer: http://stackoverflow.com/a/32610967
favorite count: 0
has answer: http://stackoverflow.com/a/35454412
possible better answer: http://stackoverflow.com/a/28038142
has answer: http://stackoverflow.com/a/28038142
tagged with: android
tagged with: android-actionbar-compat
has title: How to change the text color of SlidingTabLayout?
has answer: http://stackoverflow.com/a/26824555
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26257765
has body: I made an application which use the ActionBarCompat I created the tabs using the SlidingTabLayout class. the class is this: SlidingTabLayout.java but I can not change the color of the tabs... my viewpager fragment is this: &lt;swmovil.fyb.SlidingTabLayout android:id="@+id/mTabs" android:layout_width="match_parent" android:layout_height="48dip" /&gt; &lt;android.support.v4.view.ViewPager android:id="@+id/mPager" android:layout_width="match_parent" android:layout_height="0px" android:layout_weight="1" android:background="@color/white" /&gt; the application works great, but i can´t change the color text of the tabs... I made the application after seeing the following example: rudsonlive/Navigation-Drawer-ViewPager-ActionBarCompat How can i change the text color of the tabs text ? thanks !!!
tagged with: android-actionbar
has answer: http://stackoverflow.com/a/27971717
has answer: http://stackoverflow.com/a/26955613
type: Question
answer count: 8
score: 26
accepted answer: http://stackoverflow.com/a/26955613
tagged with: java
upvote count: 26

http://stackoverflow.com/a/25226068
score: 1
has body: The only difference i see with this approach ""+x is that no of intermediate objects can be more compare to just using toString. However this might not be always true because the jvm might perform some optimisation to avoid creation of multiple objects.Refer text in bold below: From jls-15.18.1 The result of string concatenation is a reference to a String object that is the concatenation of the two operand strings. The characters of the left-hand operand precede the characters of the right-hand operand in the newly created string. The String object is newly created (§12.5) unless the expression is a compile-time constant expression (§15.28). An implementation may choose to perform conversion and concatenation in one step to avoid creating and then discarding an intermediate String object. To increase the performance of repeated string concatenation, a Java compiler may use the StringBuffer class or a similar technique to reduce the number of intermediate String objects that are created by evaluation of an expression. For primitive types, an implementation may also optimize away the creation of a wrapper object by converting directly from a primitive type to a string. Just for info,this is how it works for primitive types,from docs: Any type may be converted to type String by string conversion. A value x of primitive type T is first converted to a reference value as if by giving it as an argument to an appropriate class instance creation expression (§15.9): If T is boolean, then use new Boolean(x). If T is char, then use new Character(x). If T is byte, short, or int, then use new Integer(x). If T is long, then use new Long(x). If T is float, then use new Float(x). If T is double, then use new Double(x). This reference value is then converted to type String by string conversion.
type: Answer
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25225946

http://stackoverflow.com/a/25249966
accepted answer of: http://stackoverflow.com/q/25208678
type: Answer
has body: Got it fixed by simply adding auto-import="false" to hibernate-mapping element. Like this &lt;hibernate-mapping package="com.package.name" auto-import="false"&gt;
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25208678

http://stackoverflow.com/comment/39053037
score: 0
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/5215459/android-mediaplayer-setvolume-function
comment on: http://stackoverflow.com/q/25097065

http://stackoverflow.com/a/25118650
answers question: http://stackoverflow.com/q/25107755
type: Answer
has body: Actually you could just create an "TerrainType" attribute for your Terrain class, something like: private Sprite sprite; private TerrainType terrainType; public Terrain(Sprite sprite, TerrainType terrainType) { this.sprite = sprite; this.terrainType = terrainType; } where the TerrainType could be an enum: enum TerrainType { GRASS, ROAD; } and then instantiate your TerrainType like this: new Terrain(atlas.createSprite("road"), TerrainType.ROAD);
score: 0

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/25120645
tags question: http://stackoverflow.com/q/25088725
tags question: http://stackoverflow.com/q/25187691
tags question: http://stackoverflow.com/q/25089866
type: Tag

http://stackoverflow.com/comment/39091741
type: AnswerComment
has text: A question for you, @GeorgeStocker, whats could?
type: Comment
comment on: http://stackoverflow.com/a/25117818
score: 0

http://stackoverflow.com/q/25088818
favorite count: 0
accepted answer: http://stackoverflow.com/a/25088872
score: 0
tagged with: sql
answer count: 1
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: dynamic
tagged with: java
has body: Good day, guys. I have a web application that is used for monthly inventories. I'm using java and MySQL. I'm able to insert and update a new record to the database. These monthly inventories can be viewed using jsp tables. The records are filtered by classifications and month-year. Every month contains a lot of same records and only differs to the number of inventory items and its price. Because of this, I want to make an automatic insertion of records in the database based from the records of the previous month. Basically, what I want to do is to automatically fetch the records/items of the previous month and make a new copy to the database with an updated date based from the system date. This will be done every time the system date reaches a new month. Is this possible? If yes, can you suggest solutions on how I can achieve this? If not, can you suggest other alternative solutions? Thank you in advance! UPDATE I've made an extra button in my JSP that calls a servlet when clicked. This automatically generates a copy of records of the previous month. I used the INSERT ... SELECT query to do this. Now, I want make it like a scheduled task so that it automatically generates a copy of records without clicking a button. The records will be generated every time the system date changes the month and date. I've read about cron jobs but I don't really know how to apply it in my web application. I'm only using jsps and servlets in windows. Can anyone suggest How I can achieve this? Thank you in advance.
tagged with: mysql
type: Question
has title: Automatically insert records to the database
has answer: http://stackoverflow.com/a/25088872
has comment: http://stackoverflow.com/comment/39038038
tagged with: database

http://stackoverflow.com/q/25163524
tagged with: streaming
has comment: http://stackoverflow.com/comment/80355495
upvote count: 1
has comment: http://stackoverflow.com/comment/40206201
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/39177169
has comment: http://stackoverflow.com/comment/39176846
has title: Streaming audio without wifi connection in Android
downvote count: 0
has comment: http://stackoverflow.com/comment/39177015
has body: When i try to stream an audio without wifi connection my app crash: "Couldn't open file on client side, trying server side". And I want to catch the error to advice the user.This is my code that doesn't work. Uri myUri = Uri.parse("http://ip/music/song.mp3"); try { mediaPlayer = new MediaPlayer(); mediaPlayer.setDataSource(this, myUri); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.prepare(); seekbar.setClickable(false); pauseButton.setEnabled(false); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
favorite count: 0
has comment: http://stackoverflow.com/comment/39180035
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39177293
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/39177411
has comment: http://stackoverflow.com/comment/39177186

state
tag name: state
tags question: http://stackoverflow.com/q/25155868
type: Tag
tags question: http://stackoverflow.com/q/25162138
tags question: http://stackoverflow.com/q/25208516

http://stackoverflow.com/comment/39225119
comment on: http://stackoverflow.com/q/25188687
has text: where in the code should i add it?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25076954
answers question: http://stackoverflow.com/q/25076906
has comment: http://stackoverflow.com/comment/39015208
has comment: http://stackoverflow.com/comment/39029172
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/39015097
has body: There is no reason to write StudentEntity _studentEntity = studentEntity; It's just redundant. If you are just updating and return prefer first way. The second way creates unnecessary confusion while reading the code aswell.
upvote count: 3

http://stackoverflow.com/comment/39110040
type: Comment
comment on: http://stackoverflow.com/a/25125285
has text: could you boost the minSDK to 17 and try again? also are you sure the device you are testing on handles multiple touches?
type: AnswerComment
score: 0

http://stackoverflow.com/a/25125969
has comment: http://stackoverflow.com/comment/39122386
type: Answer
has comment: http://stackoverflow.com/comment/39130560
has body: You should use the JPA Criteria API Queries. They have functions to extract the year of a date. and it's helpful because if you make a mistake you know it on compile time instead on runtime.
has comment: http://stackoverflow.com/comment/39128538
has comment: http://stackoverflow.com/comment/39128496
answers question: http://stackoverflow.com/q/25125619
score: 0

http://stackoverflow.com/q/25113641
type: Question
has comment: http://stackoverflow.com/comment/39083698
tagged with: pagination
score: 0
has answer: http://stackoverflow.com/a/25113896
answer count: 1
accepted answer: http://stackoverflow.com/a/25113896
has comment: http://stackoverflow.com/comment/39083650
has title: Making Batches of 50 from an Object in Java
type: AnsweredQuestion
has body: I am stuck with an issue in my app. I want to implement a pagination kind of functionality in my application but due to the existing behaviour I cannot move forward with the standard ways of achieving pagination in my application. Problem: I have a bean object with all the data in it. I want to device a logic for breaking down the object into groups of 50. So consider, if I have 5000 configs in my object, I will first break it down into first 50 and same will be displayed on UI. Further, I will have to continue the process by breaking the reamining 450 configs in the batches of 50. Can anyone suggest me how to proceed with this logic?? My approach: In my existing code, I am checking for the size of the object. If the size data. If its more than 50. I am setting a flag as true. This flag will be used in JSP/JS, to retrigger a DOJO call for fetching data again. Please find the snippet of the code. public ActionForward sdconfigLoadServiceGroups(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest servletRequest, HttpServletResponse servletResponse) { String groupUniqueId = servletRequest.getParameter("groupUniqueId"); Boolean retriggerRequestFlag = false; // Get the ui group HashMap sdConfigDetailsHashMap = (HashMap) ((DynaActionForm) actionForm).get(SD_CONFIG_DETAILS); TreeMap sdConfigTreeMap = (TreeMap) sdConfigDetailsHashMap.get("SDConfigTree"); Boolean viewOnly=(Boolean) sdConfigDetailsHashMap.get("ViewOnly"); Order order = orderManager.getOrder((Long) sdConfigDetailsHashMap.get("OrderId")); SDConfigUITab sdConfigUITab = sdConfig2Manager.getTabByGroupUniqueId(groupUniqueId, sdConfigTreeMap); SDConfigUIGroup sdConfigUIGroup = sdConfig2Manager.getGroupByGroupUniqueId(servletRequest.getParameter("groupUniqueId"), sdConfigUITab); //TODO: Adding logger to check the total number of sections logger.info("All Sections==="+sdConfigUIGroup.getSections()); logger.info("Total Sections?? "+sdConfigUIGroup.getSections().size()); long size = Long.valueOf(sdConfi…
tagged with: java

http://stackoverflow.com/comment/39213784
comment on: http://stackoverflow.com/q/25183900
has text: Sorry didnt mean to Im doing this on my phone.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39258506
type: QuestionComment
has text: Did you try the suggestion in the error message? We're not here to troubleshoot your code for you... We're here to help you with the troubleshooting that you've already performed. Which line of code is producing the error?
score: 0
comment on: http://stackoverflow.com/q/25207512
type: Comment

http://stackoverflow.com/comment/39285604
type: QuestionComment
comment on: http://stackoverflow.com/q/25221952
score: 3
has text: Your question is lacking needed context -- what type of program is this? What have you tried? What isn't working? Can you show us your present code? Are you sure that you mean Java and not JavaScript -- they are completely different you know? Please tell us the important details, and soon as the question risks being closed as too broad or unclear without these details.
type: Comment

http://stackoverflow.com/q/25074623
favorite count: 0
tagged with: security
upvote count: 5
answer count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/39011967
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39081368
type: Question
has title: java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:8081 connect,resolve) - main reasons
tagged with: java
has answer: http://stackoverflow.com/a/25093263
linked to: http://stackoverflow.com/q/19487407
has answer: http://stackoverflow.com/a/25074807
has answer: http://stackoverflow.com/a/59299615
score: 5
has body: What are the main reasons that cause the exception reported? Same trusted signed applet (Digicert certificate), works great on some PCs, doesn't work on other. Exception occurs when i try to get an attachment stream through URLConnection Where it doesn't works, i resolve with grant { permission java.security.AllPermission; }; in java.policy but i would like to avoid to update every PC. Could be a port (8081) issue? What should I investigate?
tagged with: applet
has answer: http://stackoverflow.com/a/45788155

http://stackoverflow.com/comment/39181360
has text: What is the reason to use a Timer instead of a Scheduler for setting a height?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25123839
type: Comment

http://stackoverflow.com/q/25159249
has answer: http://stackoverflow.com/a/25159538
tagged with: java
has answer: http://stackoverflow.com/a/25159468
downvote count: 1
type: Question
has body: I am quite new to java and I have two questions! First how can I make a variable usable entire a java class? This is part of my method: public void createID() { ObjectId Id = (ObjectId) documentClient.get("_id"); StringID = clientId.toString(); } And I want to use StringID in another method but it is either null (when I create public StringID =null in the main class) or not known. My other question is that when I change the createID() to public String createID() { ObjectId Id = (ObjectId) documentCleint.get("_id"); StringID = clientId.toString(); return Id; } It says that the method should be void! I am looking for a way to return the variable from my method. Any idea? Thanks
has answer: http://stackoverflow.com/a/25159374
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/39168053
favorite count: 0
has comment: http://stackoverflow.com/comment/39168001
has comment: http://stackoverflow.com/comment/39168313
type: UnansweredQuestion
has title: how to use a variable in the entire java class
score: -1

http://stackoverflow.com/comment/39219824
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25145956
score: 0
has text: I added my exception handling code. All exceptions are thrown after this point

http://stackoverflow.com/comment/39115490
comment on: http://stackoverflow.com/a/25130407
score: 0
type: AnswerComment
has text: @fscore A Thread is a class that either implements the Runnable interface, which contains the run() method. When you create an instance of a Thread class (for example by calling `Thread lo = new Thread();`), you are not yet executing the thread. Only when you call the start() method, the new thread is created and executes the run () method. When a new thread is started, the thread from which it was started (in our case the main thread) continues to run in parallel.
type: Comment

http://stackoverflow.com/q/25127720
tagged with: android
tagged with: android-activity
tagged with: android-asynctask
answer count: 0
upvote count: 1
has body: staff have a rather odd problem. I have a chat that consists of a listview where messages are displayed. Tenhoum handler that calls a assynktask every 5 seconds to update the conversation, so getting new messages. The message comes in xml below. In the emulator works perfectly with android 2.2 to 4.4, have problems, just the listview does not update. Ie, I have a problem that only manifests itself in production. Everything usually works on emulators, but when I install the app in android 2.2 to 4.4, the listview is not updated and displays nothing. I'm sorry for maybe posting a doubt these, but do not know what might be going into production error. It would be some thread, asynktasks or handler? I've done podificações using threads, timers, runOnUiThreads it all works, but on emulators. The production environment has everything the app needs, connection, internet and sdcard. XML chat example message: <ListaMensagensChat> 1449 <cd_emissor>1</cd_emissor> rastronet 123 <data_criacao>2014-08-04 10:22:18</data_criacao> NAO Activity chat: package com.infovale.localizauto; public class ConversaChatActivity extends Activity { EditText txtMensagem; TextView nomeUsuario; String paraUsuario, codigoUsuario; private Handler mHandler = new Handler(); ListView listView = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_conversa_chat); // txtHistorico = (EditText) findViewById(R.id.txtHistorico); txtMensagem = (EditText) findViewById(R.id.txtMensagem); nomeUsuario = (TextView) findViewById(R.id.nomeUsuario); Bundle b = getIntent().getExtras(); paraUsuario = b.getString("codigo"); nomeUsuario.setText(b.getString("nome")); Context c = getApplicationContext(); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(c); codigoUsuario = sp.getString("CODIGO", null); listView = (ListView) findViewById(R.id.listConversa); mHandler.postDelayed(updateTask, 5000); if (savedInstanceState == n…
tagged with: java
type: UnansweredQuestion
has title: Error updating listview periodically handler and AsyncTask
downvote count: 0
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/a/25092824
type: Answer
has body: You have an error in calling maven: mvn clean compile assembly:signle ^^^ It must be mvn clean compile assembly:single
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25092808
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25092808

http://stackoverflow.com/comment/39285364
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25221831
has text: http://en.wikipedia.org/wiki/Generating_primes

http://stackoverflow.com/comment/39003084
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25070185
has text: I think that your suggestion is actually the most sensible solution ;)

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/25086124
tags question: http://stackoverflow.com/q/25088381
type: Tag

http://stackoverflow.com/comment/39290812
type: AnswerComment
has text: @MrDoctorProfessorTyler No problem. Sometimes these old classes have poor method naming it seems, so sometimes it's best to open up the Javadoc page for the class and search for keywords, like in this case the word origin.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25224868

http://stackoverflow.com/comment/39270498
has text: @chris, Changing to ManyToMany did the trick. If you want to add that as an answer I'll be happy to mark it as the correct one.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25193560

http://stackoverflow.com/q/25192381
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25213276
type: Question
tagged with: annotation-processing
has comment: http://stackoverflow.com/comment/101291834
linked to: http://stackoverflow.com/q/22494596
has title: How can I get the working directory of a project from an Annotation Processor in Java
score: 4
answer count: 1
linked to: http://stackoverflow.com/q/9107099
favorite count: 0
has body: I am writing an annotation processor in Java and in this annotation processor I want to be able to find a file in the Project hierarchy of the project on which I am using this annotation processor. Through the annotation I can pass in the path of the file I am searching for relative to the project root but i cannot retrieve the project's working directory. Let's say that the processor is MyCustomProcessor and I am using it on the project MyProject. I want to be able to access(read) a file (a properties file) from the project structure of MyProject from the "process" method of MyCustomProcessor. I have read this link Eclipse - Annotation processor, get project path but when I use their solution I get a null returned from the StandardJavaFileManager.getLocation(StandardLocation.SOURCE_PATH) call. Some more details regarding the implementation: MyAnnotationProcessor: @SupportedAnnotationTypes(value = {"MyAnnotation" }) @SupportedSourceVersion(RELEASE_6) public class MyCustomProcessor extends AbstractProcessor { ... @Override public boolean process(final Set&lt;? extends TypeElement&gt; annotations, final RoundEnvironment roundEnv) { for (final Element element : roundEnv.getElementsAnnotatedWith(MyAnnotation.class)) { &lt;!-- Here is where I would like to get the working directory !--&gt; } } } More details about the testing and development environment: Eclipse Kepler, JRE 1.7. If you need more details just ask.
type: UnansweredQuestion
upvote count: 4
tagged with: working-directory

http://stackoverflow.com/comment/39181109
score: 1
comment on: http://stackoverflow.com/q/25165849
type: QuestionComment
type: Comment
has text: Do you know that you're not changing the values of the list, right? Because `Integer` and `Double` are immutables.

http://stackoverflow.com/comment/39006986
has text: The following are **not** ip addresses `"10.15,10.31,10.42"`
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25072442
type: QuestionComment

http://stackoverflow.com/a/25211992
type: Answer
has comment: http://stackoverflow.com/comment/39267127
downvote count: 1
answers question: http://stackoverflow.com/q/25211904
accepted answer of: http://stackoverflow.com/q/25211904
upvote count: 5
score: 4
has body: It is no longer a valid way. Using scheduling methods such as stop have been deprecated because they could potentially leave work in an invalid state. See this article for more information. If you are doing such anonymous work, I would recommend a ThreadPoolExecutor. Otherwise, if you want to continue doing it the way you are doing right now, you should use Thread#interrupt(), or use a boolean value outside of the anonymous Thread and change that to stop execution.
type: AcceptedAnswer

http://stackoverflow.com/a/25185173
upvote count: 1
answers question: http://stackoverflow.com/q/25184930
has body: Hello I would like to help you but your description is very vague and confusing could you please make a list describing the steps that this program is intended to do. I looked at your code and from I could gather from your description this may help. Scanner scanner = new Scanner(System.in); System.out.print("Enter Number of Records: "); int numOfRecords = scanner.nextInt(); for(int x = 0; x &lt;= numOfRecords; x++) { String EmpNo[] = new String[numOfRecords]; String EmpName[] = new String[numOfRecords]; String Salary[] = new String[numOfRecords]; } //Whatever else you want to do
downvote count: 0
has comment: http://stackoverflow.com/comment/39216303
has comment: http://stackoverflow.com/comment/39216356
type: Answer
score: 1

http://stackoverflow.com/a/25201407
has comment: http://stackoverflow.com/comment/39246881
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39247130
upvote count: 6
score: 6
has body: public static short floatToShort(float x) { if (x &lt; Short.MIN_VALUE) { return Short.MIN_VALUE; } if (x &gt; Short.MAX_VALUE) { return Short.MAX_VALUE; } return (short) Math.round(x); } You'll loose the fractional part: float 4 byte floating-point double 8 byte floating-point (normal) short 2 byte integer int 4 byte integer (normal) long 8 byte integer Edit: Maybe you wanted to know how to save the bits of a float (4 bytes) into an int (4 bytes): (http://docs.oracle.com/javase/7/docs/api/java/lang/Float.html#floatToRawIntBits(float)) float x = 0.1f; int n = Float.floatToRawIntBits(x); float y = Float.intBitsToFloat(n);
accepted answer of: http://stackoverflow.com/q/25201304
answers question: http://stackoverflow.com/q/25201304

http://stackoverflow.com/comment/39280575
type: QuestionComment
comment on: http://stackoverflow.com/q/25219225
has text: @all Then my question is probably wrong to mention them as ASCII. Thank you all.
score: 1
type: Comment

http://stackoverflow.com/a/25106170
answers question: http://stackoverflow.com/q/25106005
type: Answer
has body: You can use Math.floor() as others said. Apart from that: you may have a bug in your code logic. The 3rd and the 4th branches of the if statement are unreachable as the 2nd if clause covers them if (ShopValue &gt;= 100) The correct way is to arrange them such that comparisons with greater numbers comes before comparisons with smaller numbers: int ShopValue = (int)Math.floor(getItemShopValue(removeId, 1, removeSlot)); String ShopAdd = ""; if (ShopValue &gt;= 1000000000) { ShopAdd = " (" + (ShopValue*.75 / 1000000000) + " billion)"; } else if (ShopValue &gt;= 1000000) { ShopAdd = " (" + (ShopValue*.75 / 1000000) + " million)"; } else if (ShopValue &gt;= 1000) { ShopAdd = " (" + (ShopValue*.75 / 1000) + "k)"; } else if (ShopValue &gt;= 100) { ShopAdd = " (" + (ShopValue*.75 / 1) + " coins)"; } c.sM(c.getItems().getItemName(removeId)+": shop will buy for &lt;col=255&gt;"+ShopAdd+"&lt;/col&gt; coins"); } }
score: 0

http://stackoverflow.com/comment/39106047
type: Comment
comment on: http://stackoverflow.com/a/25125387
has text: @T.C.: Expected linear time if you use a decent hash table. "Worst case" where you maximise over the randomness as well isn't a sensible metric in very many situations.
score: 0
type: AnswerComment

http://stackoverflow.com/a/25070691
downvote count: 0
type: Answer
upvote count: 1
has body: Besides the Random object, you did not define startTestVarA and startTestVarB.
score: 1
answers question: http://stackoverflow.com/q/25070537

http://stackoverflow.com/a/25145405
score: 1
type: AcceptedAnswer
upvote count: 1
has body: Unlike, Java's SimpleDateFormat, you cannot simply declare an instance of Apache's FastDateFormat class. Instead, FastDateFormat statically serves up instances of the class via the Factory Method Pattern - you must call the class' static method getInstance, as in the following: String dateFormatPattern = "yyyy-mm-dd'T'HH:mm:ss.SSSZ"; FastDateFormat myFastDateFormatter = FastDateFormat.getInstance(dateFormatPattern); Now you have a myFastDateFormatter loaded configured with that date format pattern. You can use it to parse strings into real Dates, assuming those strings conform to your dateFormatPattern: String dateString = "2014-04-03T14:02:57.182+0200"; Date myDate = myFastDateFormatter.parse(dateString);
has comment: http://stackoverflow.com/comment/84384342
type: Answer
accepted answer of: http://stackoverflow.com/q/25145404
downvote count: 0
answers question: http://stackoverflow.com/q/25145404

http://stackoverflow.com/comment/39040070
type: Comment
has text: You should probably ask a new question since this seems like a new problem. But it sounds like either you have not called setContentView before line 122 executes or perhaps you are importing the wrong Fragment or FragmentManager as in [this question](http://stackoverflow.com/a/23368288/815679). Make sure that you are using Support Fragments if you are working with `SupportMapFragment`.
comment on: http://stackoverflow.com/a/25072821
score: 0
type: AnswerComment

http://stackoverflow.com/a/25096674
has comment: http://stackoverflow.com/comment/39052858
type: Answer
answers question: http://stackoverflow.com/q/25096634
has body: try the below code String sql = "INSERT INTO temp(val) VALUES (?)"; PreparedStatement st = con.prepareStatement(sql); if (/* int value is not null */) { st.setInt(1, value); } else { set.setNull(1, Types.INTEGER); } count = st.executeUpdate();
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/25122753
accepted answer: http://stackoverflow.com/a/25126745
tagged with: android
has comment: http://stackoverflow.com/comment/39106889
has comment: http://stackoverflow.com/comment/39108010
has comment: http://stackoverflow.com/comment/39107947
upvote count: 1
has comment: http://stackoverflow.com/comment/39106976
has title: How to Get a Random Map in Google Play Game Service Real-time Multiplayer Game
has body: I’m trying to get my game to work so that when players play auto-matched game the players will play on a randomly selected map. I tried room.getCreationTimestamp() to use the last digit’s remainder as an index of a map, but it seems that the creation time stamp isn’t the same for different players. I also tried the room id to get a byte from there but the id isn’t either same for every player. So is there a variable or a field in the room that would be different in different games but same for each player in the same game or which would be the alternative way to get a randomly selected map that would be same for each player.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39107865
score: 1
tagged with: java
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25126745
favorite count: 0
tagged with: google-play-games
has comment: http://stackoverflow.com/comment/39106580

http://stackoverflow.com/comment/39241870
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25198735
has text: Just got to love how everyone use k++ instead of ++k, which is faster.

http://stackoverflow.com/comment/39241665
comment on: http://stackoverflow.com/a/25198025
has text: This looks more promising than I was hoping for!
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/44111715
comment on: http://stackoverflow.com/a/25101858
has text: Nice snippet. But I think code misses to connect head with last element . ie. head.left = last, and last.right= head.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25123325
type: AcceptedAnswer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25123240
answers question: http://stackoverflow.com/q/25123240
downvote count: 0
has body: You could use the other attributes available on the forEach tag to form a simple counter, without having a specific array of values to iterate over, e.g.: The numbers from one to 10 are: <c:forEach var="i" begin="1" end="10"> <c:out value="${i}"/> </c:forEach> This could be quite useful with the step attribute too.
type: Answer
score: 3

http://stackoverflow.com/q/25072438
linked to: http://stackoverflow.com/q/14763079
tagged with: urlconnection
has answer: http://stackoverflow.com/a/25072575
has title: Send an upload in chunks to avoid OutOfMemoryError with httpclient 3.1 and URLConnection
has answer: http://stackoverflow.com/a/25112561
tagged with: apache-commons-httpclient
type: UnansweredQuestion
has body: I'm trying to send a file to an IIS server using apache commons httpclient 3.1 but I get out of memory error. InputStream is = FileService.getInputStream(fileName, FileService.HDD); ByteArrayOutputStream fileToUpload = new ByteArrayOutputStream(); ByteArrayPartSource file = null; try { byte[] buffer = new byte[1024]; for (int len; (len = is.read(buffer)) != -1;) fileToUpload.write(buffer, 0, len); file = new ByteArrayPartSource(fileName, fileToUpload.toByteArray()); post.setContentChunked(false); Part[] part = new Part[] { new FilePart(fileName, file)}; post.setRequestEntity(new MultipartRequestEntity(part, post.getParams())); } catch (OutOfMemoryError e) { } finally { try { if (is != null) is.close(); if (fileToUpload != null) fileToUpload.close(); } catch (IOException e) { } } OutOfMemoryError occurs at fileToUpload.toByteArray(). Is there any way to send file in chunks? I can't use file object because I get permission errors. I also tried without using httpClient but I still get out of memory error InputStream fileToUpload = FileService.getInputStream(fileName, FileService.HDD); OutputStream output = connection.getOutputStream(); PrintWriter writer = null; try { writer = new PrintWriter(new OutputStreamWriter(connection.getOutputStream(), "UTF-8")); writer.println("--" + boundary); writer.println("Content-Disposition: form-data; name=\"binaryFile\"; filename=\""+ fileName + "\""); writer.println("Content-Type: application/octet-stream"); writer.println("Content-Transfer-Encoding: binary"); writer.println(); writer.flush(); LogService.info("FileSender#setFileToUpload() Before"); byte[] buffer = new byte[2048]; int bytesRead; while ((bytesRead = fileToUpload.read(buffer)) != -1){ output.write(buffer, 0, bytesRead); } LogService.info("FileSender#setFileToUpload() After"); output.flush(); writer.println(); writer.flush(); writer.println("--" + boundary + "--"); } finally { if (writer != null) writer.close(); if (output != null) output.close(); if (fileToUpload != nul…
type: Question
has comment: http://stackoverflow.com/comment/39007844
tagged with: java
has comment: http://stackoverflow.com/comment/39006969
score: 0
answer count: 2
tagged with: jdk1.4
tagged with: apache

http://stackoverflow.com/comment/39222633
type: AnswerComment
has text: I'm interested by your future work. I you want to contribute to imgndxr, you're welcome! The first thing to do is a smaller, simpler replacement of LIRE. LUCENE is a facility to index a very large set of images like a database.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25165458

http://stackoverflow.com/q/25127519
tagged with: apache-karaf
tagged with: karaf
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39123641
accepted answer: http://stackoverflow.com/a/25146923
tagged with: osgi
has title: How to create configuration for Managed Service Factory with Karaf features?
type: AnsweredQuestion
tagged with: java
has body: I'm trying to create a simple configuration for Amdatu's MongoDB component. When I create a file named org.amdatu.mongo-kairos.cfg with following line inside dbName=kairos and put it into the deploy folder - everything works OK. However, when I'm trying to use config tag in features.xml nothing happens. Part of my feature file, which uses configuration tag: //(...) dbName=kairos
type: Question
tagged with: amdatu
has answer: http://stackoverflow.com/a/25146923
has comment: http://stackoverflow.com/comment/39125247

http://stackoverflow.com/q/25191412
answer count: 1
has answer: http://stackoverflow.com/a/25191508
has title: Admob sample code
type: UnansweredQuestion
tagged with: android
tagged with: java
has body: I'm new with android programming and I am interested in Admob. I will use this sample code which I found in internet: https://code.google.com/p/google-mobile-dev/downloads/detail?name=BannerExample_Play_1.0.zip I tested it and it works properly. My question is where exactly in this code is the action which detects the clicking on the display and opens the advertisement after clicking the banner?
type: Question
tagged with: admob
score: 0

http://stackoverflow.com/comment/39094517
score: 0
type: Comment
type: QuestionComment
has text: @laune : thanks for the problem solving, but I still need an answer to how to save individual digits from the input string, so that mathematical operations can be performed on the same.
comment on: http://stackoverflow.com/q/25118771

http://stackoverflow.com/comment/39275099
comment on: http://stackoverflow.com/q/25216255
score: 0
type: Comment
type: QuestionComment
has text: well yeah I know this works as I can be sure `T` is precisely that type. I just wanted to avoid the casting. And for the sake of interest.

http://stackoverflow.com/a/25205510
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25205412
upvote count: 8
answers question: http://stackoverflow.com/q/25205412
type: Answer
has body: Assuming your loop is meant to use x.size(), then it's pretty simple - if x.size() is 0, you'll be computing 0/0, which is NaN. Otherwise, it could be that logicWhichReturnsPrimitiveDouble() returns a NaN for whatever reason. It's not clear why you've emphasized the "primitive" part in various places in your post - a primitive double is just as capable of representing NaN as Double. Indeed, the type of Double.NaN is double...
score: 8
type: AcceptedAnswer

http://stackoverflow.com/q/25103398
type: Question
tagged with: java
has title: Casting int to char and back using extended ASCII range
score: 0
has answer: http://stackoverflow.com/a/25103449
answer count: 1
accepted answer: http://stackoverflow.com/a/25103449
has body: I'am currently developing a Java client server game. Imagine I have a shuffled talon of cards, there are 70 cards and every card has a fixed ID (0-69); When this talon is shuffled I have an array of int containing the IDs (example below does only contain a few possible numbers). Now I thought it would be a good idea to "encode" this talon as a string and send that to a Client via DataOutputStream for example. The way I'd like to do this is by casting int to char but I'm using the extended ASCII range (> 127). When I'm testing this, the chars I get are all ISO8859-1, so far so good. But recently I think I read that you cannot be absolutely sure that every JVM behaves like the same in the range >127. My question now is: what would I have to do to be 100% sure that the Java client will get exactly the same number when casting back to int? Is it possible? Thanks. // Server side int[] numbers = new int[] { 5, 47, 31, 30, 20, 58, 11, 5, 19 }; String s = ""; for (int i = 0; i &lt; numbers.length; i++) { s += (char) (numbers[i] + 150); } //Client side int[] decoded = new int[s.length()]; for (int i = 0; i &lt; s.length(); i++) { decoded[i] = ((int) s.charAt(i)) - 150; }
type: AnsweredQuestion

http://stackoverflow.com/q/25127851
accepted answer: http://stackoverflow.com/a/25457258
has comment: http://stackoverflow.com/comment/39201643
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: dashclock
tagged with: android
has comment: http://stackoverflow.com/comment/39111327
has comment: http://stackoverflow.com/comment/39110635
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25457258
upvote count: 1
has comment: http://stackoverflow.com/comment/39110743
type: Question
tagged with: java
tagged with: cyanogenmod
has title: Android DashClock Extension setup for CM Home (CyanogenMod 11)
has body: today I coded a DashClock Extension in Java for DashClock Widget by Roman Nurik (https://play.google.com/store/apps/details?id=net.nurik.roman.dashclock&amp;hl=de). Everthing works fine but the extension doesn't show up in CM Home. I have googled much time and don't have found any Solution. What I must do to support CM Home? Edit: I'm using DashClock Widget v1.6 and API v2. The change of "protocolVersion" from 1 to 2 make no difference.

http://stackoverflow.com/a/25219290
score: 5
upvote count: 5
accepted answer of: http://stackoverflow.com/q/25219225
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25219225
type: Answer
has body: The characters which are having an ASCII value more than 128 are not ASCII characters rather it would be better to say them Unicode characters. Also Extended ASCII is not ASCII. You may better refer Unicode tables. Also to mention that Java uses Unicode internally. And it does not use ASCII internally. Actually, it uses UTF-16 most of the time You may refer this and List of Unicode characters.

http://stackoverflow.com/q/25078259
duplicate of: http://stackoverflow.com/q/3672731
has answer: http://stackoverflow.com/a/25079019
answer count: 3
has answer: http://stackoverflow.com/a/25078913
has answer: http://stackoverflow.com/a/25078467
has body: I want to obtain number in following format: 1000 = 1,000 10000 = 10,000 100000 = 1,00,000 I tried this: import java.text.DecimalFormat; public class StringProcessingDemo { public static void main(String[] args) { String pattern = "##,##,###.###"; DecimalFormat myFormatter = new DecimalFormat(pattern); String output = myFormatter.format(2564484.125); System.out.println(output); } } But despite of pattern ##,##,###.### I am getting output as 2,564,484.125 while I think I should get it as 25,64,484.125. Why?
favorite count: 0
has comment: http://stackoverflow.com/comment/39017420
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14507658
tagged with: string-formatting
downvote count: 1
tagged with: decimalformat
has comment: http://stackoverflow.com/comment/39017337
has title: Formatting numbers in Java / Indian numbering system
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39017549
type: Question
duplicate of: http://stackoverflow.com/q/14507658
linked to: http://stackoverflow.com/q/3672731
has comment: http://stackoverflow.com/comment/39017478

http://stackoverflow.com/comment/39134779
comment on: http://stackoverflow.com/q/25139716
score: 0
has text: The sgl (simpleonscalegesturelistener), mgl simpleonmovegesturelistener and the rgl (simpleonrotategesturelistener) it didn't compile these
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25134023
score: 0
has comment: http://stackoverflow.com/comment/39124153
type: Answer
has comment: http://stackoverflow.com/comment/39123601
answers question: http://stackoverflow.com/q/25133950
has comment: http://stackoverflow.com/comment/39123544
has body: I am not quite sure what you want but I found an error in your code. You are passing null as the first parameter while creating thread. Try not to use that. I think you can use, MapView.this instead

http://stackoverflow.com/q/25139178
has title: Return type of SQLPredicate on HazlecastMap
accepted answer: http://stackoverflow.com/a/25139364
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25139364
answer count: 1
downvote count: 0
tagged with: hazelcast
favorite count: 0
has body: Does a SQLPredicate on a hazelcast map return a Set (as per the documentation) or an arraylist? I am using v3.2.4 client and server. The client connects to the server and makes the following call (this worked on a single server but now that I am using the client, I'm not sure what's causing the problem). Predicate testPredicate = equal("testGroupID", 101); //testGroupID is attribute Set&lt;testObj&gt; testInstances = (Set&lt;testObj&gt;)testMap.values(testPredicate); I am getting the following exception on the second line: Java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Set

http://stackoverflow.com/comment/39196319
comment on: http://stackoverflow.com/a/25155366
score: 0
type: AnswerComment
has text: @Katrick If I understood correctly, it is needed to receive list of property from front end part, so it is needed to write ajax-query with data and url. For example: `var persons = []` `for (var i=0;i<5;i++){` `persons.push(new Person("alex", i))` `}` `$.ajax({` `url: "/credentials",` `type: "POST",` `dataType: "json",` `data: $.toJSON(persons),` `contentType: "application/json",` `mimeType: application/json",` `success: function(data){` `alert(data);` `},` `error: function(data){` `alert("Error");` `}` `});`
type: Comment

http://stackoverflow.com/comment/39239754
has text: Maybe try without the `data=` this time? Do you have a stacktrace? The JSON data in itself looks absolutely fine.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25196914

http://stackoverflow.com/comment/39219170
has text: Exactly, the container initializes the servlet and then uses it for requests.
comment on: http://stackoverflow.com/a/25186627
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/25138039
tagged with: java
tagged with: mysql
type: Question
has body: I am trying to update my database using an update statement, when I am trying to do this it is showing me an error...these are the exceptions I could find here. com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'name' at row 1 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2973) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1600) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1695) at com.mysql.jdbc.Connection.execSQL(Connection.java:3020) at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1074) at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1008) at data.changing.jButton1ActionPerformed(changing.java:125) at data.changing.access$000(changing.java:21) at data.changing$1.actionPerformed(changing.java:62) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6505) at javax.swing.JComponent.processMouseEvent(JComponent.java:3320) at java.awt.Component.processEvent(Component.java:6270) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.…
has answer: http://stackoverflow.com/a/25138232
has comment: http://stackoverflow.com/comment/39128779
linked to: http://stackoverflow.com/q/21522875
has title: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'name' at row 1
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25138647
has answer: http://stackoverflow.com/a/25138653
tagged with: netbeans-platform
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/21522875

http://stackoverflow.com/q/25223353
has title: Eclipse Content Assist Struggles
tagged with: autocomplete
tagged with: content-assist
tagged with: java
tagged with: eclipse
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39288108
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39288207
has comment: http://stackoverflow.com/comment/39288048
has body: Lately Eclipse's content assist feature has been giving me some frustration. I recently changed my Auto Activation trigger so that the autocomplete box would appear whenever I start typing, rather than just after I type a period. This is great most of the time but it has some annoying downsides. For example: Eclipse autocompletes 'String' to android.R.string. This is very very annoying considering it changes "String" to "string" when I press space or enter. Why would I want that? android.r.string hasn't even been imported! Here is what my content assist settings look like: Two desired solutions would be the following: Don't show proposals that don't match case (little 's' shouldn't match big 'S') Don't show proposals that I have not imported. If anyone could help me out with this it would be greatly appreciated!
type: Question
has answer: http://stackoverflow.com/a/25223568

http://stackoverflow.com/comment/39199502
comment on: http://stackoverflow.com/a/25141956
has text: Read the documentation http://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.vm.ConfigInfo.html You can retrieve annotation by doing this `vm.getConfig().annotation`
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39029134
type: QuestionComment
comment on: http://stackoverflow.com/q/25084120
type: Comment
score: 0
has text: Why do you want to set every button's text to only the last answer? (That's what your double `for` is doing.)

http://stackoverflow.com/a/25205306
accepted answer of: http://stackoverflow.com/q/25205038
has body: execSQL() can only execute one statement at a time. Do not combine your SQL into a single DATABASE_CREATEstring separated by ;. Instead, execSQL() the individual SQL statements separately. Also uninstall your app so the old database with incorrect tables gets removed.
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25205038
upvote count: 2

http://stackoverflow.com/q/25099113
has body: I can't stop music when a key is pressed. I'm not sure why, but when I call .pause() .stop() and .dispose() nothing happens at all. if (Gdx.input.isKeyPressed(Keys.A)) { Theme.pause; Theme.dispose; //This is what's not working, in the update() it constantly checks if "A " is pressed main.setScreen(main.otherScreen); } //this if statement is called in my update method. Every thing but stoping the music works
tagged with: java
type: Question
tagged with: libgdx
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/39056902
has title: (LibGdx) No control over sound?
has comment: http://stackoverflow.com/comment/39057477
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25108891

http://stackoverflow.com/comment/39169563
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25153865
has text: You should post the full sample: *Java* code + *jrxml* file + *xml* file.

http://stackoverflow.com/comment/39003981
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25070511
has text: Thanks for ur help, we've different methods :/ Can u please correct my code

http://stackoverflow.com/comment/47212037
score: 1
type: AnswerComment
type: Comment
has text: This is a piece of opinion. I am always astonished when I see someone took the time to write a constructor just to prevent people from using it.
comment on: http://stackoverflow.com/a/25137699

http://stackoverflow.com/a/66247818
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/25221929
score: 4
has body: I had the same error and it was solved by explicitly setting @Column(name = "field_name") to the properties used in @UniqueConstraint.
type: Answer

http://stackoverflow.com/q/25152812
has answer: http://stackoverflow.com/a/25155460
has comment: http://stackoverflow.com/comment/39156754
tagged with: spring
tagged with: spring-mvc
type: UnansweredQuestion
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39157917
has answer: http://stackoverflow.com/a/25154940
has comment: http://stackoverflow.com/comment/39157168
has title: Converting spring request body to list of objects
has comment: http://stackoverflow.com/comment/39198796
tagged with: java
has comment: http://stackoverflow.com/comment/39157553
type: Question
linked to: http://stackoverflow.com/q/9617207
has body: I have a HTTP form that returns a following HttpRequest request body as follows propertyName0=name0&amp;propertyValue0=value0&amp;propertyDescription0=description0&amp; propertyName1=name1&amp;propertyValue1=value1&amp;propertyDescription1=description1&amp;propertyName2=name2&amp;propertyValue2=value2&amp;propertyDescription1=description2 I have a model that has the following properties public class Property { private String propertyName; private String propertyValue; private String propertyDescription; // Getters and setters } I would like to be able to convert request body variables to a list of Property objects. Is there a way to do that? My controller code (proposed) @RequestMapping(value="update", method=RequestMethod.POST) @ResponseStatus(HttpStatus.OK) public void update(List&lt;Property&gt; properties) { // Do something with properties. } @RequestMapping(value="/fetch/}", method=RequestMethod.GET) @ResponseBody public String searchConfigProperties() throws Exception { List&lt;Property&gt; properties = // Some code that generates a list. model. Gson gson = new Gson(); return gson.toJson(properties); } UPDATE The controller represents the service architecture back end code and is not necessarily intended to bind to any view.
answer count: 3
has answer: http://stackoverflow.com/a/25155366
has comment: http://stackoverflow.com/comment/39157840
has comment: http://stackoverflow.com/comment/39156739
downvote count: 0
has comment: http://stackoverflow.com/comment/39157537
favorite count: 0
has comment: http://stackoverflow.com/comment/39158146

http://stackoverflow.com/a/25226190
has body: You're calling Writer.write(int). That writes a single UTF-16 code point to the file, taking just the bottom 16 bits. If your platform default encoding isn't able to represent the code point you're trying to write, it will write '?' as a replacement character. I suspect you actually want to write out a text representation of the number, in which case you should use: write.write(String.valueOf(comb)); In other words, turn the value into a string and then write it out. So if comb is 123, you'll get three characters ('1', '2', '3') written to the file. Personally I'd avoid FileWriter though - I prefer using OutputStreamWriter wrapping FileOutputStream so you can control the encoding. Or in Java 7, you can use Files.newBufferedWriter to do it more simply.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39293287
score: 4
has comment: http://stackoverflow.com/comment/39293843
type: Answer
has comment: http://stackoverflow.com/comment/39293858
has comment: http://stackoverflow.com/comment/39293883
accepted answer of: http://stackoverflow.com/q/25226162
answers question: http://stackoverflow.com/q/25226162
has comment: http://stackoverflow.com/comment/39293232
upvote count: 4
has comment: http://stackoverflow.com/comment/39293185

http://stackoverflow.com/comment/39294374
has text: Your `for` loop is faulty for sure. How does `int ch` handle a `String` assignment?
comment on: http://stackoverflow.com/q/25226832
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25096744
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: UnansweredQuestion
score: -4
tagged with: android
tagged with: web-services
has body: I got a XML file from a web service and now I want to parse it in android, but it gives me unexpected token error; my XML is: Latest{LatestResult=<Root> 1.0 Latest <Code>I</MarketCode> <Date>13930506</TradeDate> <Broker>666 </BrokerCode> <Code>J</MarketCode> <Date>13930506</TradeDate> <Broker>666 </BrokerCode> <Code>I</MarketCode> <Date>13930506</TradeDate> <Broker>666 </BrokerCode> I think the parser couldn't detect { and = in first line of XML.
has comment: http://stackoverflow.com/comment/39052288
tagged with: java
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/25096879
has comment: http://stackoverflow.com/comment/42441026
has comment: http://stackoverflow.com/comment/39052420
downvote count: 4
answer count: 1
has title: Web service generated XML unexpected token error on parsing

http://stackoverflow.com/comment/39013489
type: QuestionComment
comment on: http://stackoverflow.com/q/25076079
has text: i Know it shows compilation error I don't know how to read it into an array
score: 0
type: Comment

http://stackoverflow.com/a/25191266
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25189388
downvote count: 0
has comment: http://stackoverflow.com/comment/39230559
has body: Unfortunately with Twitters mobile side phones to numbers are a one to one relationship. You will have to resort to getting a different phone number luckily there are some good options out there. Get a Skype phone number. Its about 5$ per month but would probably be the easiest and cheapest solution. If your like me and dont like lingering monthly bills attached to your credit card then you can go to almost any local gas station or store and buy a cheap phone and pay as you go plan. This will give you limited capabilities with this phone (no internet access unless you pay). But on the up side you would have a physical phone and number and no monthly bill to accidentally forget about for 3 years before you remember about it. I bought one a year or 2 ago after I dropped my phone in a river for a one time fee of about $40.
type: Answer
answers question: http://stackoverflow.com/q/25189388
upvote count: 1

http://stackoverflow.com/q/25200159
has comment: http://stackoverflow.com/comment/39245761
score: 0
tagged with: java
has title: Android Remove Method in Listadapter
has comment: http://stackoverflow.com/comment/39244691
has body: How can I create remove method in list Adapter to remove row of list view and how to use this method in my Activity ? public void remove(List&lt;contac&gt; contac) { list.remove(contac); } In my Activity : adapter.remove(list.get(i)); but it didn't worked, if I use this list.remove(i); worked but after refreshing not changed my list view. then use update method: public void updateList(List&lt;contac&gt; list) { this.list = list; notifyDataSetChanged(); } Again it didn't work. Any ideas ?
has comment: http://stackoverflow.com/comment/39244553
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39245458
tagged with: android
has comment: http://stackoverflow.com/comment/39244650
type: Question
linked to: http://stackoverflow.com/q/25197779
has comment: http://stackoverflow.com/comment/39245955

http://stackoverflow.com/comment/39006197
type: AnswerComment
score: 0
type: Comment
has text: hi friend, yep! the API works of an remote SMTP server that is owned by Mailgun, so it'll send it whenever you schedule it to be sent!
comment on: http://stackoverflow.com/a/25071882

http://stackoverflow.com/comment/39767969
score: 0
has text: That's the big problem of CDI IMO. Although the idea is good, it's too tighly coupled with all the EE baggage :|. I have other suggestions but it all depends on your environment, the requirements you have...etc.
comment on: http://stackoverflow.com/q/25120086
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/64559550
has text: why use Javascript for answer on this question ?
type: AnswerComment
comment on: http://stackoverflow.com/a/25135028
score: 0
type: Comment

http://stackoverflow.com/comment/39237614
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25180950
score: 3
has text: hm, yes, maybe i was a bit emotionaly yesterday, i hope i didn't hurt anybody... thanks for clearing your question!

http://stackoverflow.com/q/25171562
has comment: http://stackoverflow.com/comment/39195874
has comment: http://stackoverflow.com/comment/39191907
has body: This mysql script does not work correctly. I tried executing the query to create tables in the phpmyadmin and it worked. The database is created but the table does not get created and I do not get any errors/stack traces. This is my code public void createDatabase() { java.sql.Connection conn = null; java.sql.Statement stmt = null; try{ // Register JDBC driver Class.forName("com.mysql.jdbc.Driver"); // Open a connection System.out.println("Connecting to a selected database..."); conn = DriverManager.getConnection(DB_URL, USER, PASS); System.out.println("Connected database successfully..."); // Create database System.out.println("Creating table in given database..."); stmt = conn.createStatement(); String createdatabase = "CREATE DATABASE TimePoints;"; stmt.executeUpdate(createdatabase); System.out.println("Created the database."); // Create table System.out.println("Creating table in given database..."); stmt = conn.createStatement(); String createtable = "CREATE TABLE players (playername VARCHAR(38), playertime BIGINT);"; stmt.executeUpdate(createtable); System.out.println("Created the table."); }catch(SQLException se){ // Handle errors for JDBC se.printStackTrace(); }catch(Exception e){ // Handle errors for Class.forName e.printStackTrace(); }finally{ // Finally block used to close resources try{ if(stmt!=null) conn.close(); }catch(SQLException se){ }// do nothing try{ if(conn!=null) conn.close(); }catch(SQLException se){ se.printStackTrace(); } //end finally try } //end try System.out.println("Goodbye!"); }
answer count: 0
has comment: http://stackoverflow.com/comment/39192099
tagged with: java
has comment: http://stackoverflow.com/comment/39191975
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/39191916
has comment: http://stackoverflow.com/comment/39191895
has comment: http://stackoverflow.com/comment/39191868
has comment: http://stackoverflow.com/comment/39191961
has comment: http://stackoverflow.com/comment/39192525
score: 0
tagged with: sql
has title: Java table not created from mysql
type: UnansweredQuestion

http://stackoverflow.com/q/25095831
has comment: http://stackoverflow.com/comment/39066014
score: 0
has comment: http://stackoverflow.com/comment/39050601
answer count: 1
tagged with: type-mismatch
tagged with: generics
has body: Java context: Class: Channel implements ICleanable Variable: Set&lt;Channel&gt; channels = new HashSet&lt;&gt;() I need to call this method with an array of Iterable as parameter: void unexport(Iterable&lt;ICleanable&gt;[] cleanables) But I cannot devise how to write the call. This version doesn't work: unexport(new Iterable&lt;ICleanable&gt;[] { channels }) The compiler says: "Type mismatch: cannot convert from Set&lt;Channel&gt; to Iterable&lt;ICleanable&gt;" Help would be appreciated (and/or reference to learning material). Thanks. EDIT. Now that I've got the answer, I can summarize where I was wrong. I had a problem with generics and subtypping. This is a beginner error (which is exactly what I'm). Clue: List&lt;String&gt; ls = new ArrayList&lt;String&gt;(); List&lt;Object&gt; lo = ls; // Illegal, a List&lt;String&gt; is not a List&lt;Object&gt;! lo.add(new Object()); String s = ls.get(0); // Attempts to assign an Object to a String! A List&lt;String&gt; cannot be a List&lt;Object&gt;, otherwise the type safety void be void. This is explained here. I had a second problem with array of generics. unexport(new Iterable&lt;ICleanable&gt;[] { channels }) It is not possible to create an array of Iterable. This is explained here. The error on type conversion prevented this second error to be detected by the compiler before correction of the former. In my case I ended up with this: void unexport(List&lt;List&lt;? extends ICleanable&gt;&gt; cleanables) {...} Channel implements ICleanable; List&lt;Channel&gt; channels = new ArrayList&lt;&gt;(); List&lt;List&lt;? extends ITVCleanable&gt;&gt; list = new ArrayList&lt;&gt;(); list.add(channels); unexport(list);
linked to: http://stackoverflow.com/q/529085
tagged with: interface
tagged with: parameter-passing
has comment: http://stackoverflow.com/comment/39050528
type: AnsweredQuestion
has title: Type mismatch: cannot convert from Set<Channel> to Iterable<ICleanable>
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25095976
accepted answer: http://stackoverflow.com/a/25095976
has comment: http://stackoverflow.com/comment/39050670

http://stackoverflow.com/q/25176281
possible better answer: http://stackoverflow.com/a/25176402
type: AnsweredQuestion
tagged with: java
has title: Java Generics - Using Lists of Elements implementing an Interface
type: Question
has answer: http://stackoverflow.com/a/25176402
score: 4
upvote count: 4
tagged with: generic-list
answer count: 2
has body: In Java I have an interface I, a class C and a class D, both implementing I: interface I { //some method signatures } class C implements I { //implement methods from I } class D implements I { //implement methods from I } Now I create a List holding elements of class C, and a second List holding elements of D: List&lt;C&gt; c = new LinkedList&lt;C&gt;(); List&lt;D&gt; d = new LinkedList&lt;D&gt;(); I have a method that I want to apply to all Lists that hold elements implementing interface I: public void modifyList(List&lt;I&gt; l) { //call some method defined in I } However, when I try to call that function the compiler throws an error: public void testModification() { modifyList(c); modifyList(d); } ==&gt; The method modifyList(List&lt;I&gt;) in the type [...] is not applicable for the arguments (List&lt;C&gt;) / (List&lt;D&gt;) I can get it to work by redefining my List, such that it reads List&lt;I&gt; c1 = new LinkedList&lt;I&gt;(); But now c1 can hold Elements from both classes C and D, which is something I want to avoid. How can I create a List such that I can define exactly what class' elements it should hold but still use it as a parameter for my function?
downvote count: 0
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/25176373
tagged with: interface
accepted answer: http://stackoverflow.com/a/25176373

http://stackoverflow.com/q/25104028
accepted answer: http://stackoverflow.com/a/25104191
has answer: http://stackoverflow.com/a/27680155
upvote count: 5
answer count: 2
score: 5
downvote count: 0
tagged with: savepoints
favorite count: 0
tagged with: oracle-database
has answer: http://stackoverflow.com/a/25104191
tagged with: jdbc
type: AnsweredQuestion
tagged with: java
has body: I have a JDBC code where there are multiple Savepoints present; something like this: 1st insert statement 2nd insert statement savepoint = conn.setSavepoint("S1"); 1st insert statement 2nd update statement savepoint = conn.setSavepoint("S2"); 1st delete statement 2nd delete statement savepoint = conn.setSavepoint("S3"); 1st insert statement 2nd delete statement savepoint = conn.setSavepoint("S4"); Now in the catch block, I am catching the exception and checking whether the Savepoint is null or not; if yes then rollback the entire connection else rollback till a Savepoint. But I am not able to understand till which Savepoint shall I roll back. Will it be fine if I change all the savepoint names to "S1" ? In that case how will I understand how many till Savepoint did work correctly? Please advise how to understand until what Savepoint the work was performed correctly?
has title: Savepoint on JDBC
type: Question
possible better answer: http://stackoverflow.com/a/27680155

http://stackoverflow.com/q/25117163
tagged with: task-queue
tagged with: google-app-engine
accepted answer: http://stackoverflow.com/a/25117444
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25117444
type: Question
has body: We are building analytics tool which collect events from web site and mobile apps. We want to process the request with Task queue in Google App engine. When i refer the doc in Google Developers site Queue queue = QueueFactory.getDefaultQueue(); queue.add(withUrl("/analytics").param("id", String.valueOf(id))); It has option to give only param. But how do i pass entire HTTP request to task queue and process them?
upvote count: 1
tagged with: google-cloud-datastore
has title: Handle request in Google App Engine Task Queue
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/39098074
type: AnswerComment
comment on: http://stackoverflow.com/a/25121085
score: 0
type: Comment
has text: Well...by definition, collections can be parametrized with only one type. Or I don't understand what are you asking...

http://stackoverflow.com/a/64110518
has body: Remove Existing/Configured System Library: Eclipse(IDE) -&gt; Project Explorer -&gt; Project Name-&gt; (Option) Build Path -&gt; Configure Build Path -&gt; Java Build Path -&gt; Libraries -&gt; (Select) JRE System Library [(For me)jre1.8.0_231] -&gt; Remove. Currently you are at same location: Eclipse(IDE) -&gt; Project Explorer -&gt; Project Name-&gt; (Option) Build Path -&gt; Configure Build Path -&gt; Java Build Path -&gt; Libraries Now Add Same System Library Again: Add Library -&gt; JRE System Library -&gt; Workspace default JRE ((For me)jre1.8.0_231) -&gt; Finish -&gt; Apply -&gt; Close. Now wait to finish it.
score: 3
downvote count: 0
upvote count: 3
answers question: http://stackoverflow.com/q/25222811
type: Answer

http://stackoverflow.com/q/25133415
tagged with: email
tagged with: sendmail
type: UnansweredQuestion
has title: Send mail with Javalet: How can I find out which mail caused the Error
has answer: http://stackoverflow.com/a/25133703
type: Question
has body: I am working on a Javalet which sends mails to different Addresses. Sending mails to existing addresses is working fine. The xxx@xxx.xx pattern is already tested in the form with an regex and tells the user if the mail is ok or not. But if the user types a valid mail, but which does not exist, the sending fails, of course. (And throws an SendFailedException) Is there a way to give the user an error message which tells him what mail caused the error? (the one which followed the xxx@xxx.xx pattern but did not exist) Or is there any other way to test if a valid mail exists? Thank you very much for your help (-: edit: for sending the the mail I use void javax.mail.Transport.send(Message arg0, Address[] arg1) throws MessagingException
tagged with: java
score: 0
tagged with: jakarta-mail
answer count: 1

http://stackoverflow.com/comment/39052615
type: QuestionComment
has text: GET and POST are two completely different things, though. One is retrieving data given a set of query parameters; another is creating a new resource given certain data (either in a JSON post body or query parameters). I would *hope* that the response you get back from successive POST is different each time, since it's not idempotent like GET is.
comment on: http://stackoverflow.com/q/25096730
score: 0
type: Comment

http://stackoverflow.com/comment/39050670
comment on: http://stackoverflow.com/q/25095831
score: 0
type: Comment
type: QuestionComment
has text: @doctorlove. With you suggestion: `cannot convert from Iterator<Channel> to Iterable<ICleanable>`. In the method I want to process a list of unknown size of (Set of Iterable). I have though of using ... but it creates a heap pollution door, so the array. Channel actually extends UnicastRemoteObject and implements ICleanable. The method is interested only by the ICleanable features.

http://stackoverflow.com/q/25115733
has comment: http://stackoverflow.com/comment/39089206
tagged with: sorting
has comment: http://stackoverflow.com/comment/39088077
has body: Im trying to write a code in which when a user will click an a "Sort by Name" button, my program will sort the records of my Database and put them in a JTable,combining 2 DB Tables with INNER JOIN. I have managed to do this by using a resultSet and selecting for example Ascending Order. But because I dont want to have 2 buttons, one for the ASC and one for the DESC, I thought of using preparedStatement and an showInputDialog in which the user will select if he wants to have an ASC or a DESC ordering and execute the order. Also, I remembered that some programs I've seen used a feature in which the first time you clicked the button it sorted DESC and if you pressed it again would order by ASC(havent managed to find in on the WEB).About my first thought, I tried to do it but I could get past this one ResultSetMetaData mdsort = rssort.getMetaData(); I should have an ResultSet variable(rssort) to use getMetaData() but if I selected to make the program with my PreparedStatement i would get an error there. Any suggestions?? try{ Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/test1?user=me&amp;password=12345"); Statement stmtsort = conn.createStatement(); ResultSet rssort = stmtsort.executeQuery("SELECT * FROM consoles INNER JOIN hardware ON consoles.id=hardware.id ORDER BY consoles.name ASC"); // ERROR HERE!!! needs resultset,not preparedStatement ResultSetMetaData mdsort = rssort.getMetaData(); columnCount = mdsort.getColumnCount(); String[] colssort = new String[columnCount]; for (i=1;i&lt;= columnCount;i++) { colssort[i-1] = mdsort.getColumnName(i); } DefaultTableModel model = new DefaultTableModel(colssort,0); while (rssort.next()) { Object[] rowsort = new Object[columnCount]; for (i = 1 ; i &lt;= columnCount ; i++) { rowsort[i-1] = rssort.getObject(i); } model.addRow(rowsort); } JTable table = new JTable(model); model.fireTableDataChanged(); table.setCellSelectionEnabled(true); table.setColumnSelectionAllowed(true); table.setFillsViewportHeight(…
has comment: http://stackoverflow.com/comment/39088429
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39089273
has answer: http://stackoverflow.com/a/25116197
favorite count: 0
has title: Using PreparedStatement to sort records in MySQL
upvote count: 2
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/39088206
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25120800
tagged with: mysql
downvote count: 1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39088192

http://stackoverflow.com/q/25137079
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39127150
upvote count: 0
score: -1
tagged with: jackson
has title: Parse specific JSON array using JACKSON parser
has answer: http://stackoverflow.com/a/25137465
favorite count: 0
has body: { "response": [ { "id": "1", "name": "xx" }, { "id": "2", "name": "yy" } ], "errorMsg": "", "code": 0 } How to parse "response" alone using jackson parser. I am getting error as Unrecognized field "errorMsg", not marked as ignorable. My model class Response.java public class Response { @JsonProperty("id") private Integer id; @JsonProperty("name") private String name; }
accepted answer: http://stackoverflow.com/a/25137797
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4486787
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 1
has answer: http://stackoverflow.com/a/25137797
possible better answer: http://stackoverflow.com/a/25137465

http://stackoverflow.com/comment/39337810
type: Comment
comment on: http://stackoverflow.com/q/25183932
type: QuestionComment
has text: If you're using spring mvc, then I would suggest that you use spring-webmvc to implement your controller. That way, you don't have to use gson and don't have to worry about reading and writing json, as the framework does it for you -- you only have to accept and return pojos.
score: 0

http://stackoverflow.com/comment/39262210
score: 0
comment on: http://stackoverflow.com/q/25208912
type: Comment
has text: I actually have two different build systems (temporary), one being ant, the other a home-grown builder that handles c++ as well as java. Both cough and die with the -Werror flag set on the javac compilation.
type: QuestionComment

http://stackoverflow.com/a/25152369
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25152312
has comment: http://stackoverflow.com/comment/39156804
has comment: http://stackoverflow.com/comment/59341433
has body: I suggest you to avoid Scriplet and use JSP Standard Tag Library and Expression language. &lt;jsp:useBean id="test" class="com.x.y.z.Test"/&gt; ${test.printHello()} Either import the class or use fully qualified name of the class. Have a look at General JSP Overview

http://stackoverflow.com/comment/39270227
type: AnswerComment
has text: @Simrankaur And I will bet that you don't have the root of that directory tree on your classpath. Just because it is in the same place as the source files doesn't mean that it will be on the classpath.
type: Comment
comment on: http://stackoverflow.com/a/25213572
score: 0

http://stackoverflow.com/a/38472723
has body: Toggle off ACCEPT_FLOAT_AS_INT. You can check more details at https://github.com/FasterXML/jackson-databind/wiki/Deserialization-Features
type: Answer
answers question: http://stackoverflow.com/q/25076030
score: 18
upvote count: 18
downvote count: 0

http://stackoverflow.com/q/25103754
has body: Very rarely I get a deadlock while using wiki-java. Having a look at the full thread dump (acquired via kill -3 $JAVA-PID) suggests that the deadlock seems to be originating somewhere in the SSLSocketImpl. I'd prefer to avoid this deadlock in the first place (instead of doing some hacky recovery) but I am unsure how to find the cause and prevent it. Is there a way to set a timeout in the SSLSocketImpl or throw an exception in case of the deadlock? (It would be pretty straightforward to catch it in the main loop and redo the last call) Full thread dump OpenJDK 64-Bit Server VM (24.51-b03 mixed mode): "Service Thread" daemon prio=10 tid=0x00007f3cd816b000 nid=0x102c runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE "C2 CompilerThread1" daemon prio=10 tid=0x00007f3cd8168800 nid=0x102b waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "C2 CompilerThread0" daemon prio=10 tid=0x00007f3cd8165800 nid=0x102a waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "Signal Dispatcher" daemon prio=10 tid=0x00007f3cd8163800 nid=0x1029 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "Finalizer" daemon prio=10 tid=0x00007f3cd8140800 nid=0x1028 waiting on condition [0x00007f3ccb9f7000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for &lt;0x00000007d77a9080&gt; (a java.util.concurrent.locks.ReentrantLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197) at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:214) at java.util.concurrent.locks.ReentrantLock.lock(ReentrantL…
linked to: http://stackoverflow.com/q/28702552
accepted answer: http://stackoverflow.com/a/30284223
has comment: http://stackoverflow.com/comment/39065109
has title: How to handle a SSLSocketImpl Deadlock properly?
has comment: http://stackoverflow.com/comment/87278398
type: AnsweredQuestion
upvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/30284223
has comment: http://stackoverflow.com/comment/39496712
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/67227463
favorite count: 0
tagged with: wikipedia-api

http://stackoverflow.com/comment/39117299
type: Comment
type: AnswerComment
has text: oh, so the main different between them are one is checked in advance before persisting to database while another will return exception after persisting into database if errors occured?
comment on: http://stackoverflow.com/a/25130823
score: 0

http://stackoverflow.com/comment/39279845
has text: well did you click the button?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25218790
score: 0

http://stackoverflow.com/a/25073839
downvote count: 0
has comment: http://stackoverflow.com/comment/39041208
has body: The first thing you need is some way to tell the difference between your "objects". The next thing you need is some way to reference this objects in a convenient method. You could use an array, but I'm lazy and prefer to use a List Once you have these two things, painting the boxes is just a matter of looping through the List and determining which object was clicked is becomes basically the same process... To that end, I wrapped a java.awt.Rectangle around a custom Box class, which also maintains color information, this makes it much easier to manage as Rectangle has some very useful methods and can be painted easily. import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; import javax.swing.JApplet; import javax.swing.JPanel; public class WhatADag extends JApplet { @Override public void init() { add(new DragPane()); } public class DragPane extends JPanel { private List&lt;Box&gt; boxes; public DragPane() { boxes = new ArrayList&lt;&gt;(25); boxes.add(new Box(0, 0, 50, 50, Color.RED)); boxes.add(new Box(150, 150, 50, 50, Color.BLUE)); MouseAdapter handler = new MouseAdapter() { private Box hitBox; private Point offset; @Override public void mousePressed(MouseEvent e) { Point mp = e.getPoint(); for (Box box : boxes) { if (box.getBounds().contains(mp)) { hitBox = box; offset = new Point(); offset.x = mp.x - box.getBounds().x; offset.y = mp.y - box.getBounds().y; } } } @Override public void mouseReleased(MouseEvent e) { hitBox = null; } @Override public void mouseDragged(MouseEvent e) { if (hitBox != null) { Point mp = e.getPoint(); Rectangle bounds = hitBox.getBounds(); bounds.x = mp.x - offset.x; bounds.y = mp.y - offset.y; repaint(); } } }; addMouseListener(handler); addMouseMotionListener(handler); } @Override public Dimension getPreferredSize() { re…
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39011805
answers question: http://stackoverflow.com/q/25073571
accepted answer of: http://stackoverflow.com/q/25073571
type: AcceptedAnswer

http://stackoverflow.com/comment/39178072
score: 0
type: AnswerComment
has text: @WilliamF.Jameson Yes. I take my words back.
type: Comment
comment on: http://stackoverflow.com/a/25163896

http://stackoverflow.com/comment/39146375
comment on: http://stackoverflow.com/q/25147052
score: 0
type: Comment
has text: http://www.vogella.com/tutorials/JavaPersistenceAPI/article.html follow this tutorial..be more specific about your question.
type: QuestionComment

http://stackoverflow.com/q/25229429
has answer: http://stackoverflow.com/a/25229452
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: swing
type: Question
has title: JScrollPane adding one white pixel along bottom and right edges
upvote count: 2
tagged with: border
has body: I have a JFrame in which I have a JScrollPane which has a JPanel. I draw some images in my JPanel. My problem is that I noticed that the JScrollPane is adding one white pixel along the bottom and right edges of my window. If I comment out my JScrollPane entirely (and add a line to add the JPanel into the JFrame), the white pixel border is not there. This is what my code looks like: panel = new JPanel(); panel.setPreferredSize(new Dimension(160,128)); panel.setLayout(new FlowLayout(FlowLayout.CENTER, 0,0)); scrollPane = new JScrollPane(panel); scrollPane.getViewport().setPreferredSize(new Dimension((160,128)); this.add(scrollPane); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); Q: How do I get rid of that white "border" ?
tagged with: jscrollpane
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25229452

http://stackoverflow.com/a/25305942
answers question: http://stackoverflow.com/q/25118536
score: 0
type: AcceptedAnswer
type: Answer
has body: Okay, I was actually able to bypass the policies using java reflection: How to avoid installing "Unlimited Strength" JCE policy files when deploying an application? Looks like a dirty hack, but does work and doesn't require any licensing, signing and all that stuff.
accepted answer of: http://stackoverflow.com/q/25118536

http://stackoverflow.com/comment/39238880
type: Comment
has text: vefthym, one more doubt- does this buffer can also catch heapspace? Correct me if I am wrong
comment on: http://stackoverflow.com/a/25182744
score: 0
type: AnswerComment

http://stackoverflow.com/a/25073347
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25072491
has body: Start with Maven and then jump to Spring. Maven has a concept called archetypes which will help create bare minimal Spring projects. The list of archetypes is published in the Maven site. Also when you want to learn spring you will need to work with dependencies between different components. So start with Maven basics and then jump into Spring otherwise you will have a constant struggle with the spring library and its dependencies. Gradle is an elegant build system for working with large projects and is a better maven.

http://stackoverflow.com/q/25149412
has answer: http://stackoverflow.com/a/25149787
has body: I am doing some tests with generic-methods and I'd like to transform these two methods below (convertFloatListToArray and convertShortListToArray) in just one (convertListToArray): public class Helper{ public static float[] convertFloatListToArray(List&lt;Float&gt; list){ float[] array = new float[list.size()]; for(int i = 0; i&lt;list.size(); i++){ array[i] = list.get(i); } return array; } public static short[] convertShortListToArray(List&lt;Short&gt; list){ short[] array = new short[list.size()]; for(int i = 0; i&lt;list.size(); i++){ array[i] = list.get(i); } return array; } } But when I try to use generics, as below, I have some errors: public class Helper{ public static &lt;T, E&gt; T convertListToArray(List&lt;E&gt; list){ T array = new T[list.size()]; for(int i = 0; i&lt;list.size(); i++){ array[i] = list.get(i); } return array; } } I can understand java limitations about generics, but I wonder if someone know any solution, using generic-method, that I am not seeing.
tagged with: arrays
answer count: 1
downvote count: 1
tagged with: generics
favorite count: 0
tagged with: generic-method
has comment: http://stackoverflow.com/comment/39150692
upvote count: 4
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/39151092
has comment: http://stackoverflow.com/comment/39151231
has comment: http://stackoverflow.com/comment/39150631
tagged with: collections
accepted answer: http://stackoverflow.com/a/25149787
type: Question
has comment: http://stackoverflow.com/comment/39150649
has title: How to convert List<T> to Array t[] (for primitive types) using generic-method?
has comment: http://stackoverflow.com/comment/39421646
tagged with: java
has comment: http://stackoverflow.com/comment/39150621
linked to: http://stackoverflow.com/q/6522284

http://stackoverflow.com/comment/39027353
comment on: http://stackoverflow.com/a/25083458
has text: A `char` is not a `String`.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39135367
comment on: http://stackoverflow.com/q/25140144
type: Comment
has text: I don't know about android, Java does not have anything.
type: QuestionComment
score: 1

http://stackoverflow.com/a/25206152
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/39255902
has comment: http://stackoverflow.com/comment/39255784
has body: use == instead of = for comparison. == is used to compare two values for equality = is used for assigning one value to another String Remark=""; boolean Paid, PartiallyPaid, NotPaid; // initialise values else compile error, pointed out by Peter O. if(Paid==true) {Remark="Paid";} if(PartiallyPaid==true) {Remark="Partially Paid";} if(NotPaid==true) {Remark="Not Paid";} As pointed out by unholysampler for boolean values you dont have to explicitly check for equality. Following would do String Remark=""; boolean Paid, PartiallyPaid, NotPaid; // initialise values else compile error, pointed out by Peter O. if(Paid) {Remark="Paid";} if(PartiallyPaid) {Remark="Partially Paid";} if(NotPaid) {Remark="Not Paid";}
accepted answer of: http://stackoverflow.com/q/25206127
has comment: http://stackoverflow.com/comment/39257687
upvote count: 7
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25206127
type: Answer
has comment: http://stackoverflow.com/comment/39257879

http://stackoverflow.com/a/25077293
has body: I think your app cannot write to 'logs' folder. Not related to log4j configuration as such. Create the folder if it doesn't exist and give it enough permissions for the web app to write into it.
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39017215
has comment: http://stackoverflow.com/comment/39017144
answers question: http://stackoverflow.com/q/25077261
has comment: http://stackoverflow.com/comment/39015940
upvote count: 1
has comment: http://stackoverflow.com/comment/39016084

http://stackoverflow.com/comment/39108265
type: AnswerComment
comment on: http://stackoverflow.com/a/25126410
type: Comment
has text: @AneeshK As far as saving space goes, the best advise is not about extra variables on a stack frame, but about the number of stack frames that you need, i.e. the maximum depth of an invocation. You should not use recursion if the maximum depth grows linearly with the size of your data structure (unless it's a tail call and you're on a modern compiler that optimize it). When the depth of an invocation grows as Log2(N), adding a few scalar variables onto the stack is not going to make much difference.
score: 1

http://stackoverflow.com/q/25140857
has comment: http://stackoverflow.com/comment/39134883
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25141479
accepted answer: http://stackoverflow.com/a/25142458
upvote count: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39136032
downvote count: 1
type: Question
has body: I have been stuck on this for a while. Simply cannot figure out whats wrong. A pair of fresh eyes would be very helpful. I keep on getting the org.json.JSONException: End of input at character 0 of and cannot figure it out. My JSONParser public JSONObject makeHttpRequest(String url, String method, List&lt;NameValuePair&gt; params) { // Making HTTP request try { // check for request method if(method == "POST"){ // request method is POST // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse response = httpClient.execute(httpPost); String responseBody = EntityUtils.toString(response.getEntity()); //HttpEntity httpEntity = httpResponse.getEntity(); //is = httpEntity.getContent(); JSONArray jsArray = new JSONArray(responseBody); JSONObject js = jsArray.getJSONObject(0); String returnvalmsg = js.getString("message"); String returnvalsucc = js.getString("success"); }else if(method == "GET"){ // request method is GET DefaultHttpClient httpClient = new DefaultHttpClient(); String paramString = URLEncodedUtils.format(params, "utf-8"); url += "?" + paramString; HttpGet httpGet = new HttpGet(url); HttpResponse httpResponse = httpClient.execute(httpGet); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); // } catch (JSONException e) { // TODO Auto-generated catch block //e.printStackTrace(); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); json = sb.toString(); } catch (Exception e) { …
has answer: http://stackoverflow.com/a/25142458
has title: org.json.JSONException: End of input at character 0
has comment: http://stackoverflow.com/comment/39134310
answer count: 2
has answer: http://stackoverflow.com/a/25141479
has comment: http://stackoverflow.com/comment/39137173
favorite count: 0
tagged with: android-asynctask

http://stackoverflow.com/a/25173165
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/39195107
has comment: http://stackoverflow.com/comment/39214239
has body: Change the line: q1 = Integer.parseInt(JOptionPane.showInputDialog("How many would you like to take?")); To: q1 = Math.min(Integer.parseInt(JOptionPane.showInputDialog("How many would you like to take?")), q);
answers question: http://stackoverflow.com/q/25173098

http://stackoverflow.com/q/25096306
has title: How to convert string to By type
tagged with: selenium
has answer: http://stackoverflow.com/a/25096952
type: Question
has answer: http://stackoverflow.com/a/25114349
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/25106234
type: UnansweredQuestion
has body: How to convert String to By type. Following is my scenario: Keep object identification in Properties file in below manner username=By.id("username") password=By.id("password") In the application i would like to retrieve the values like Properties prop=new Properties(); prop.load("above properties file path") driver.findelement(prop.getProperty("username")) //Here in eclipse it is complaining saying "The method findElement(By) in the type WebDriver is not applicable for the arguments (String)" So can somebody help me in this? I can use like below or some other format, but i want solution for the above username="//*[@id='username']" username="username" driver.findElement(By.xpath(prop.getProperty("username")) driver.findElement(By.id(prop.getProperty("username"))
has answer: http://stackoverflow.com/a/25096724
answer count: 4
tagged with: selenium-webdriver

http://stackoverflow.com/a/25118940
answers question: http://stackoverflow.com/q/25118873
has body: It's not enough to set the next of the new Person to currentPerson and the previous of currentPerson to the new Person. You also have to set the previous of the new Person to the original previous of currentPerson, and the next of that original previous to the new Person. n.previous = current.previous; n.previous.next = n; current.previous = n; //The current person's previous person is the new person n.next = current; //new person's next pointer is the current person current = n; //current person is the new person Of course you have to validate that none of these Nodes is null (since the new Person you are adding might be the first Node in the list). So if this is the original state of the list, and you wish to add a new node between "Prev" and "current" : -------- next ----&gt; ----------- - Prev - - current - -------- &lt;---- prev ----------- You have to set the two pointers of the new node n and update two pointers (currrent.previous and Prev.next) : -------- next ----&gt; ----------- next ----&gt; ----------- - Prev - - n - - current - -------- &lt;---- prev ----------- &lt;---- prev -----------
downvote count: 0
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/39040951
type: QuestionComment
comment on: http://stackoverflow.com/q/25090434
has text: Which of the two main() methods do you want to run? Which IDE are you using?
score: 0
type: Comment

http://stackoverflow.com/comment/39137445
type: QuestionComment
has text: What a Tomcat version and what is the context listener code?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25137791

http://stackoverflow.com/a/25095565
type: Answer
has body: One can fully customize the way Apache HttpClient instantiates sockets and connects them to a remote endpoint by using ConnectionSocketFactory. This example for instance demonstrates how connect to an external host via a SOCKS proxy
score: 0
answers question: http://stackoverflow.com/q/25095019

http://stackoverflow.com/comment/39198613
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25175096
has text: Fine, but i have the time like this "7 August 2014, 8:20 am" How can i pass it to the "DateUtils.getRelativeTimeSpanString(long time, long now, long minResolution)"

http://stackoverflow.com/comment/39099334
type: Comment
has text: I mean what do this method ?
type: QuestionComment
comment on: http://stackoverflow.com/q/25121956
score: 0

http://stackoverflow.com/q/25147632
score: 1
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25147681
tagged with: jmenubar
tagged with: java
upvote count: 1
tagged with: swing
type: Question
has body: I cannot figure out why my menu bar isn't visible. I have following code: //Main import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class Menu extends JFrame{ public static void main(String[] args){ JFrame frame = new JFrame(); frame.setSize(500,350); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); menuBar mbObj = new menuBar(); mbObj.menuBar(frame); } } //Menu Bar class public class menuBar{ private JMenu file,edit; private JMenuItem nFile ,oFile,sFile,saFile,exit; private JMenuItem undo,copy,paste; private JMenuBar bar; public void menuBar(JFrame frame){ bar = new JMenuBar(); frame.setJMenuBar(bar); bar.setVisible(true); file = new JMenu("File"); edit = new JMenu("Edit"); bar.add(file); bar.add(edit); } }
accepted answer: http://stackoverflow.com/a/25147681
has title: java JMenuBar not visible? Why?
answer count: 1
downvote count: 0

http://stackoverflow.com/a/28293539
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25129781
has body: same problem is coming to me,I make a changes in eclipse.ini file and did -Dosgi.requiredJavaVersion=1.8 instead of -Dosgi.requiredJavaVersion=1.6 and my problem has been resolved.

http://stackoverflow.com/comment/39182608
comment on: http://stackoverflow.com/a/25166114
score: 0
type: AnswerComment
has text: Actually, I found the right file, it was the "Home" folder, it worked ! Thanks a lot !
type: Comment

http://stackoverflow.com/comment/39010806
type: QuestionComment
has text: @Anubhav Really, I did a small write test it worked fine for me...
comment on: http://stackoverflow.com/q/25073435
score: 0
type: Comment

http://stackoverflow.com/comment/39057756
has text: Is there any why to change that buffering, or could I print to another console?
comment on: http://stackoverflow.com/a/25099686
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25104867
tagged with: exception
has body: I am running a java applet in browser which is showing the following error: AccessControlException access denied("java.io.FilePermission""image.jpg""read") How ro resolve this. The applet is running fine with appletviewer this is the associated code: p1=new JPanel(); titleicon=new ImageIcon("image.jpg"); img=new JLabel(titleicon); p1.add(img); This is the permission granted: grant codeBase "file:///C:/project/appcode_game3.htm" { permission java.io.FilePermission "&lt;&lt;ALL FILES&gt;&gt;", "read"; };
answer count: 0
type: UnansweredQuestion
has title: How to solve Access Control Exception in java applet
has comment: http://stackoverflow.com/comment/39093455
has comment: http://stackoverflow.com/comment/39069071
has comment: http://stackoverflow.com/comment/39068546
tagged with: java
has comment: http://stackoverflow.com/comment/39067355
has comment: http://stackoverflow.com/comment/39099928
type: Question
score: 0
tagged with: applet

http://stackoverflow.com/comment/39247518
score: 2
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25201913
has text: Use the OR logical operator (`||`): `if(pizza.equals("string1") || pizza.equals("string2") || pizza.equals("string3")) {...}`

http://stackoverflow.com/q/25169303
has comment: http://stackoverflow.com/comment/39187452
tagged with: java
possible better answer: http://stackoverflow.com/a/25169387
has answer: http://stackoverflow.com/a/25169387
type: Question
has title: Unrecognized Field error in deserialization with Jackson
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39189402
score: 0
has body: I'm having problems deserializing JSON into my POJO object. This is my JSON {"userID":"346","userMemID":"10","userFirstName":"FIRSTNAME","userLastName":"LASTNAME","userSkillLevel":"7","userProviderID":"098"} And here is my Class public class Drivers { private String userID = ""; private String userMemID = ""; private String userFirstName = ""; private String userLastName = ""; private String userSkillLevel = ""; private String userProviderID = ""; public String getUserID() { return userID; } public void setUserID(String userID) { this.userID = userID; } public String getUserMemID() { return userMemID; } public void setUserMemID(String userMemID) { this.userMemID = userMemID; } public String getUserFirstName() { return userFirstName; } public void setUserFirstName(String userFirstName) { this.userFirstName = userFirstName; } public String getUserLastName() { return userLastName; } public void setUserLastName(String userLastName) { this.userLastName = userLastName; } public String getUserSkillLevel() { return userSkillLevel; } public void setUserSkillLevel(String userSkillLevel) { this.userSkillLevel = userSkillLevel; } public String getUserProviderID() { return userProviderID; } public void setUserProviderID(String userProviderID) { this.userProviderID = userProviderID; } } This is the function that recieves the JSON. @POST @Path("/save") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public ResourceResponse saveDrivers(Drivers entities) { ResourceResponse resourceResponse = new ResourceResponse(); driversBean.saveDrivers(entities); resourceResponse.setReturnCode(ResourceResponse.GOOD); return resourceResponse; } This is the code that sends the JSON I don't think this is the problem though because the JSON string is formatted correctly saveDrivers: function(criteria) { var mySettings = { type: "POST", url: "../resources/drivers/save", data: ko.toJSON($ata.drivers.model), cache: false, dataType: "json", contentType: "application/json; char…
answer count: 2
has answer: http://stackoverflow.com/a/25172042
tagged with: deserialization
has comment: http://stackoverflow.com/comment/39188948
accepted answer: http://stackoverflow.com/a/25172042
type: AnsweredQuestion

http://stackoverflow.com/comment/39156053
comment on: http://stackoverflow.com/q/25152312
has text: After importing now this error: Multiple annotations found at this line: - The import com.jsp.Test cannot be resolved - The import com.jsp.Test cannot be resolved
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25184099
has answer: http://stackoverflow.com/a/25184542
favorite count: 0
has title: Refer to deployed jar as maven dependency
type: AnsweredQuestion
has body: folks, please advise. I have a maven project with many maven modules. Those modules are java web applications and one jar, on which those web apps depend and which contains core functionality (let's call it core.jar). I deploy them to stable release of Wildfly app server with no problem and everything works fine. However, I noticed that all of my war files contain the same core.jar in the WEB-INF/lib folder. Could you tell me if it is possible to deploy this core.jar only once and make all war files see it? The only thing I could think of now is to install this core.jar as a jboss module (like this) and refer to it from manifest file in every web app. What do you think? Regards, Oleg
accepted answer: http://stackoverflow.com/a/25184542
tagged with: maven
upvote count: 1
tagged with: war
type: Question
score: 1
tagged with: java
tagged with: wildfly-8
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/39172100
has text: Sorry to disappoint you, but what you have posted is not valid JSON.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25161387
score: 1

http://stackoverflow.com/q/25128956
tagged with: java
has comment: http://stackoverflow.com/comment/39113541
answer count: 1
tagged with: applet
tagged with: awt
accepted answer: http://stackoverflow.com/a/25129531
has title: Java - Drawing Text in an Applet
has body: I know there are a lot of answers for this but they don't seem to work. I don't know whether I am somehow using a different version of Java or the code for applet's is different but here's my code: Snippet from HUD class: public void paint (Graphics g) { if(g instanceof Graphics2D) { Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d.drawString("This is gona be awesome", 200, 200); } Main Class: import java.applet.Applet; (more, they just glitched with the code block) public class Main extends Applet implements Runnable, KeyListener { static ArrayList&lt;Block&gt; all_blocks = new ArrayList&lt;Block&gt;(); Player player; HUD hud; static int amount = 0; public void init(){ setSize(700, 500); addKeyListener(this); } public void start(){ player = new Player(100, 100); HUD hud = new HUD(); for (int i = 0; i &lt; 75; i++){ new Grass(i*30, 400); } new Spikes(250, 370); Thread thread = new Thread(this); thread.start(); } @Override public void run() { while (true){ player.update(); repaint(); camera_scroll(this.amount); try { Thread.sleep(17); } catch (InterruptedException e) { e.printStackTrace(); } } } public void stop(){ } public void camera_scroll(int amount){ int new_amount; if (amount &gt; 30){ new_amount = 30; this.amount -= 30; } else { new_amount = amount; this.amount = 0; } for (Block b: all_blocks){ b.x += new_amount; b.update(); } player.x += new_amount; } public void paint(Graphics g){ for (Block block: all_blocks){ block.paint(g); } hud.paint(g); player.paint(g); } @Override public void keyPressed(KeyEvent e) { switch(e.getKeyCode()){ case KeyEvent.VK_LEFT: case KeyEvent.VK_A: player.moveLeft(); break; case KeyEvent.VK_RIGHT: case KeyEvent.VK_D: player.moveRight(); break; case KeyEvent.VK_UP: case KeyEvent.VK_W: player.moveUp(); break; } } @Override public void keyReleased(KeyEvent e) { switch(e.getKeyCode()){ case KeyEvent.VK_LEFT: case KeyEvent.VK_A: player.stopLeft(); break…
tagged with: drawing
has comment: http://stackoverflow.com/comment/39113562
tagged with: text
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39113019
has comment: http://stackoverflow.com/comment/39154379
type: Question
linked to: http://stackoverflow.com/q/6255106
has answer: http://stackoverflow.com/a/25129531

http://stackoverflow.com/comment/39209001
type: QuestionComment
score: 0
has text: @TheNewIdiot @ Stefan Beike this is bad advice to a noob - coding against some implemantion thwarts the idea of separating an interface from its implementation!
comment on: http://stackoverflow.com/q/25181088
type: Comment

http://stackoverflow.com/q/25217504
favorite count: 0
has comment: http://stackoverflow.com/comment/39284058
tagged with: spring
has comment: http://stackoverflow.com/comment/39335909
has body: How can I setup programmatically the @Scheduled annotation? For example: @Scheduled(fixedDelay = 600000) private void checkUserMostView(){...} SOLUTION Although the solution provided by the buddies more below it's alright, finally I have decided to implement this other aproximation. http://rockyj.in/2011/06/29/using-spring-for-scheduling-tasks.html
has comment: http://stackoverflow.com/comment/39278304
linked to: http://stackoverflow.com/q/4816568
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/39278688
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39281216
downvote count: 0
has title: Setup Spring @Scheduled annotation programmatically

http://stackoverflow.com/q/25138413
type: Question
answer count: 2
tagged with: java-native-interface
score: 4
favorite count: 0
has title: Java JNI Maven native-maven-plugin - how to set shared library final name
has answer: http://stackoverflow.com/a/25155655
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/37419086
tagged with: maven
tagged with: native-maven-plugin
upvote count: 4
downvote count: 0
tagged with: java
has body: I am playing around with JNI and Maven to see how to automate the building process. I am encountering some difficulties on Linux platform when it comes to the output file name. When I run the maven build (below is the pom.xml for the linux platform), the shared library file name returned is jniExampleNative.so. If I try to run the java program with it I get java.lang.UnsatisfiedLinkError: no jniExampleNative in java.library.path. If I rename the file to libjniExampleNative.so it works. I want to setup Maven so it automaticaly creates the file with the working file name, but don't know how. I tried setting linkerFinalName option (it is commented in the below pom.xml), but I get The packaging for this project did not assign a file to the build artifact. Where am I doing things the wrong way and how can I set the output shared library's name? 4.0.0 net.tricoder.jnitest nativeParent 1.0-SNAPSHOT net.tricoder.jnitest jniExampleNative 0.0.1-SNAPSHOT JNI example native Linux http://maven.apache.org so net.tricoder.jnitest jniExampleJava 1.0-SNAPSHOT jar compile maven-compiler-plugin 3.1 1.6 1.6 org.codehaus.mojo native-maven-plugin true linux generic-classic gcc gcc ../src/main/native jni_example.c -fPIC -shared <!--linkerOutputDirectory>${project.build.directory}</linkerOutputDirectory> <linkerFinalName>libjniExampleNative</linkerFinalName--> javah generate-sources linux default ${project.build.directory}/custom-javah ${basedir} NativeStuff.h net.tricoder.jnitest.NativeStuff javah

http://stackoverflow.com/comment/39110667
type: QuestionComment
score: 0
has text: The relevant information is still rather scattered in (or even not contained in) the provided code. Roughly: You have a tile position (which seems to be passed to the "renderMob" method). For the animation, you need an *additional* offset within the tile. This offset could, for example, be modified by a `javax.swing.Timer` that increments the offset every 20 milliseconds and triggers a repaint. (But ... your painting seems to consist of *setting pixels in an array* - which is rather unusual, so I'm not entirely sure whether this will work for your...)
comment on: http://stackoverflow.com/q/25125696
type: Comment

http://stackoverflow.com/a/25607720
answers question: http://stackoverflow.com/q/25203541
type: AcceptedAnswer
has body: I have not used this library, but looking over the manual, it is stack based - is there an ordering issue when referring to the parent (Message) which presumably is under the child (Header), the newer object being on top of the stack? The FAQ has a little information about this: http://wiki.apache.org/commons/Digester/FAQ See -> How do I get CallMethodRule to fire before SetNextRule? Where the suggested example sequence is: digester.addObjectCreate("parent", Parent.class); digester.addObjectCreate("parent/child", Child.class); digester.addSetNext("parent/child", "addChild"); digester.addCallMethod("parent/child", "setName", 1); digester.addCallParam("parent/child/name", 0); Hope this helps.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40072070
has comment: http://stackoverflow.com/comment/40070926
score: 1
accepted answer of: http://stackoverflow.com/q/25203541
downvote count: 0

http://stackoverflow.com/comment/39246580
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25201304
has text: I understand that there will be loss. I have this sine wave which generates values like the one mentioned above, but I want them as shorts. Direct casting with short gives me a value of 0. so what is the solution?
score: 0

http://stackoverflow.com/comment/39104507
has text: As far as I can see, you're just firing some SQL and not even caring about the data it returns. And since you never read the data you get, your table doesn't update
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25124482

http://stackoverflow.com/comment/39130753
has text: @TheLostMind yes I got it, I am not telling `StringBuffer` is `mutable String`, I am telling `StringBuffer` is `mutable Object`. Am I right now?
score: 1
comment on: http://stackoverflow.com/q/25138587
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39095843
score: 0
type: AnswerComment
type: Comment
has text: @isht - Glad I could be of help :P
comment on: http://stackoverflow.com/a/25119839

http://stackoverflow.com/a/27060965
score: -1
has body: i had the same problem for a long long time with IE ( ff and chrome are just fine) a few days ago i just started a remote desktop connection from my hub machine to my node machine and ....magic, everything looks just fine right now :-) what do you think?
answers question: http://stackoverflow.com/q/25137802
downvote count: 1
type: Answer
upvote count: 0

http://stackoverflow.com/q/25086853
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25279454
tagged with: spring
has answer: http://stackoverflow.com/a/28935174
has body: OK so I've been reading several of the other stack questions and trying to piece this together without much luck. Basically my approach is that I currently have one project with multiple sub-projects. I basically have the following: root |----backend |----|----src |----|----|----main |----|----|----|----java (individual java files not shown) |----|----|----|----resources |----|----|----|----|----META-INF |----|----|----|----|----|----applicationContext.xml |----|----|----|----webapp |----|----|----|----|----WEB-INF |----|----|----|----|----|----web_servicesConfig.xml |----|----|----|----|----|----web.xml |----|----pom.xml |----deploy |----|----src |----|----|----main |----|----|----|----resources (properties files for tomcat) |----|----pom.xml |----frontend |----|----app |----|----|----angular files |----|----bower_components |----|----|----bower files |----|----bower.json |----|----Gruntfile.js |----|----pom.xml Ok hopefully that's clear enough on the file structure. I'm planning to use the maven-grunt-plugin so I can run my grunt commands on the frontend. The front end is basically the same setup as yo angular produces or that's at least the goal. Deploy simply sets up tomcat, and backend holds the Spring 4 restful services/api. OK so this is were I'm confused and looking for help. I don't know how to get the frontend to work correctly with the backend. Basically I was wondering if there's a way to tell maven to start the Tomcat, and Grunt servers in dev mode so that I can use both of their features to quickly develop my project, and then pulling the min files into the war for the production build. I guess I can't figure out how to make everything play nicely together. I checked out this question which kind of talks about it but I'm still confused: How to deploy AngularJS app and Spring Restful API service on the same domain/server? I would love any links to tutorials that address how to use Maven with tomcat, spring, angularjs, and grunt...also bower so I can use…
tagged with: maven-tomcat-plugin
upvote count: 7
has title: Web App (Spring, Angular, Grunt, Maven, Tomcat) running both grunt and tomcat servers
type: Question
score: 7
tagged with: java
tagged with: gruntjs
answer count: 2
downvote count: 0
favorite count: 0
tagged with: angularjs

http://stackoverflow.com/comment/39285323
has text: Yes, it means calling `Thread.start()` twice.
score: 0
comment on: http://stackoverflow.com/q/25221823
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25072839
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39007694
has body: 1 - Download the IDE. E.g.: http://release.seleniumhq.org/selenium-ide/2.5.0/selenium-ide-2.5.0.xpi 2 - Copy it into your VM 3 - Drag and drop the file directly into your FF 4 - Install it like usual
answers question: http://stackoverflow.com/q/25072805
has comment: http://stackoverflow.com/comment/39008771
downvote count: 0

http://stackoverflow.com/comment/39057618
type: Comment
has text: in java does system.exit(0); tidy everything up, like close threads and say db connections before exiting. Im used to C where you do everything manually so Im unsure what the JVM does for you and what you need to do yourself.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25097828

http://stackoverflow.com/comment/39115931
comment on: http://stackoverflow.com/q/25130788
score: 1
type: Comment
has text: input is 5+20+5+11 but in your list [5, 20, 2, 0, 5, 11, 1?
type: QuestionComment

http://stackoverflow.com/q/25090542
has answer: http://stackoverflow.com/a/25092725
answer count: 1
has comment: http://stackoverflow.com/comment/39040989
has comment: http://stackoverflow.com/comment/39041111
has comment: http://stackoverflow.com/comment/39040988
has title: Using eclipse to create a new project
type: UnansweredQuestion
tagged with: new-project
has body: I tried to create a new project "hbv8" by going to file -->new java project, and I used the default settings. Why is my hbv8 has an red x at the corner of its icon? It also automatically imported the source code from hbv7 with me importing it. Can someone please help? Many thanks in advance! The problems window shown as below, but I didn't import those things from hbv 7 so I can't figure out what was the problem..
tagged with: project
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/39041075
has comment: http://stackoverflow.com/comment/39041001
score: 0

http://stackoverflow.com/comment/39246815
type: AnswerComment
has text: Thanks, I am trying this out. I also need to distinguish between the Follower and Followee by different labels. I have added ON MATCH and ON CREATE clauses and trying this out. BTW, what was the total size of your dataset, and how much time it took for you to import it? I am getting out of memory errors, I have set the max heap size to 2GB.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25191645

http://stackoverflow.com/a/25103923
score: 0
has body: there is no such functionality in junit. also, in Junit you normally run each test case separately and give each a different name. Junit discourages running many tests in the same test case (it will fail if only one out of 20 tests succeed or 19 of them fail). Your test case should have the general structure of: public void testTooManyCases() { while get a line and !eof // catch exceptions and in finally close the file parse the line //e.g: String[] parts = line.split(","); //use comma to separate in the input file //calculate the answer for the info in the line //e.g: double answer = nameSimilarity.similarity(parts[0], parts[1]); //assert //e.g.: assertTrue((answer &gt; THRESHHOLD) == new Boolean(parts[2]).booleanValue()); } your file should have in each line something like: aaaa,abbba,true cccc,zzzzz,false
answers question: http://stackoverflow.com/q/25103532
type: Answer

http://stackoverflow.com/comment/39189083
comment on: http://stackoverflow.com/a/25168094
score: 0
type: AnswerComment
has text: For me this solution won't work - I was talking with some of my co-workers and now we came to the conclusion that we wan't look at the file content and don't want to have any requierements on these. Of course you answer is valid for my question because it represents the folder with relationships in files so i will accept this answer. Thanks for your help and the idea - I think i will come back really soon because it would be a nice feature to solve problems with this technique :)
type: Comment

http://stackoverflow.com/comment/39110976
type: Comment
type: AnswerComment
has text: Hi thanks for the answer, i ended up just using revalidate() then repaint(), instead of pack() and it solved my problems
score: 0
comment on: http://stackoverflow.com/a/25123882

http://stackoverflow.com/comment/39208730
type: QuestionComment
comment on: http://stackoverflow.com/q/25181107
score: 0
has text: No. This code works. This is the feature that I am trying to figure out :) More about this you can find here: http://docs.spring.io/spring/docs/3.0.5.RELEASE/reference/aop.html (section 7.2.5 Introductions)
type: Comment

http://stackoverflow.com/a/25185756
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/25185679
has comment: http://stackoverflow.com/comment/39217460
score: 4
has body: You can create a wrapper for that object which will have the overridden methods. Then you can use the wrapper class as the key of your hash map.

http://stackoverflow.com/comment/39219986
type: AnswerComment
has text: Lambdas are divided into _implicitly-typed_ (no manifest types for parameters) and _explicitly-typed_; method references are divided into _exact_ (no overloads) and _inexact_. When a generic method call in a receiver position has lambda arguments, and the type parameters cannot be fully inferred from the other arguments, you need to provide either an explicit lambda, an exact method ref, a target type cast, or explicit type witnesses for the generic method call to provide the additional type information needed to proceed.
type: Comment
comment on: http://stackoverflow.com/a/25173599
score: 41

out-of-memory
tags question: http://stackoverflow.com/q/25208800
tags question: http://stackoverflow.com/q/25155060
tags question: http://stackoverflow.com/q/25093819
tags question: http://stackoverflow.com/q/25069743
tags question: http://stackoverflow.com/q/25214553
tags question: http://stackoverflow.com/q/25169927
tags question: http://stackoverflow.com/q/25161323
tags question: http://stackoverflow.com/q/25166024
type: Tag
tags question: http://stackoverflow.com/q/25208328
tag name: out-of-memory
tags question: http://stackoverflow.com/q/25086124

http://stackoverflow.com/a/25230741
type: Answer
has comment: http://stackoverflow.com/comment/39309869
has body: The intent of the Builder design pattern is to separate the construction of a complex object from its representation. By doing so, the same construction process can create different representations. You don't want/need different representations of your JSON response, so no need to apply Build Pattern. Why not simply: public interface CalculatorService { Result calculate(x, y); } and public class ResultJSONConverter { public JSONResponse convert(Result result); } You'd use them like this: JSONResponse response = new ResultJSONConverter().convert(calculatorService.calculate(x,y));
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25227558
has comment: http://stackoverflow.com/comment/39308840
accepted answer of: http://stackoverflow.com/q/25227558

http://stackoverflow.com/q/25178866
tagged with: java
tagged with: http://stackoverflow.com/tag/c
type: Question
has answer: http://stackoverflow.com/a/25179018
answer count: 1
has title: Can a C library be loaded directly in Java without using JNI?
favorite count: 0
has comment: http://stackoverflow.com/comment/135208128
linked to: http://stackoverflow.com/q/2035243
has body: I am new to Java my project needs a C API calls called in JAVA file ,i tried with swig in Linux created shared library but i am facing issues there , any other way to call a C API in Java dll directly loaded in any JAVA IDES tool, where it matches with function address called in Java and return the output as in C program does.conclusion load my C dll or library file in JAVA IDES and call the API from JAVA which are there in C lib.Direct function address matching and returning.
upvote count: 2
type: UnansweredQuestion
score: 1
downvote count: 1
tagged with: dll

http://stackoverflow.com/q/25225390
type: Question
accepted answer: http://stackoverflow.com/a/25225519
linked to: http://stackoverflow.com/q/1732348
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39292573
tagged with: junit
has answer: http://stackoverflow.com/a/25225449
has body: i have this weird problem. I have this Java method that works fine in my program: /* * Extract all image urls from the html source code */ public void extractImageUrlFromSource(ArrayList<String> imgUrls, String html) { Pattern pattern = Pattern.compile("\\<[ ]*[iI][mM][gG][\t\n\r\f ]+.*[sS][rR][cC][ ]*=[ ]*\".*\".*>"); Matcher matcher = pattern.matcher(html); while (matcher.find()) { imgUrls.add(extractImgUrlFromTag(matcher.group())); } } This method works fine in my java application. But whenever I test it in JUnit test, it only adds the last url to the ArrayList /** * Test of extractImageUrlFromSource method, of class ImageDownloaderProc. */ @Test public void testExtractImageUrlFromSource() { System.out.println("extractImageUrlFromSource"); String html = " fdjfakdsd df "; ArrayList<String> imgUrls = new ArrayList<String>(); ArrayList<String> expimgUrls = new ArrayList<String>(); expimgUrls.add("http://image1.png"); expimgUrls.add("http://image2.jpg"); expimgUrls.add("http://image3.jpg"); ImageDownloaderProc instance = new ImageDownloaderProc(); instance.extractImageUrlFromSource(imgUrls, html); imgUrls.stream().forEach((x) -> { System.out.println(x); }); assertArrayEquals(expimgUrls.toArray(), imgUrls.toArray()); } Is it the JUnit that has the fault. Remember, it works fine in my application.
has title: Matcher.find() only find the last match in JUnit Test
possible better answer: http://stackoverflow.com/a/25225449
has answer: http://stackoverflow.com/a/25225519
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/39182583
comment on: http://stackoverflow.com/q/25166586
type: QuestionComment
type: Comment
has text: Hi, yes some other people in the same class as me are also having the same problem
score: 0

http://stackoverflow.com/q/25165800
answer count: 4
has answer: http://stackoverflow.com/a/25166180
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25165950
has answer: http://stackoverflow.com/a/25166313
has comment: http://stackoverflow.com/comment/39181033
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25165902
has title: Can I use a Java property value to reference a Java variable or constant?
has comment: http://stackoverflow.com/comment/39180926
score: 0
has comment: http://stackoverflow.com/comment/39181173
has body: Assume I have a Java constant called DARK_CYAN that is equal to an RBG hex value. I'd like to allow a user to utilize a JSON or XML file to configure my program. The configuration file would have key/value pairs such as "WINDOW_BACKGROUD:DARK_CYAN". When the program reads in the configuration properties, it would see that the window background needs to be set to DARK_CYAN. Is it possible to reference the Java constant DARK_CYAN using a string value of "DARK_CYAN"?

http://stackoverflow.com/comment/39124549
type: QuestionComment
comment on: http://stackoverflow.com/q/25135516
has text: "the first parameter is parentComponent: Defines the Component that is to be the parent of this dialog box. It is used in two ways: the Frame that contains it is used as the Frame parent for the dialog box, and its screen coordinates are used in the placement of the dialog box. In general, the dialog box is placed just below the component. This parameter may be null, in which case a default Frame is used as the parent, and the dialog will be centered on the screen (depending on the L&F)." http://stackoverflow.com/questions/8144018/how-to-set-position-of-joptionpane
score: 0
type: Comment

http://stackoverflow.com/comment/39053178
score: 0
comment on: http://stackoverflow.com/q/25097065
type: QuestionComment
type: Comment
has text: you mean the bitrate?

http://stackoverflow.com/a/25116376
type: AcceptedAnswer
type: Answer
has body: I'm not entirely sure what it is that your trying to achieve and why you specifically need to use an ArrayList, but I can describe the problem you are facing with your code and how you might fix it. At the moment you declare your ArrayList variable digits here; List&lt;String&gt; digits = new ArrayList&lt;String&gt;(); And in your OnSendRead() method you are creating a second digits variable that hides your ArrayList variable of the same name. Ie, here; char[] digits = newNumber.toCharArray(); String str = (String) digits.get(0); I would suggest simply dropping the ArrayList and using the correct syntax with the new basic array you create in this method like so; char[] digits = newNumber.toCharArray(); String str = digits[0]+"";
accepted answer of: http://stackoverflow.com/q/25116187
answers question: http://stackoverflow.com/q/25116187
score: 0

http://stackoverflow.com/q/25105476
linked to: http://stackoverflow.com/q/7229226
has comment: http://stackoverflow.com/comment/39068844
type: UnansweredQuestion
has title: JButton disappears after requestFocusInWindow is called on the JPanel that contains the button
has comment: http://stackoverflow.com/comment/39068716
answer count: 0
has body: I think my code will illustrate the problem, but basically I have a button in a Panel in a Panel in a Panel, and I want to get rid of that third Panel, but if I do I can't requestFocus anymore, because then the button disappears. Here's my code: import javax.swing.JFrame; public class A{ private JFrame frame = new JFrame(); private C c = new C(); public A() { //Now it works frame.add(c.getPanel()); frame.pack(); frame.setVisible(true); //Now it won't //c.getPanel().requestFocusInWindow(); } public static void main(String[] args) { new A(); } } and import javax.swing.JButton; import javax.swing.JPanel; public class C { private JPanel mainpanel; private JButton button; public C(){ button = new JButton("Back"); //This fixes the issue, if you comment that same line in getPanel() //mainpanel = createPanel(); } private JPanel createPanel() { JPanel panel = new JPanel(); panel.add(button); return panel; } public JPanel getPanel(){ mainpanel = createPanel(); return mainpanel; //I actually want it to be return createPanel(); getting rid of mainpanel altogether } } This is just example code, I left out everything that isn't important. I want to call createPanel() in getPanel() to update the Panel before it's used, and I want the focus so I can navigate by Keyboard. What am I doing wrong?
tagged with: swing
has comment: http://stackoverflow.com/comment/39068905
type: Question
has comment: http://stackoverflow.com/comment/39068777
tagged with: java
score: 0

http://stackoverflow.com/a/25317913
has body: One solution is through using reflection. I'm not sure if there are other solutions that might look cleaner though. The following does compile and run though. public class SkillsSet&lt;T extends SkillType&gt; { private Map&lt;T,Integer&gt; skills = new HashMap&lt;&gt;(); // These don't have to be class members, they could be passed // around as parameters private T[] enumConstants; // needed only for getEnumValue private Class&lt;T&gt; enumClass; // needed only for getEnumValueAlternate public SkillsSet(String[] skills, Class&lt;T&gt; enumClass) { // Though all implementers of SkillType are currently enums, it is safer // to do some type checking before we do any reflection things enumConstants = enumClass.getEnumConstants(); if (enumConstants == null) throw new IllegalArgumentException("enumClass is not an enum"); for (String string : skills) { T t = getEnumValue(string) if (t == null) { // or use continue if you dont want to throw an exception throw new IllegalArgumentException(); } this.skills.put(t, t.getPenalty()); } } // These don't even need to be methods, but I separated them for clarity. // SuppressWarnings annotation is used since we checked types in the constructor @SuppressWarnings( "unchecked" ) public T getEnumValue( String string ) { try { return (T) enumConstants[0].fromValue(string); } // If valueOf does not find a match, it throws IllegalArgumentExecption catch ( IllegalArgumentException e ) { return null; } } // An alternate version of getEnumValue that does not require the 'fromValue' // method on the SkillType interface. @SuppressWarnings( "unchecked" ) public T getEnumValueAlternate( String string ) { try { return (T) enumClass.getMethod("valueOf", String.class).invoke(null, string) } // Any reflection exceptions are treated as 'not found' on valueOf catch (Exception e) { return null; } } ... } There are two different versions of getEnumValue. I'd recommend the version that uses the getEnumConstants method on the enumClass parameter. It also al…
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25197783
type: Answer
answers question: http://stackoverflow.com/q/25197783
score: 2
downvote count: 0

http://stackoverflow.com/q/25187922
tagged with: java
tagged with: unit-testing
type: Question
has body: I have a unit test (JUnit 4) with some pretty complex setup: public class HDF5CompoundDSCutoffCachingBridgeTest { protected final String TEST_PATH = "test-out.h5"; protected final DatasetName TEST_DS = new DatasetName("group", "foo"); protected WritableDataPoint testPoint1; protected WritableDataPoint emptyPoint; protected WritableDataPoint[] emptyPoints; protected WritableDataPoint[] fullPoints; protected IHDF5Writer writer; protected HDF5CompoundDSBridgeConfig config; protected HDF5CompoundDSCachingBridge&lt;WritableDataPoint&gt; dtBridge; @Before public void setUp() throws Exception { try { File file = new File(TEST_PATH); testPoint1 = new WritableDataPoint(new long[][]{{1, 2}}, new long[][]{{3, 4}}, 6, 10l); emptyPoint = new WritableDataPoint(new long[][]{}, new long[][]{}, 0, 0l); emptyPoints = new WritableDataPoint[]{emptyPoint, emptyPoint, emptyPoint, emptyPoint, emptyPoint,}; fullPoints = new WritableDataPoint[]{testPoint1, testPoint1, testPoint1, testPoint1, testPoint1,}; config = new HDF5CompoundDSBridgeConfig(HDF5StorageLayout.CHUNKED, HDF5GenericStorageFeatures.MAX_DEFLATION_LEVEL, 5); writer = HDF5Writer.getWriter(file); HDF5CompoundDSBridgeBuilder&lt;WritableDataPoint&gt; dtBuilder = new HDF5CompoundDSBridgeBuilder&lt;&gt;(writer, config); dtBuilder.setChunkSize(5); dtBuilder.setStartSize(5); dtBuilder.setTypeFromInferred(WritableDataPoint.class); dtBuilder.setCutoff(true); buildBridge(dtBuilder); } catch (StackOverflowError e) { // other stuff } } protected void buildBridge(HDF5CompoundDSBridgeBuilder&lt;WritableDataPoint&gt; dtBuilder) throws Exception { dtBridge = dtBuilder.buildCaching(TEST_DS); } // a bunch of tests follow } Now, I've subclassed the class that's under test here. It still needs the complex setup in the original test. It's behavior is pretty much the same -- it needs to do all of the things that the parent class does, plus it passes slightly different information to dtBuilder. I could just copy-paste the configuration code over. Thi…
tagged with: inheritance
has title: Should my unit tests for derived classes inherit from my test for the superclass?
linked to: http://stackoverflow.com/q/6453235
tagged with: junit
has answer: http://stackoverflow.com/a/25188117
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39221684
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39221735
score: 2

http://stackoverflow.com/a/28033282
score: 0
type: AcceptedAnswer
has body: I solved the problem by changing the version element in porm.xml from "1.0.0-BUILD-SNAPSHOT" to 0.0.1 but I don't understand what exactly happens coz I'm not familiar with maven but i think there are some JARs that have been downloaded when i changed the version element. This is my porm.xml in case you want to use it : <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.ofamy ofamy-project war 0.0.1 ofamy-project http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <spring.core.version>4.0.6.RELEASE</spring.core.version> <spring-data-neo4j.version>3.1.2.RELEASE</spring-data-neo4j.version> <neo4j.version>2.1.3</neo4j.version> <junit.version>4.11</junit.version> <hibernate-validator.version>5.1.2.Final</hibernate-validator.version> <scala.library.version>2.10.3</scala.library.version> <cglib.version>2.2</cglib.version> <aspectj.version>1.6.10</aspectj.version> <slf4j.version>1.7.5</slf4j.version> <log4j.version>1.2.17</log4j.version> <javax.servlet-api.version>2.5</javax.servlet-api.version> <javax.jstl-taglibs.version>1.1.2</javax.jstl-taglibs.version> <jackson.version>1.9.3</jackson.version> <spring.social.core.version>1.1.0.RELEASE</spring.social.core.version> <spring.social.web.version>1.1.0.RELEASE</spring.social.web.version> <spring.social.facebook.version>1.1.1.RELEASE</spring.social.facebook.version> <spring.security.core.version>3.2.4.RELEASE</spring.security.core.version> <spring.security.config.version>3.2.4.RELEASE</spring.security.config.version> <spring.security.web.version>3.2.4.RELEASE</spring.security.web.version> <mockito.version>1.8.5</mockito.version> <junit.version>4.8.2</junit.version> <maven.compiler.plugin.version>2.3.2</maven.compiler.plugin.version> <maven.apt.plugin.version>1.0</maven.apt.plugin.version> com.yammer.metrics metrics-core 2.2.0 org.a…
type: Answer
accepted answer of: http://stackoverflow.com/q/25164978
answers question: http://stackoverflow.com/q/25164978

http://stackoverflow.com/q/25074313
type: Question
has answer: http://stackoverflow.com/a/25074363
tagged with: split
score: 0
has comment: http://stackoverflow.com/comment/39010100
has comment: http://stackoverflow.com/comment/39010147
tagged with: string
has title: timestamp string split to get date and time effective way
has comment: http://stackoverflow.com/comment/39010129
has body: 1) using regular expressions, patterns 2) using split function in String class I tried using split function i think its not a good coding practice. splitted input string using '_' iterate array like that Strings START_READING_20140723_093539.jpg Description_20140723_093539.jpg Qunantity_20140723_183539.jpg END_READING_20140723_093539.jpg Input Format is : yyyyMMdd_HHmmss Output Format is : 23-07-2014 6:35:39PM
answer count: 5
tagged with: regex
has answer: http://stackoverflow.com/a/25074517
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25074653
has answer: http://stackoverflow.com/a/25074871
tagged with: java
has answer: http://stackoverflow.com/a/25074752

http://stackoverflow.com/comment/39211327
comment on: http://stackoverflow.com/a/25181939
type: AnswerComment
has text: I don't want insert if missing. My workflow is: Request from Client Check if exists Return error for dupplicate username I need realy just a simple check. But countAll seems not to be the most efficient way.
score: 0
type: Comment

http://stackoverflow.com/a/25105530
accepted answer of: http://stackoverflow.com/q/25105486
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/39068484
answers question: http://stackoverflow.com/q/25105486
type: AcceptedAnswer
downvote count: 0
has body: Key is just pressed. It is not pressed over any application. When key is pressed OS cares to send appropriate event to appropriate window. Typically this is the window that is in focus at the moment. I believe that you are confused because you are running your code from IDE or from console, so the currently focused application is IDE or console. But try to do the following. Implment application that presses and then releases key A but does it after some reasonable delay (e.g. 5 sec). Now do the following. Start notepad, then start your application, then press alt-tab to focus the notepad and wait. When your application emulates key press, you should see the letter a into your notepad. Good luck.
type: Answer

http://stackoverflow.com/comment/122899691
type: Comment
score: 0
has text: This only seems to change the background of a single cell. Even updating the `endColumnIndex` to a value > 1, it still only updates a single cell for me.
comment on: http://stackoverflow.com/a/47192473
type: AnswerComment

http://stackoverflow.com/a/25083247
answers question: http://stackoverflow.com/q/25082728
type: Answer
downvote count: 0
score: 1
upvote count: 1
has body: I think it depends on how you want to treat a "failure" : If you just want to know if something is valid, then you better use a method that just return true or false (like Pattern.matches or Object.equals) If the end user 'knows' how works the method (or the system), you better use an enum, an object representing the result, or even a special attribute in the object you return. As instance : Product getProduct(Integer id) {} that return null if the product dosen't exist The HTTP header that contain a code representing the answer of the request (200, 404, ...) If your end user don't 'know' the system and you want to force him to treat the problem because it can lead to an unsafe state, you better use a method like you use currently. It isn't classy but it's safe. Boolean myMethod () throws ExceptionFailure1, ExceptionFailure2, ... {...}

http://stackoverflow.com/q/25226645
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25226725
type: Question
has title: Find missing element from one array comparing from other in single for loop
tagged with: algorithm
tagged with: arrays
has answer: http://stackoverflow.com/a/25226725
possible better answer: http://stackoverflow.com/a/25226763
has comment: http://stackoverflow.com/comment/39294072
upvote count: 2
tagged with: search
has comment: http://stackoverflow.com/comment/39294096
answer count: 3
linked to: http://stackoverflow.com/q/3492302
has body: Is it possible to find out one missing element from one array that is not present in other array using single for loop in Java e.g. a1 = {2,5,1,9,3,4} , length n+1 a2 = {2,4,1,5,3} , length n missing element - 9 Using only a single for loop not by collections. Is it possible??
has answer: http://stackoverflow.com/a/25226737
favorite count: 0
has comment: http://stackoverflow.com/comment/39294004
has answer: http://stackoverflow.com/a/25226763

openmap
tags question: http://stackoverflow.com/q/25118435
tag name: openmap
type: Tag

http://stackoverflow.com/q/25178089
tagged with: selenium-webdriver
score: 0
tagged with: java
answer count: 2
tagged with: selenium
has answer: http://stackoverflow.com/a/25178641
has comment: http://stackoverflow.com/comment/39204408
accepted answer: http://stackoverflow.com/a/25179355
has body: I have a Selenium test case that I need to write, but before it executes I need to get some information from the user for the Test to run. Currently, my code is structured like this: public class myTest { private WebDriver driver; @Before System.setProperty("webdriver.ie.driver", "C:\\Users\\ktuck\\Documents\\Selenium\\Selenium Server\\IEDriverServer.exe"); driver = new InternetExplorerDriver(); // I guess I don't need to fire this up as i'm only collecting information from the user? @Test // Code to collect user inputted data to use later in my test @After public void tearDown() throws Exception { driver.quit(); // Do I need this? } } My initial thoughts were to put the collection code inside of a main function and then call the rest of my test script which would be in a different file, passing the information collected into it. But I'm not quite sure how to do that as I'm quite new to Selenium/Java :p Can anyone help?
has comment: http://stackoverflow.com/comment/39204705
possible better answer: http://stackoverflow.com/a/25178641
tagged with: eclipse
has title: Structing my Selenium Test
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39203885
has comment: http://stackoverflow.com/comment/39204492
type: Question
has answer: http://stackoverflow.com/a/25179355

http://stackoverflow.com/a/25183891
answers question: http://stackoverflow.com/q/25183780
downvote count: 0
has body: Please see How to Write an Internal Frame Listener which includes the following sample code: package events; /* * InternalFrameEventDemo.java requires no other files. */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class InternalFrameEventDemo extends JFrame implements InternalFrameListener, ActionListener { JTextArea display; JDesktopPane desktop; JInternalFrame displayWindow; JInternalFrame listenedToWindow; static final String SHOW = "show"; static final String CLEAR = "clear"; String newline = "\n"; static final int desktopWidth = 500; static final int desktopHeight = 300; public InternalFrameEventDemo(String title) { super(title); //Set up the GUI. desktop = new JDesktopPane(); desktop.putClientProperty("JDesktopPane.dragMode", "outline"); //Because we use pack, it's not enough to call setSize. //We must set the desktop's preferred size. desktop.setPreferredSize(new Dimension(desktopWidth, desktopHeight)); setContentPane(desktop); createDisplayWindow(); desktop.add(displayWindow); //DON'T FORGET THIS!!! Dimension displaySize = displayWindow.getSize(); displayWindow.setSize(desktopWidth, displaySize.height); } //Create the window that displays event information. protected void createDisplayWindow() { JButton b1 = new JButton("Show internal frame"); b1.setActionCommand(SHOW); b1.addActionListener(this); JButton b2 = new JButton("Clear event info"); b2.setActionCommand(CLEAR); b2.addActionListener(this); display = new JTextArea(3, 30); display.setEditable(false); JScrollPane textScroller = new JScrollPane(display); //Have to supply a preferred size, or else the scroll //area will try to stay as large as the text area. textScroller.setPreferredSize(new Dimension(200, 75)); textScroller.setMinimumSize(new Dimension(10, 10)); displayWindow = new JInternalFrame("Event Watcher", true, //resizable false, //not closable false, //not maximizable true); //iconifiable JPanel contentPane = new JPanel(); contentPane.setB…
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/39197101
type: QuestionComment
has text: @Wyzard No. Actually I am checking the licence file periodically. Not for each request. But I have some variables in context scope and their status depends on licence file status.
comment on: http://stackoverflow.com/q/25174440
score: 0
type: Comment

http://stackoverflow.com/q/25073019
tagged with: java
type: Question
has body: I am reading Detecting Device Type in a web application and just got curious if it would be possible to client to fake the User-Agent when sending the request? Question(s) - user sends request via curl command but fakes it to look as if request is coming from Mobile on the server? is it possible? - Can server detect it? - Can server prevent it? Thanks
tagged with: javascript
score: 0
answer count: 1
has title: Faking User-Agent when sending request to server?
tagged with: curl
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8515161
tagged with: web-services
tagged with: http
has answer: http://stackoverflow.com/a/25073178

http://stackoverflow.com/q/25151264
has answer: http://stackoverflow.com/a/46969732
has body: I have a method in controller with has parameter for example @RequestMapping(value = "/{blabla}", method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED) public void post(@RequestHeader("ETag") int etag) If there is no ETag header in request - client gets 400 (BAD_REQUEST), which is not any informative. I need to somehow handle this exception and send my own exception to client (I use JSON for this purpose). I know that I can intercept exception via @ExceptionHandler, but in that case all HTTP 400 requests will be handled, but I want that have missing ETag in headers. Any ideas?
possible better answer: http://stackoverflow.com/a/54230885
has answer: http://stackoverflow.com/a/25174774
upvote count: 17
has answer: http://stackoverflow.com/a/64028132
favorite count: 0
has answer: http://stackoverflow.com/a/61868456
has answer: http://stackoverflow.com/a/67568544
has answer: http://stackoverflow.com/a/67505346
has answer: http://stackoverflow.com/a/25151363
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/54559266
tagged with: java
has answer: http://stackoverflow.com/a/25171140
accepted answer: http://stackoverflow.com/a/25171140
score: 17
answer count: 11
tagged with: servlets
has title: Intercept @RequestHeader exception for missing header
type: Question
has answer: http://stackoverflow.com/a/54230885
has answer: http://stackoverflow.com/a/25168092

http://stackoverflow.com/a/25069730
has comment: http://stackoverflow.com/comment/39002307
downvote count: 0
has comment: http://stackoverflow.com/comment/39002649
has comment: http://stackoverflow.com/comment/39002927
has body: failT is a local variable to the actionPerormed method, which is initialised to 1 each time the method is called, this means that it is impossible for the value to ever be &gt;= 3 You need to define topics value as a class/instance field, so it's value is maintained at the class level instead Take a look at Understanding Class Members for more details.
type: Answer
has comment: http://stackoverflow.com/comment/39002509
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25069691

http://stackoverflow.com/q/25223562
has comment: http://stackoverflow.com/comment/86708580
favorite count: 0
accepted answer: http://stackoverflow.com/a/25224161
tagged with: io
has body: I have been doing a lot of reading on this idea and I have read many different people asking questions about it. I came across: http://javatroops.blogspot.ca/2012/12/sort-very-large-text-file-on-limited.html and I had some questions about it. (Sorry I am unsure on the exact rules on linking blogs and what not). I understand the basis of external sorting where I am breaking down the file into temporary files and then performing a merge sort on the number of temporary files. However, this method would stress the I/O wouldn't it because of all the files? I could limit the number of files opened at one time by doing multiple passes of n-way merge, but I wished to find improvements. So reading that blog post above, I understand the idea behind the Solution 2, less so Solution 3 but I do not understand its implementation in Java. In the middle of both solutions, after the file has been split into temporary files, all the files are read into BufferedReaders (mini question about bufferedreaders and filereaders: is it just that it adds buffering and makes I/O faster but doesn't change usability from a programmer's perspective?) and then mapped. Does this process of mapping not take up memory? I am confused on how inserting into a TreeSet would take up memory but putting into a TreeMap wouldn't. How does Solution 3 work exactly?
tagged with: dictionary
has title: Sorting large file with memory constraints - external sort
type: AnsweredQuestion
tagged with: memory-management
has comment: http://stackoverflow.com/comment/50594564
tagged with: java
linked to: http://stackoverflow.com/q/7918060
upvote count: 1
has comment: http://stackoverflow.com/comment/39290474
type: Question
has comment: http://stackoverflow.com/comment/86708767
has answer: http://stackoverflow.com/a/25224161
tagged with: sorting
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39290079

http://stackoverflow.com/q/25087071
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25088372
tagged with: java
has title: Calling a web service with no wsdl
type: Question
has body: I want to write a Java program to call a web service. WSDL is not available for this web service. I have written programs to call a web service which has wsdl. Here I don't have any idea of how I can proceed. Not able to find many samples in Internet as well. Is there any better frame work which I can use? I am getting JSON output from web service. I am looking at options of writing a best possible case(If I could write a generalized program which could be used for many web services with out much changes, it would be great)
score: 0
answer count: 1
tagged with: wsdl
has answer: http://stackoverflow.com/a/25088372
tagged with: web-services

http://stackoverflow.com/a/25136889
has comment: http://stackoverflow.com/comment/39126942
answers question: http://stackoverflow.com/q/25136816
score: 0
has body: 1 . Change database version, and then start app.. OR 2. Try uninstalling app and then instal.. "Sharing logs always helps to find problem in your code..."
type: Answer

http://stackoverflow.com/a/25107849
has comment: http://stackoverflow.com/comment/39074598
has body: I think your problem is in the following line of code ParseUser user = mUsers.get(5); mUsers.get(5) is probably null, or doesn't exist. There is nothing in your code which guarantees that the list has to be at least size 5. Try this instead @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.matching); //create list variable mUsers = new List&lt;ParseUser&gt;(); } @Override protected void onResume() { ... ParseQuery&lt;ParseUser&gt; query = ParseUser.getQuery(); query.findInBackground(new FindCallback&lt;ParseUser&gt;() { public void done(List&lt;ParseUser&gt; users, ParseException e) { if (e == null) { //add all the users to your list variable mUsers.addAll(users); //check the size of your list to see how big it is before accessing it final int size = mUsers.size(); //or use a loop to loop through each one for(ParseUser mParseUser : mUsers) { //skip over the current user if(mParseUser == ParseUser.getCurrentUser()) continue; //use the correct type when getting final String mName = user.getString("name"); final int mNumber = user.getNumber("age"); final String mHeadLine = user.getString("headline"); } } else { // Something went wrong. } } }); }
has comment: http://stackoverflow.com/comment/39076327
has comment: http://stackoverflow.com/comment/39075733
has comment: http://stackoverflow.com/comment/39076648
accepted answer of: http://stackoverflow.com/q/25107766
answers question: http://stackoverflow.com/q/25107766
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/39110567

http://stackoverflow.com/comment/39174008
has text: Joe, for me it's clear how to work with a pre-built menu but it's not clear how to work starting from a menu that has only a menu bar. In my bean I need to reference the menu bar by a variable bound to the UI component: the problem seems to be that bindings between variables in the bean and UI components are accessible only after the page is loaded. I don't know if the use of @PostConstruct could workaround this "limit"...
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25161763
type: AnswerComment

web-applications
tags question: http://stackoverflow.com/q/25203310
tags question: http://stackoverflow.com/q/25210399
tags question: http://stackoverflow.com/q/25096388
tags question: http://stackoverflow.com/q/25208105
tags question: http://stackoverflow.com/q/25158626
tags question: http://stackoverflow.com/q/25183443
tags question: http://stackoverflow.com/q/25199754
tags question: http://stackoverflow.com/q/25083831
tag name: web-applications
tags question: http://stackoverflow.com/q/25104913
tags question: http://stackoverflow.com/q/25175372
tags question: http://stackoverflow.com/q/25193278
tags question: http://stackoverflow.com/q/25156974
type: Tag

http://stackoverflow.com/a/25092556
has body: If you utilize java.awt.panel, you can try something like for(Component component : myPanel.getComponents()) { if(component instanceof JTextField) { JTextField textField = (JTextField) component; buildYourSearchQuery(textField.getText()); } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25092189

http://stackoverflow.com/comment/39200012
has text: yes where does i need to draw the images then? because now ill do it in the draw method of the layer class and it is still slow
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25139716
type: Comment

http://stackoverflow.com/a/25161301
type: Answer
answers question: http://stackoverflow.com/q/25155577
score: 0
has body: I dont have a ready made solution for this but would encourage to do some reading on Thomas Erl's publications

http://stackoverflow.com/comment/39215409
type: QuestionComment
has text: the problem is why your code should consider Twenty Two as 22 and not 40 (20 x 2) or Nine Million as 1,000,009 (1,000,000 + 9). So in short when you'll know where to distinguish between addition and multiplication?
score: 0
comment on: http://stackoverflow.com/q/25184712
type: Comment

http://stackoverflow.com/comment/39275727
score: 0
has text: Yes. I understood. I just want to investigate theory.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25206185

http://stackoverflow.com/q/25125022
has comment: http://stackoverflow.com/comment/39106041
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/25131609
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
tagged with: jpa
has body: How do I get JPA to enforce unique values of a composite unique constraint on the Many side of a OneToMany relationship? In the code below, I have a Person entity that has an internal id, and that also has a set of external composite orgids which are used to identify the patient's relationship with other organizations. These external composite ids consist of a root component which identifies a specific organization, and an extension component, which identifies the person within the specific organization identified by the root. Therefore, the combination of root/extension must be unique in the set of orgids that is associated with each person. How can I set the code up to accomplish this? The code below keeps trying to insert redundant root/extension values in the person_org_id table, though the MySQL database rejects these insert attempts due to the Unique constraint in the DDL below. @Entity @Table(name = "person") public class Person { @Id @Column(name = "id") public Integer id; @OneToMany(cascade = CascadeType.ALL, mappedBy = "person") private Set&lt;PersonID&gt; orgids; //other properties, then //getters and setters } @Entity @Table(name = "person_org_id", uniqueConstraints={@UniqueConstraint(columnNames = {"id_root", "id_extension"})}) public class PersonID { @Id @Column(name = "id") public int id; @ManyToOne @JoinColumn(name = "person_id") private Person person; @NotNull @ManyToOne @JoinColumn(name="id_root") private Organization org; @NotNull @Column(name="id_extension") private String orgpersonid; //getters and setters } CREATE TABLE IF NOT EXISTS person( id int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY # , other fields )engine=InnoDB;SHOW WARNINGS; CREATE TABLE IF NOT EXISTS person_org_id( id int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, person_id int(11) UNSIGNED NOT NULL, id_root varchar(100), id_extension varchar(100), CONSTRAINT UniqueRootExtKey UNIQUE (id_root, id_extension), FOREIGN KEY (person_id) REFERENCES person(id), FOREIGN KEY (id…
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39105917
has title: composite unique constraint in OneToMany relationship
favorite count: 0
type: UnansweredQuestion
tagged with: spring

webservice-client
tags question: http://stackoverflow.com/q/25229988
type: Tag
tag name: webservice-client

http://stackoverflow.com/q/25115034
score: 2
has comment: http://stackoverflow.com/comment/39087077
downvote count: 0
tagged with: java
tagged with: quartz-scheduler
has comment: http://stackoverflow.com/comment/39086707
type: Question
has comment: http://stackoverflow.com/comment/39086525
has comment: http://stackoverflow.com/comment/39086845
upvote count: 2
has answer: http://stackoverflow.com/a/25305314
accepted answer: http://stackoverflow.com/a/25305314
has title: Posticipate Quartz expression to the next weekday
has comment: http://stackoverflow.com/comment/39086598
has body: I need to create a Quartz cron expression that fires every 10th day of the month if it is a weekday, otherwise fires to the next day or the day after the next. E.g. August 10th 2014 is Sunday, fire Monday 11th E.g. September 10th 2014 is Wednesiday, fire Wednesday 10th E.g. January 10th 2015 is Saturday, fire Monday 12th I highlighted the third case: I tried 0 0 0 10W * ? as expression but it fires Friday Jan 8th 2015. I need it to be fired later. How do I tell Quartz to? I wanted to make three expressions, e.g. "the 10th if it is a weekday", "11th if it is a monday" and "12th if it is a monday" but I can't combine day-of-month and day-of-week fields (I always get an Invalid cron expression error)
answer count: 1
tagged with: scheduled-tasks
favorite count: 0
has comment: http://stackoverflow.com/comment/39087114
type: AnsweredQuestion

http://stackoverflow.com/q/25114844
has title: Access an service in jboss through JNDI (RMI?)
has answer: http://stackoverflow.com/a/25123204
accepted answer: http://stackoverflow.com/a/25123204
type: AnsweredQuestion
tagged with: rmi
tagged with: java
tagged with: jboss
type: Question
tagged with: jndi
answer count: 1
has body: I need to make an service in jboss and access it through JNDI on the client side. I have been playing around a bit with JNDI and made something like this on the client side: import javax.naming.*; public class App { public static void main(String[] args) throws NamingException { App app = new App(); app.setSysProp(); app.setObject(); app.getObject(); } public void setSysProp() { System.setProperty(Context.PROVIDER_URL, "127.0.0.1:1099"); System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); } public void setObject() throws NamingException { Context context = new InitialContext(); MyObject obj = new MyObject(); obj.setName("NameOfMyObject"); context.bind("obj", obj); } public void getObject() throws NamingException { Context context = new InitialContext(); MyObject obj = (MyObject) context.lookup("obj"); System.out.println(obj.getName()); } } This only binds and object to jndi on the client side and later retrieves it. Now what i want is to bind a similar object on the server side (Jboss 4.2.3) and through it make some operations on the server. How can this be done? Ive read that something named RMI should be used in this case but what exactly is that and how to use it?
score: 0

http://stackoverflow.com/comment/39270943
type: AnswerComment
has text: hey move that line after class declaration i.e. just before overriding onCreate() function
type: Comment
comment on: http://stackoverflow.com/a/25213916
score: 0

http://stackoverflow.com/a/26733329
downvote count: 1
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/25178664
score: -1
has body: SSL handshake needs some time to exchange the keys/certificates before establishing an SSL channel. You could increase the time out to 20 sec/20000 ms and check if this indeed is the problem.
has comment: http://stackoverflow.com/comment/118006113

http://stackoverflow.com/comment/39108477
comment on: http://stackoverflow.com/a/25120768
has text: kayaman pls am sorry if am disturbing...i have taken my time to go through the tutorial and i have discovered that i really need to remodel a lot of things which i dont have the time to do :( pls can u just look at my code a bit especially the if(rs.next()) segment. i also dont understand what you mean by that i am mixing data access code and GUI...tnx a lot bro
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25143688
upvote count: 1
has comment: http://stackoverflow.com/comment/39152069
has body: Likely the teacher is trying to make his or her students think, and will be satisfied with creative solutions that solve the problem. None of these solutions would be used in the real world, because we have the String.length() method. But the creative, problem-solving process you're learning would be used in real development. "1. Check the element,and when get the out of bounds exception,it means the end of string,we catch this exception,then we can get the length." Here, you're causing an exception to be thrown in the normal case. A common style guideline is for exceptions to be thrown only in exceptional cases. Compared to normal flow of control, throwing an exception can be more expensive and more difficult to follow by humans. That said, this one of your ideas has a potential advantage for very long strings. All of the posted answers so far run in linear time and space. The time and/or additional space they take to execute is proportional to the length of the string. With this approach, you could implement an O(log n) search for the length of the string. Linear or not, it's possible that the teacher would find this approach acceptable for its creativity. Avoid if the teacher has communicated the idea that exceptions are only for exceptional cases. "2. Every time a string is pass to calculate the length,we add the special character to the end of it,it can be '\0',or "A",etc.." This idea has a flaw. What happens if the string contains your special character? EDIT A simple implementation would be to get a copy of the underlying char array with String.toCharArray(), then simply take its length. Unlike your ideas, this is not an in-place approach - making the copy requires additional space in memory. String s = "foo"; int length = s.toCharArray().length;
score: 1
has comment: http://stackoverflow.com/comment/39139830
has comment: http://stackoverflow.com/comment/39140277
has comment: http://stackoverflow.com/comment/39140689
downvote count: 0
answers question: http://stackoverflow.com/q/25142975
has comment: http://stackoverflow.com/comment/39139706
has comment: http://stackoverflow.com/comment/39141242
has comment: http://stackoverflow.com/comment/39141684
has comment: http://stackoverflow.com/comment/39153040
type: Answer

http://stackoverflow.com/comment/39243155
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25192717
has text: Are you new to OOP? It's not sequential so it's new concepts, if you're new to OOP as well as Android then it's definitely going to be helpful to read a bunch of tutorials first
type: AnswerComment

http://stackoverflow.com/a/25206543
score: 1
downvote count: 0
has body: Criteria in Hibernate represent the same thing as the English word: criteria - for a search in this case. The example taken from the very first paragraph of the documentation for Criteria answers your "design pattern" question: List cats = session.createCriteria(Cat.class) .add( Restrictions.like("name", "Iz%") ) .add( Restrictions.gt( "weight", new Float(minWeight) ) ) .addOrder( Order.asc("age") ) .list(); The Hibernate manual has a short but informative chapter on Criteria which addresses your question among others. All of this is easily findable in the official documentation and elsewhere.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25200310

http://stackoverflow.com/a/25156999
score: 16
upvote count: 16
answers question: http://stackoverflow.com/q/25156724
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25156724
has body: In order to have a race between two threads, there must be shared state between those two threads and interaction (reading and writing) to that state must occur outside of a mutualy exclusive block (aka syncronized). Reading, incrementing and then writing back to a volatile field outside of a synchronized block is a great example of this. For example, consider this situation documented on this blog. Both thread A and B could read the counter before any modification occurs. They then both increment, and they then both write. The end result will then be 18, and not 19. For it to have been 19, we would have needed thread B to read the counter AFTER thread A had written to the counter. Which, can happen sometimes. That is why it is called a race. To reliably achieve this kind of race, change your test code above to create the counter outside of the threads and then pass it in to them via their constructors. The second problem that you have is that the window for the operations to overlap is very fine, and given that starting a thread has, in comparison a lot of over head then the chances of these three threads over lapping at just the right time is very low. Thus to increase their odds, you should repeat the runs in a tight loop. The following code demonstrates the two concepts above. The changes made have been: renamed classes to make their use a little clearer shared the state of MyCounter between the two threads tight loop within each thread, calling increment 1,000,000 times the main thread now blocks using join() waiting for the two threads to complete, this replaces the Thread.sleep that you had earlier the counter value c in MyCounter is now volatile; this tells the JVM to always go out to shared memory for the value and not to optimise by keeping it within a register between encounters. to make the race much worse, take volatile off and see what happens :) the main loop then finishes by printing out the value of the counter, which should be 2,000,000. but it wil…
type: Answer

http://stackoverflow.com/comment/39171708
type: QuestionComment
comment on: http://stackoverflow.com/q/25161036
score: 0
has text: I am a software programmer camp, each child has 10 minutes to play on a computer and I want to program all children want to enter the list put his name program to count 10 minutes, once the program has finished counting window pops up that says that the line of the next child arrived
type: Comment

http://stackoverflow.com/q/25158798
answer count: 0
tagged with: java
tagged with: hibernate
has title: HTTP Status 404 -/Pracownik/
has comment: http://stackoverflow.com/comment/39168895
type: Question
tagged with: jsp
score: 0
has comment: http://stackoverflow.com/comment/39167158
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: maven
has body: I working on that project for 2 days and i can't finde why it's doesn't work. It is a typical CRUD web application using SPRING,HIBERNATE,MAVEN and Tomcat web.xml <?xml version="1.0" encoding="UTF-8"?> contextConfigLocation /WEB-INF/spring/root-context.xml org.springframework.web.context.ContextLoaderListener dispatcherServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation WEB-INF/spring/dispatcherServlet/servlet-context.xml 1 dispatcherServlet / root-context.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" 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.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> pl.kert.pracownik.model update org.hibernate.dialect.PostgreSQLDialect false <tx:annotation-driven transaction-manager="transactionManager" /> <context:component-scan base-package="pl.kert.pracownik" /> </beans> serlvet-context.xml <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/mvc" 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:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.spring…

http://stackoverflow.com/comment/39299544
score: 1
type: QuestionComment
has text: It looks like your trail licence expired. What version of Penthao you are using? CE (downloaded from sourceforge, jenkins, ect) or EE downloaded from Pentaho site after typing your contact informations?
type: Comment
comment on: http://stackoverflow.com/q/25229034

jdbc
tags question: http://stackoverflow.com/q/25126277
tags question: http://stackoverflow.com/q/25151314
tags question: http://stackoverflow.com/q/25163488
tags question: http://stackoverflow.com/q/25120200
tags question: http://stackoverflow.com/q/25075145
tags question: http://stackoverflow.com/q/25134443
tags question: http://stackoverflow.com/q/25103373
tags question: http://stackoverflow.com/q/25196522
tags question: http://stackoverflow.com/q/25105345
tags question: http://stackoverflow.com/q/25111116
tags question: http://stackoverflow.com/q/25102726
tags question: http://stackoverflow.com/q/25097596
tags question: http://stackoverflow.com/q/25224852
tags question: http://stackoverflow.com/q/25081287
tags question: http://stackoverflow.com/q/25226781
tags question: http://stackoverflow.com/q/25125019
tags question: http://stackoverflow.com/q/25213900
tags question: http://stackoverflow.com/q/25157273
tags question: http://stackoverflow.com/q/25206863
tags question: http://stackoverflow.com/q/25188970
tags question: http://stackoverflow.com/q/25183948
tags question: http://stackoverflow.com/q/25177034
tags question: http://stackoverflow.com/q/25212341
type: Tag
tags question: http://stackoverflow.com/q/25147904
tags question: http://stackoverflow.com/q/25213935
tags question: http://stackoverflow.com/q/25077165
tags question: http://stackoverflow.com/q/25115733
tags question: http://stackoverflow.com/q/25152211
tags question: http://stackoverflow.com/q/25143344
tags question: http://stackoverflow.com/q/25083537
tags question: http://stackoverflow.com/q/25176860
tags question: http://stackoverflow.com/q/25130781
tags question: http://stackoverflow.com/q/25211930
tags question: http://stackoverflow.com/q/25193401
tags question: http://stackoverflow.com/q/25207972
tags question: http://stackoverflow.com/q/25184184
tags question: http://stackoverflow.com/q/25184553
tags question: http://stackoverflow.com/q/25081829
tags question: http://stackoverflow.com/q/25157528
tags question: http://stackoverflow.com/q/25155060
tags question: http://stackoverflow.com/q/25089580
tags question: http://stackoverflow.com/q/25086027
tags question: http://stackoverflow.com/q/25227197
tags question: http://stackoverflow.com/q/25141461
tags question: http://stackoverflow.com/q/25096127
tags question: http://stackoverflow.com/q/25186725
tags question: http://stackoverflow.com/q/25074373
tags question: http://stackoverflow.com/q/25131136
tags question: http://stackoverflow.com/q/25172453
tags question: http://stackoverflow.com/q/25204852
tags question: http://stackoverflow.com/q/25177556
tags question: http://stackoverflow.com/q/25183900
tags question: http://stackoverflow.com/q/25174255
tags question: http://stackoverflow.com/q/25183596
tags question: http://stackoverflow.com/q/25080148
tags question: http://stackoverflow.com/q/25168254
tags question: http://stackoverflow.com/q/25208049
tags question: http://stackoverflow.com/q/25186557
tags question: http://stackoverflow.com/q/25117501
tags question: http://stackoverflow.com/q/25214477
tags question: http://stackoverflow.com/q/25094459
tags question: http://stackoverflow.com/q/25100297
tags question: http://stackoverflow.com/q/25089874
tags question: http://stackoverflow.com/q/25075997
tags question: http://stackoverflow.com/q/25123373
tags question: http://stackoverflow.com/q/25180775
tags question: http://stackoverflow.com/q/25155244
tags question: http://stackoverflow.com/q/25155998
tag name: jdbc
tags question: http://stackoverflow.com/q/25145190
tags question: http://stackoverflow.com/q/25134851
tags question: http://stackoverflow.com/q/25186653
tags question: http://stackoverflow.com/q/25087615
tags question: http://stackoverflow.com/q/25104028
tags question: http://stackoverflow.com/q/25099674
tags question: http://stackoverflow.com/q/25152110
tags question: http://stackoverflow.com/q/25140835
tags question: http://stackoverflow.com/q/25083812
tags question: http://stackoverflow.com/q/25213552

http://stackoverflow.com/comment/39105413
type: Comment
has text: Thanks for your help. I referred to this link, for a sample implementation of the type handler. [LocalDateTypeHandler] (https://github.com/LukeL99/joda-time-mybatis/blob/master/src/main/java/org/joda/time/mybatis/handlers/LocalDateTypeHandler.java)
comment on: http://stackoverflow.com/a/25124841
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39238785
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25195954
score: 0
has text: Sorry about that, new to stackoverflow. But my addMileage (Button) is OnCLickListener, thus sending input from EditText to TextView. I just want to add a number like 3500 to the string before it views in TextView.

http://stackoverflow.com/comment/39111723
comment on: http://stackoverflow.com/q/25128344
type: Comment
has text: Android does not have much in the way of printing support before Android 4.4.
score: 0
type: QuestionComment

http://stackoverflow.com/q/25229365
has answer: http://stackoverflow.com/a/25229955
tagged with: java
has comment: http://stackoverflow.com/comment/39300391
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39299749
favorite count: 0
accepted answer: http://stackoverflow.com/a/25229955
has body: I have to write a program described below, but I don't exactly understand how this task should be accomplished. So, this is what I have to do: I have to create class School using singleton pattern and add attribute name and main() method to the class. Then create an array of objects with 10 Student objects and 1 Teacher object using factory pattern, and invoke work() method of all these objects. Next, create class PersonFactory with method createPerson(...), which creates either Student or Teacher depending on passed parameter. Create class Student with property name and default value "Student" with method work(), which prints on console name is learning where name is value of the name property. 5.Create class Teacher with property name and default value "Teacher" with method work(), which prints on console name is teaching. Finally, create get..() and set..() methods to get/set attribute values, where necessary. Having very little experience in Java and programming as such, this is proving to be somewhat challenging for me. This is what I have so far: School class. public class School { // from what I understood, lazy instantiation //can be used, or am I wrong? private String name; private static School instance = null; protected School() { } public static School getInstance() { if (instance == null) { instance = new School(); } return instance; } public static void main(String[] args) { // Usual way String[] Student = new String[11]; for (int i = 1; i &lt; Student.length; i++) { System.out.println("Student no: " + i); Teacher theTeacher = new Teacher(); //Student.work(); //Teacher.work(); } }} Teacher class. public class Teacher { private String name = this.name = "Teacher"; //most likely wrong public void work() { System.out.println(" is teaching..."); } } PersonFactory class. public class PersonFactory { public void createPerson() { } } Student class. public class Student { private String name = this.name = "Student"; public void work() { System.out.println("is …
has title: Singleton and factory pattern implementation in an exercise
type: AnsweredQuestion
upvote count: 3
downvote count: 3
has comment: http://stackoverflow.com/comment/39299246
has comment: http://stackoverflow.com/comment/39299262
type: Question

http://stackoverflow.com/comment/39086335
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25115108
score: 1
has text: Iterate your array and check the length then simply remove items from array that are smaller than 20 characters

http://stackoverflow.com/comment/39177253
type: AnswerComment
comment on: http://stackoverflow.com/a/25163791
type: Comment
has text: @Niru `I dont think its possible as there is no String return type for callFunction` .. Who told that no String return type ?
score: 0

http://stackoverflow.com/q/25214528
linked to: http://stackoverflow.com/q/16214300
tagged with: cordova-plugins
has comment: http://stackoverflow.com/comment/39276178
has body: I am using this phonegap plugin called Screenshot and I am willing to upload the base64 encoded image to facebook. Unfortunately, I get an error from facebook saying that the available formats are only JPG, PNG, GIF and TIFF. So I either have to find a way to change the java code of the plugin (I have never used java before) or come up with a javascript function in my application which converts it, although I don't really know if that is possible/worth it. Here is the java code of the screenshot plugin which encodes the image: else if (action.equals("getScreenshotAsURI")) { final Integer quality = (Integer) args.get(0); super.cordova.getActivity().runOnUiThread(new Runnable() {@Override public void run() { View view = webView.getRootView(); try { view.setDrawingCacheEnabled(true); Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache()); view.setDrawingCacheEnabled(false); ByteArrayOutputStream jpeg_data = new ByteArrayOutputStream(); if (bitmap.compress(CompressFormat.JPEG, quality, jpeg_data)) { byte[] code = jpeg_data.toByteArray(); byte[] output = Base64.encode(code, Base64.NO_WRAP); String js_out = new String(output); js_out = "data:image/jpeg;base64," + js_out; JSONObject jsonRes = new JSONObject(); jsonRes.put("URI", js_out); PluginResult result = new PluginResult(PluginResult.Status.OK, jsonRes); callbackContext.sendPluginResult(result); js_out = null; output = null; code = null; } jpeg_data = null; } catch (JSONException e) { callbackContext.error(e.getMessage()); } catch (Exception e) { callbackContext.error(e.getMessage()); } } }); return true; } The entire code of the plugin can be found on the github repository in the beginning of my question. I tried changing CompressForma.JPEG to CompressForma.JPG, but had no luck ;(
score: 0
has comment: http://stackoverflow.com/comment/39272219
tagged with: java
tagged with: base64
type: UnansweredQuestion
tagged with: image
has title: Convert base64 encode jpeg image to base64 encoded jpg/png/gif/tiff image?
answer count: 0
tagged with: javascript
type: Question

http://stackoverflow.com/comment/39208606
type: Comment
has text: @SilviuBurcea Declaring your interface inside your class as private static means that it is visible to the other methods. This is not the end of the world, but it is not what I want either.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25180446

http://stackoverflow.com/comment/39147695
has text: Apart from that: Why is it too late? No human being will notice the difference between a direct call and `Platform.runLater(...)` usually.
score: 0
comment on: http://stackoverflow.com/q/25146650
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39239518
has text: Thanks Artem.I find find our another method(setRecoveryInterval(time in mills)) of SimpleMessageListenerContainer doing the same stuff. By the way default is 5 sec even though you will not use this method, that's really nice.
comment on: http://stackoverflow.com/a/25180226
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41133678
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26195814
has text: Arie, thanks for that. the client APIs are certainly not bundled. I have tried to find out if the provider can do this, but no luck so far. Second option, I have explored using eclipse, and theoretically worked, but had many issues, if I package all 300 of the JARs, the performance is woeful (server connection time jumps from 8 seconds to 2.5 minutes while it unpacks the JAR). If I try to only package what I need, I continually run missing dependencies that are hard to track down. The creation of a separate program may be the answer.

http://stackoverflow.com/comment/39243640
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25199676
has text: Please put more effort into formatting your code in future. Use spaces instead of tabs, and edit until the preview looks how you'd want it to look if *you* were reading the question.
score: 0

http://stackoverflow.com/q/25093364
favorite count: 0
tagged with: netbeans-platform
linked to: http://stackoverflow.com/q/579109
downvote count: 1
accepted answer: http://stackoverflow.com/a/25578988
type: AnsweredQuestion
has body: I'm about to start a fairly big application for my company, and since it HAS to be cross platform, we're pointing towards Java (would have loved C#, but explored the Xamarin ecosystem and the Mac part seems to be quite behind the rest package...) Now, I'm evaluating both Netbeans 8 and Eclipse 4 as RCP. Before I continue I have to say that I've been maintaining for almost a year our previous software which was written in Netbeans Platform, but it has so many performance issues and so many bugs (some of which, it seems, tied to the platform itself -- i.e. plugins not updating with no apparen reason) that both me and my company kinda lost faith in Netbeans Platform, but on the other side I can't seem to figure out a good way to start digging in Eclipse RCP. Of course, mantaining that software means that I'm already experienced in Netbeans Platform, while I'm at "Hello World" level with Eclipse RCP. On top of that, I guess I'm going to use JavaFX 8, which I have to learn as well, since it seems it's the new de facto standard in Java GUI. Basically my software should handle a (local, SQLite or JavaDB or similar) database of customers, with various data to be sent via Ethernet to other devices. So, has anyone experiences with one or the other? And, if someone's into Eclipse, could gift me with some updated tutorials for Eclipse 4 RCP before I start buying books? Thanks anyone.
tagged with: java
upvote count: 10
type: Question
score: 9
has title: Eclipse RCP 4 vs NetBeans Platform 8 today: what to choose?
tagged with: eclipse-rcp
has answer: http://stackoverflow.com/a/25578988
has comment: http://stackoverflow.com/comment/39049852
has comment: http://stackoverflow.com/comment/39048612
answer count: 1

http://stackoverflow.com/comment/39254090
type: AnswerComment
comment on: http://stackoverflow.com/a/25205160
has text: Inner classes are very handy, as they can be listeners and have access to outer class.
type: Comment
score: 0

http://stackoverflow.com/q/25111700
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25112014
score: 1
tagged with: java
type: Question
has title: Where to look for to get the possible values of String constants used in Java class library
answer count: 1
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/25112014
has body: With reference to my earlier question Why does Java class library still use String constants in place of enum, can someone recommend an online information source to look for what all String constants are permitted for a Java Standard Class library method accepting a String constant? For example, what String values can MessageDigest.getInstance can take, other than "SHA" ? Similarly, what all properties can be fed into a Properties instance to create a valid SMTP/IMAP Session? Some of them are properties.setProperty("mail.imap.auth", "true"); properties.setProperty("mail.imap.host", mailHost); properties.setProperty("mail.imap.port", mailServerPort.toString()); properties.setProperty("mail.imap.starttls.enable","true"); properties.setProperty("mail.imap.starttls.enable","true"); properties.setProperty("mail.imap.ssl.enable","true"); Now create your Session as Session.getInstance(properties, authenticator);
favorite count: 0
tagged with: constants
linked to: http://stackoverflow.com/q/25110186

http://stackoverflow.com/a/25123834
upvote count: 2
has body: Try using ReloadableResourceBundleMessageSource instead of ResourceBundleMessageSource. It will look for the files under WEB-INF.
accepted answer of: http://stackoverflow.com/q/25121392
answers question: http://stackoverflow.com/q/25121392
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/39152590
score: 0
has text: you know Color class content a lot of attribute how i can said get just rgbt and but inside ColorPoint XML database
comment on: http://stackoverflow.com/q/25150305
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39091625
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25117818
has text: for that you need to share that code. without that we can not know what is there in activity and how it is being handled.

http://stackoverflow.com/a/25077942
has comment: http://stackoverflow.com/comment/39026577
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25077850
downvote count: 0
has comment: http://stackoverflow.com/comment/39016869
type: Answer
upvote count: 6
has body: Add (or change) the source element to plugin configuration: org.apache.maven.plugins maven-compiler-plugin 3.1 1.5 1.5
score: 6
answers question: http://stackoverflow.com/q/25077850

http://stackoverflow.com/comment/39332285
type: QuestionComment
has text: I forgot to mention that my multiple combox box is a "transfer type" selction, wherein you select multiple options from one box and I have a ">" button to transfer the selected values to another multiple combobox. The problem was the transferred values need to be highlighted before submission. It was just not natural from a user's POV having to need to highlight his selection again after transferring, so I just added a script to automatically do that when submitting the form.
comment on: http://stackoverflow.com/q/25191547
score: 0
type: Comment

http://stackoverflow.com/a/25183361
upvote count: 2
has comment: http://stackoverflow.com/comment/39214283
answers question: http://stackoverflow.com/q/25182986
has comment: http://stackoverflow.com/comment/39213882
downvote count: 0
type: Answer
has body: You're requesting "tackingBean" don't you need "trackingBean" ?
score: 2

http://stackoverflow.com/a/25217719
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/39278017
has comment: http://stackoverflow.com/comment/39278030
downvote count: 1
score: 5
answers question: http://stackoverflow.com/q/25217686
has comment: http://stackoverflow.com/comment/39278090
has body: You may try like this: new File("Storage/Test").mkdirs(); The mkdirs() Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories. Note that if this operation fails it may have succeeded in creating some of the necessary parent directories.

http://stackoverflow.com/a/25217581
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: Add Intent.FLAG_ACTIVITY_NEW_TASK to the Intent you're using to start the Activity, e.g., Intent intent = new Intent(context, AbhanActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);
accepted answer of: http://stackoverflow.com/q/25215378
answers question: http://stackoverflow.com/q/25215378

http://stackoverflow.com/comment/39282547
type: AnswerComment
comment on: http://stackoverflow.com/a/25220164
score: 0
type: Comment
has text: Regarding...1.) Checksum - How to add a checksum to image or a video. I am a beginner so I don't know. 2.) Actually I have added padding in updated code...this was an old one. 3.) PKI...I don't know much about it.

http://stackoverflow.com/comment/39293941
score: 1
type: Comment
type: QuestionComment
has text: Which line is MainNewsActivity.java:539
comment on: http://stackoverflow.com/q/25226336

http://stackoverflow.com/q/25179159
type: Question
upvote count: 1
answer count: 1
favorite count: 0
tagged with: rest
has title: JBoss REST URL not working
has body: I am deploying a WAR file (vimbaserver-1.0.war) to my JBoss web server with the following web.xml: <?xml version="1.0" encoding="UTF-8"?> vimbaserver vimbaserver org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher javax.ws.rs.Application com.vimba.main.ServerStart 1 vimbaserver /rest/* The WAR contains two REST functions that I want to test: @GET @Path("/getWord/{word}") @Produces(MediaType.TEXT_PLAIN) public String getWord(@PathParam("word") String word) { return "hello world " + " " + word; } @GET @Path("/register/{userid}/{email}/{password}/{displayname}/{genderpref}/{hot}/{not}") @Produces(MediaType.TEXT_PLAIN) public String register(@PathParam("userid") String userid, @PathParam("email") String email, @PathParam("password") String password, @PathParam("displayname") String displayname, @PathParam("genderpref") GenderPreference gender, @PathParam("hot") int hot, @PathParam("not") int not) { if (userid == null || email == null || password == null || displayname == null || gender == null) { throw new IllegalArgumentException( "Required fields are null when registering"); } try{ RegistrationStatus status = factory.register(userid, email, password,displayname, gender.getValue(), hot, not); if(status == RegistrationStatus.SUCCESSFUL){ MailSender.generateSignUpEmail(userid, email, password); } return status.getValue(); } catch(MajorMinorException e){ logger.error("An error occurred whilst trying to register user: ",e); } return RegistrationStatus.FAILED.getValue(); } From the above, we would have expected the following REST URL to work: http://xx.xx.xx.xx:8080/vimbaserver-1.0/functions/getWord/test. However, this doesn't seem to be the case. What is strange is that we have another application deployed to our server that exposes a number of REST functions that appear to be working fine.
downvote count: 0
accepted answer: http://stackoverflow.com/a/25179218
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: jboss
has answer: http://stackoverflow.com/a/25179218

http://stackoverflow.com/q/25186275
has comment: http://stackoverflow.com/comment/39333562
tagged with: frame
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/39559003
has title: awt frame and color dispose - how
score: 1
tagged with: java
tagged with: dispose
type: Question
has body: What is the correct way to dispose a frame and colors? I have an awt frame that is being created on a composite. I have listener for when the parent is closed it should call dispose() method. This method makes the frame close. public void dispose() { if (frame != null) { // frame.dispose() frame = null; } } However, if I uncomment frame.dispose() the frame never closes. Is calling dispose needed? Also, for colors - is it okay to just set them as null?
downvote count: 0
tagged with: awt
tagged with: colors

http://stackoverflow.com/comment/39312844
type: QuestionComment
score: 0
has text: I would like to see an example wherein the intermediary table (class_teacher) is being mapped
comment on: http://stackoverflow.com/q/25196967
type: Comment

http://stackoverflow.com/comment/39010147
type: QuestionComment
comment on: http://stackoverflow.com/q/25074313
score: 0
has text: String s[] = input.split('_'); like this then SimpleDateFormat parse and format methods
type: Comment

http://stackoverflow.com/comment/39268882
comment on: http://stackoverflow.com/q/25212946
score: 0
has text: Note that this is likely to blow up if you modify either of the contained sets, since that will affect the equality check performed by the containing set.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25218992
score: 2
has body: SVN also can fullfill your needs. If you are using eclipse just incorporate SVN URL. You will get easy options to create branchs there
upvote count: 2
answers question: http://stackoverflow.com/q/25218694
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25218694
type: Answer

http://stackoverflow.com/comment/39123755
type: QuestionComment
comment on: http://stackoverflow.com/q/25134614
score: 0
has text: You code has nothing to do with Swing, take a look at [How to use Swing Timers](http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html) for more details
type: Comment

http://stackoverflow.com/a/59981704
type: Answer
has body: I folowed a Jira tutorial (https://developer.atlassian.com/server/jira/platform/oauth/) for OAuth. In my case, I used dto to json transformation with GSON lib, however I couldn't make it work. I'll provide source later, but for fast resolve, please see : https://stackoverflow.com/a/59981597/1551368
score: 0
answers question: http://stackoverflow.com/q/25192342

http://stackoverflow.com/q/25150370
has answer: http://stackoverflow.com/a/25150401
tagged with: java
tagged with: eclipse
type: Question
has body: I have seen a lot of people asking similar questions here but none of their solutions work for me. I am trying to create a REST service through eclipse and tomcat but I keep getting a 404 page. My Java Class: package com.audiencescience.rtbtools.requestvalidator.servlet; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @Path("/bidChecker") public class BidCheckerRESTService { @GET @Produces(MediaType.TEXT_HTML) public Response testGet() { return Response.status(200).entity(" Hello world ").build(); } } This is my web.xml: Restful Web Application jersey-serlvet com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages com.audiencescience.rtbtools.requestvalidator.servlet 1 jersey-serlvet /rest/* The URL: http://localhost:8080/BidCheckerWebService/bidchecker returns a 404. I am using jersey-bundle 1.18
has answer: http://stackoverflow.com/a/25152258
tagged with: tomcat
has answer: http://stackoverflow.com/a/25150405
score: 0
answer count: 3
has title: Java RESTfull web service with tomcat and eclipse gives 404
tagged with: rest
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39158058

http://stackoverflow.com/comment/39269822
has text: Ok, I am passing that intent. Can you explain why the ytstuff ArrayList is not being populated. I'm going to edit OP with the SearchYoutube class.
comment on: http://stackoverflow.com/a/25213483
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25225859
tagged with: java
has comment: http://stackoverflow.com/comment/39292619
has body: I my android app, i change the wallpaer/desktop image. How do i get the size of screen of the phone? Note :I donot need the size of current activity but the screen. Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth() int height = display.getHeight() Does the above code return the size of screen or current activity?Also display.getHeight() and display.getWidth methods are depreciated.
type: Question
accepted answer: http://stackoverflow.com/a/25225887
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/14999427
linked to: http://stackoverflow.com/q/4743116
tagged with: android
has answer: http://stackoverflow.com/a/25225887
type: AnsweredQuestion
has title: Get phone screen size using windowmanager

http://stackoverflow.com/q/25093821
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/66703202
has title: Is it 2 character search possible in lucence
tagged with: search-engine
upvote count: 0
tagged with: java
type: Question
tagged with: algorithm
downvote count: 6
tagged with: lucene
has body: Hi i have a question about lucence search Is it possible to search a 2 character from file using lucence search For ex. if there are names like "karthik test" is it possible to search for "ka" or "te" in lucence. If so kindly provide a code piece..
answer count: 2
tagged with: full-text-search
has answer: http://stackoverflow.com/a/25093945
score: -6
favorite count: 0

datetimepicker
type: Tag
tags question: http://stackoverflow.com/q/25210024
tag name: datetimepicker

http://stackoverflow.com/comment/39035538
score: 0
type: Comment
has text: There are many ways to solve this problem. InnerClass can hold an instance of OuterClass and can access non-static members of OuterClass via this instance.
comment on: http://stackoverflow.com/a/25087472
type: AnswerComment

http://stackoverflow.com/a/25210606
answers question: http://stackoverflow.com/q/25210174
has comment: http://stackoverflow.com/comment/39265616
type: Answer
has body: for declaring URLs which are "open" there is a typo in your XML, permitAll is given as &lt;security:intercept-url pattern="/auth/login" access='permitAll()' /&gt; notice the ()
score: 0

http://stackoverflow.com/q/25213528
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25213577
has title: Return in Catch Statement
has body: At the following program, in case I remove the return statement from: catch(FileNotFoundException e) { System.out.println("File Not Found"); return; It shows me an error inside the do while loop, that the local variable fin might not have been initialized. Can someone explain me why is this happening? import java.io.*; class Stock { public static void main(String args[]) throws IOException { int i; FileInputStream fin; try { fin = new FileInputStream(args[0]); } catch(FileNotFoundException e) { System.out.println("File Not Found"); return; } // read characters until EOF is encountered do { i = fin.read(); if(i != -1) System.out.print((char) i); } while(i != -1); fin.close(); } }
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39269905
upvote count: 1
has comment: http://stackoverflow.com/comment/39269940
type: Question
tagged with: try-catch
has answer: http://stackoverflow.com/a/25213562
has answer: http://stackoverflow.com/a/25213575
has answer: http://stackoverflow.com/a/25213578
has answer: http://stackoverflow.com/a/25213549
downvote count: 0
favorite count: 0
tagged with: return
has comment: http://stackoverflow.com/comment/39270033

http://stackoverflow.com/a/25199626
has body: This can be caused by different library versions, do you have changed the build path in Eclipse? (Project->Properties->Build Path -> Libraries). There should only be "JRE System Library". If there is more, then it is possible that it is be loaded instead of one of your Maven dependencies. You using "mvn clean install" means it is compiled against the Maven dependencies and thus it runs differently.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25199279

http://stackoverflow.com/q/25173587
accepted answer: http://stackoverflow.com/a/25173777
tagged with: layout
answer count: 1
score: 0
tagged with: android
has body: Anyone please help me to place admob code but without xml layout. The ads is not show. Thank you. This is the code: When build, the ads is not show, but build is success. public class MainActivity extends Activity { // MainView activity MainView view; public static final String WIDTH = "width"; public static final String HEIGHT = "height"; public static final String SCORE = "score"; public static final String HIGH_SCORE = "high score temp"; public static final String UNDO_SCORE = "undo score"; public static final String CAN_UNDO = "can undo"; public static final String UNDO_GRID = "undo"; public static final String GAME_STATE = "game state"; public static final String UNDO_GAME_STATE = "undo game state"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); view = new MainView(getBaseContext()); SharedPreferences settings = PreferenceManager .getDefaultSharedPreferences(this); view.hasSaveState = settings.getBoolean("save_state", false); if (savedInstanceState != null) { if (savedInstanceState.getBoolean("hasState")) { load(); } } // adview code AdView adView = new AdView(this); adView.setAdUnitId("ca-app-pub-xxxxxxxxxxxx/xxxxxxxx"); adView.setAdSize(AdSize.BANNER); // ads parameter LayoutParams params1 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params1.addRule(RelativeLayout.ALIGN_PARENT_TOP); adView.setLayoutParams(params1); RelativeLayout layout = new RelativeLayout(this); // layout list layout.addView(view); layout.addView(adView); setContentView(layout); // ads request AdRequest request = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .build(); }
has title: How to place admob code without xml layout
has answer: http://stackoverflow.com/a/25173777
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: admob

http://stackoverflow.com/comment/39701723
score: 0
type: Comment
type: QuestionComment
has text: In your example `PersonRepository` has no `findByFirstName` method. I guess you want it to extend the `PersonRepositoryCustom` interface.
comment on: http://stackoverflow.com/q/25201306

http://stackoverflow.com/comment/39282946
type: QuestionComment
comment on: http://stackoverflow.com/q/25220236
has text: use an array then if (count >= arr.length) count = 0
score: 0
type: Comment

http://stackoverflow.com/q/25164227
has body: I am running an ant build file through a Java class with the help of following code: p.setUserProperty("ant.file", buildFile.getAbsolutePath()); p.init(); ProjectHelper helper = ProjectHelper.getProjectHelper(); p.addReference("ant.projectHelper", helper); helper.parse(p, buildFile); p.executeTarget(p.getDefaultTarget()); When I deploy a WAR file and call the same class I get the following error: org.apache.cxf.interceptor.Fault: org/apache/tools/ant/BuildListener at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractIn voker.java:170) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker .java:136) at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204) at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101) at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInv okerInterceptor.java:58) at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(Se rviceInvokerInterceptor.java:94) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept orChain.java:272) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainIniti ationObserver.java:121) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(Abstract HTTPDestination.java:241) at org.apache.cxf.transport.servlet.ServletController.invokeDestination( ServletController.java:248) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletCont roller.java:222) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletCont roller.java:153) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpr ingServlet.java:171) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(Ab stractHTTPServlet.java:286) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHT TPServlet.java:211) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(Abstract HTTPServlet.java:262) at or…
answer count: 0
has title: Gettting error while running build.xml through java class deployed in Tomcat server
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: ant
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/39660496

http://stackoverflow.com/comment/39223386
type: AnswerComment
has text: @Ardel The method doesn't have to be static. But if it's not static, you'll have to create an instance of StaticMap before calling the method - `StaticMap map = new StaticMap(); map.DisplayMap(...);`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25188530

http://stackoverflow.com/a/25111686
has comment: http://stackoverflow.com/comment/39080262
score: 2
has comment: http://stackoverflow.com/comment/39080303
has body: You reinitialize i to 0 and then through loop to colors.length every time in actionPerformed, so you get the last item. Use sth like that instead: public class Four extends JFrame implements ActionListener { private final int SIZE = 180; Color colors[] = {Color.RED, Color.ORANGE, Color.YELLOW, Color.GREEN, Color.BLUE, Color.CYAN}; int i = 0; private Container con = getContentPane(); private JButton button = new JButton("Press Me"); public Four() { super("Frame"); setSize(SIZE, SIZE); con.setLayout(new FlowLayout()); con.add(button); button.addActionListener(this); } public void actionPerformed(ActionEvent event) { con.setBackground(colors[i++ % colors.length]); } public static void main(String[] args) { Four frame = new Four(); frame.setVisible(true); frame.setLocationRelativeTo(null); } }
has comment: http://stackoverflow.com/comment/39080213
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25111632
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25111632

http://stackoverflow.com/a/25165281
has comment: http://stackoverflow.com/comment/39261745
has body: OK, so I figured out the problem by painfully running through EclipseLink's code in my debugger. I happened to notice that when it was trying to assign the inheritance in org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor, it wasn't finding the superclass LabelTypeDefinition. This was not a problem for Hibernate, so it didn't occur to me that the abstract base class also had to be included in persistence.xml, ie. ... com.[MYPROJECT].persistence.labeltype.LabelNodeDefinition com.[MYPROJECT].persistence.labeltype.LabelTreeDefinition com.[MYPROJECT].persistence.labeltype.LabelScenarioDefinition com.[MYPROJECT].persistence.labeltype.LabelTypeDefinition ... However, when I ran it through a second time I discovered it still could not find the class. As a Hail Mary, I replaced @MappedSuperclass with @Entity in my parent class and it all worked. Now the first part of the fix was a little bit of a headslapper, ie. I should have thought of the possibility EclipseLink required more explicit configuration than Hibernate. However the second strikes me as a bug, particularly since I've found documentation in numerous places (including the eclipse wiki link I posted above) that suggests it should work. And because semantically it seems more correct: my abstract base class is not, in fact, an "entity" in that no LabelType objects ever get persisted as such. But it is a superclass that's "mapped" by my entities.
has comment: http://stackoverflow.com/comment/39180222
has comment: http://stackoverflow.com/comment/39266110
answers question: http://stackoverflow.com/q/25142607
has comment: http://stackoverflow.com/comment/39266083
has comment: http://stackoverflow.com/comment/39261871
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/39181903
score: 0
type: AnswerComment
type: Comment
has text: prop.load(this.getClass().getResourceAsStream("DBConfig.properties")); this.getClass() gives an error, The method I have used is static. I have written that method in Servlet. input = DBConfig.class.getClassLoader().getResourceAsStream(filename); returns null. Plz guide...
comment on: http://stackoverflow.com/a/25160631

http://stackoverflow.com/comment/39144614
type: AnswerComment
has text: @Zhuinden, my comment wasn't directed @ you; I was pointing out what I believe to be true; you have the freedom to post what you like under the rules. It's not about being stingy, it's about drawing a line between teaching/guiding and hindering one's development, but more over the last sentence is an obvious logical fallacy.
type: Comment
comment on: http://stackoverflow.com/a/25145393
score: 1

http://stackoverflow.com/q/25138414
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25138731
has title: Using equals() after serialization
has answer: http://stackoverflow.com/a/25138575
type: Question
has answer: http://stackoverflow.com/a/25138686
accepted answer: http://stackoverflow.com/a/25138686
has body: I have the following method to convert a file (containing a serialized object) back into an object: public static &lt;T, C extends Class&lt;T&gt;&gt; T readSerializableObjectFromFile(final Path path, final C clazz) { Objects.requireNonNull(path, "path"); Objects.requireNonNull(clazz, "clazz"); try (ObjectInputStream objectInputStream = new ObjectInputStream(Files.newInputStream(path))) { return clazz.cast(objectInputStream.readObject()); } catch (IOException ex) { throw new UncheckedIOException(ex); } catch (ClassNotFoundException ex) { throw new RuntimeException(ex); } } Say I have an object of type Organization, which has equals and hashCode methods, written in a file, what happens when I call the following? Organization organization = readSerializableObjectFromFile(myFile, Organization.class); Does organization.hashCode() use the Object#hashCode or Organization#hashCode implementation? And does the behaviour change when I store a List&lt;Organization&gt; in the file, and then retrieve it via @SuppressWarnings("unchecked") List&lt;Organization&gt; organizations = readSerializableObjectFromFile(myFile, List.class)
has comment: http://stackoverflow.com/comment/39129704
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/39129763
possible better answer: http://stackoverflow.com/a/25138731
has comment: http://stackoverflow.com/comment/39129804
has comment: http://stackoverflow.com/comment/39129837
tagged with: serialization
tagged with: equals

http://stackoverflow.com/comment/39213478
type: AnswerComment
comment on: http://stackoverflow.com/a/25182674
has text: Okay, then my answer is no solution.
score: 0
type: Comment

concurrency
tags question: http://stackoverflow.com/q/25079093
tag name: concurrency
tags question: http://stackoverflow.com/q/25130820
tags question: http://stackoverflow.com/q/25207613
tags question: http://stackoverflow.com/q/25228029
tags question: http://stackoverflow.com/q/25168062
tags question: http://stackoverflow.com/q/25177460
tags question: http://stackoverflow.com/q/25094568
tags question: http://stackoverflow.com/q/25212803
tags question: http://stackoverflow.com/q/25146650
tags question: http://stackoverflow.com/q/25086574
tags question: http://stackoverflow.com/q/25095487
tags question: http://stackoverflow.com/q/25098138
tags question: http://stackoverflow.com/q/25169635
tags question: http://stackoverflow.com/q/25084453
tags question: http://stackoverflow.com/q/25078754
tags question: http://stackoverflow.com/q/25190073
tags question: http://stackoverflow.com/q/25142526
tags question: http://stackoverflow.com/q/25096319
type: Tag
tags question: http://stackoverflow.com/q/25174257
tags question: http://stackoverflow.com/q/25224323
tags question: http://stackoverflow.com/q/25173208
tags question: http://stackoverflow.com/q/25191804

http://stackoverflow.com/a/25079445
has comment: http://stackoverflow.com/comment/39024856
answers question: http://stackoverflow.com/q/25079093
has comment: http://stackoverflow.com/comment/39065344
score: 0
type: Answer
has body: What about wrapping your HashMap into a class where you put some kind of boolean isLocked Assume you want to start the reading process from a thread, you can just check for this lock if(!myClass.getLockState()) { //perform whatever you want to do } If you make sure all threads work with the same myClass object this could be a simple solution for locking/unlocking your hashMap.

http://stackoverflow.com/a/25150775
has comment: http://stackoverflow.com/comment/39153343
has comment: http://stackoverflow.com/comment/39154272
has comment: http://stackoverflow.com/comment/39153248
has comment: http://stackoverflow.com/comment/39153439
has comment: http://stackoverflow.com/comment/39153276
has comment: http://stackoverflow.com/comment/39153115
type: Answer
has body: I'm fairly certain that java does use Taylor Series to find trigonometric values. I would imagine the functions/methods would be fairly easy to implement using modulus to move the amount degrees and radians into their respective trigonometric domains. All the rest is just Taylor Series accurate to a certain decimal point. @Gavrilo, here's some Python 2.7 code I wrote really quick to simulate a Taylor Series sin(x) function: from math import factorial as f from math import sin from math import pi def taylorSin(n, d): # calculates sin(n) using a taylor- # polynomial of degree d # implement some sort of modulus to shift n in- # to the domain of [0, 2*pi] or [-pi, pi] return helper(n, d, 0) def helper(n, d, x): # helper function for taylorSin(n, d) if d &lt; 1: return x else: if d % 4 == 1: return helper(n, d - 2, x + float(n**d)/f(d)) elif d % 4 == 3: return helper(n, d - 2, x + -1*float(n**d)/f(d)) print 'Something screwed up' return None testval = 2.13 print 'taylorSin',taylorSin(testval, 25) print 'sin',sin(testval) The output: taylorSin 0.847677840134 sin 0.847677840134
answers question: http://stackoverflow.com/q/25150660
score: 2
has comment: http://stackoverflow.com/comment/39153634
downvote count: 0
has comment: http://stackoverflow.com/comment/39153814
has comment: http://stackoverflow.com/comment/39154047
has comment: http://stackoverflow.com/comment/39154031
has comment: http://stackoverflow.com/comment/39154174
has comment: http://stackoverflow.com/comment/39154111
has comment: http://stackoverflow.com/comment/39153939
upvote count: 2
has comment: http://stackoverflow.com/comment/39153219
has comment: http://stackoverflow.com/comment/39153175
has comment: http://stackoverflow.com/comment/39153658

http://stackoverflow.com/q/25174440
type: Question
downvote count: 0
tagged with: aop
has comment: http://stackoverflow.com/comment/39197238
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/39197101
score: 2
has answer: http://stackoverflow.com/a/25174722
has body: At present I have a Spring MVC web application, which uses ServletFilter to filter each HTTP request and check whether the user has really purchased the licence by checking and validating the licence file content. I have mapped the filter in both spring xml file as well as web.xml appropriately. As I have access to HttpServletRequest and HttpServletResponse in the filter, I am able to redirect the user to error page if the validation fails. So, now as the title suggests is it possible to do the same thing using Spring AOP? How can Spring AOP be configured to get access to the request and response objects created by the container to redirect the user?
upvote count: 2
has comment: http://stackoverflow.com/comment/39197046
tagged with: spring
has answer: http://stackoverflow.com/a/25181608
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/25174674
has comment: http://stackoverflow.com/comment/39197151
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25181608
accepted answer: http://stackoverflow.com/a/25174722
has title: Is it possible to use AOP for web app licence validation?

http://stackoverflow.com/a/27150948
has body: default should not contain the id of the object you want to reference, but an object with the same id than the object you want to reference. Try to replace : organizationsType.setDefault("CYBER4.ORG"); with : OrganizationType o = new OrganizationType() o.setIdentifier("CYBER4.ORG"); organizationsType.setDefault(o); If organizationType has already been set you can maybe also try : organizationsType.setDefault(organizationType);
accepted answer of: http://stackoverflow.com/q/25224987
has comment: http://stackoverflow.com/comment/133044397
score: 12
answers question: http://stackoverflow.com/q/25224987
upvote count: 12
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39089657
score: 0
type: Comment
has text: Thanks @Michael, your link lead me to the solution. In particular, I had to change my surefire plugin configuration to include this line: ` -Dspring.profiles.active=${spring.profiles.active} ` into the `configuration` section, as pointed by [this answer](http://stackoverflow.com/a/7579853/795158) for the thread you've linked. In my settings, `${spring.profiles.active}` is a property defined by my maven build profile, representing the associated with it spring profile.
type: AnswerComment
comment on: http://stackoverflow.com/a/25116589

socket.io
tags question: http://stackoverflow.com/q/25221510
type: Tag
tag name: socket.io

http://stackoverflow.com/comment/39170663
type: AnswerComment
has text: @MrHeelis - I am not sure, what are you asking about. You can have namespace independent on the folder it is in, but why the hell you would ever want that? :D
type: Comment
comment on: http://stackoverflow.com/a/25160621
score: 0

http://stackoverflow.com/q/25075014
downvote count: 4
linked to: http://stackoverflow.com/q/513832
answer count: 3
has answer: http://stackoverflow.com/a/25075047
duplicate of: http://stackoverflow.com/q/1552301
has body: In java String is a class and it is imutable so we can not change its value.In following code it will concate other string without any error.So I want to ask that if it is immutable then why in this following code value of String is changed?? import java.util.*; public class conc { public static void main(String args[]) { String a="Sheetal"; a=a+"Ga"; System.out.println("Result:"+a); } }
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
accepted answer: http://stackoverflow.com/a/25075047
has title: String class in java
has comment: http://stackoverflow.com/comment/39011317
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39011326
tagged with: java
possible better answer: http://stackoverflow.com/a/25075052
has answer: http://stackoverflow.com/a/25075052
has comment: http://stackoverflow.com/comment/39011589
type: Question
has answer: http://stackoverflow.com/a/25075045
has comment: http://stackoverflow.com/comment/39012303
upvote count: 4
linked to: http://stackoverflow.com/q/1552301

http://stackoverflow.com/q/25081668
has comment: http://stackoverflow.com/comment/39024267
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/39023968
type: Question
linked to: http://stackoverflow.com/q/10892276
has body: I'm attempting to replace all instances of a particular String with a unique replacement. What I would like: If I have this String: String testScript = "while(true) { } while (10 &lt; 7) { } while((10 &lt; 7)) { }"; I would like this output: while(arg0 &lt; 5000 &amp;&amp; true) { } while(arg1 &lt; 5000 &amp;&amp; 10 &lt; 7) { } while(arg2 &lt; 5000 &amp;&amp; (10 &lt; 7)) { } What I have: However, the string passed in to replaceAll doesn't get queried again (obvious now I think about it). while(arg0 &lt; 5000 &amp;&amp; true) { } while(arg0 &lt; 5000 &amp;&amp; 10 &lt; 7) { } while(arg0 &lt; 5000 &amp;&amp; (10 &lt; 7)){ } Any answers or comments, as always, are greatly appreciated. SSCCE: public static void main(String[] args) { int counter = 0; String testScript = "while(true) { } while (10 &lt; 7) { } while((10 &lt; 7)) { }"; String out = testScript.replaceAll("while\\s*\\(", "while(arg" + (counter++) + " &lt; 5000 &amp;&amp; "); System.out.println(out); }
has answer: http://stackoverflow.com/a/25081783
answer count: 1
downvote count: 0
has title: Replace all instances in string with unique replacement
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/39024088
has comment: http://stackoverflow.com/comment/39024033
accepted answer: http://stackoverflow.com/a/25081783
tagged with: regex

http://stackoverflow.com/comment/39108010
type: QuestionComment
has text: Oh it is realtime. I should have mention that :)
score: 0
comment on: http://stackoverflow.com/q/25122753
type: Comment

http://stackoverflow.com/q/25198367
upvote count: 0
has comment: http://stackoverflow.com/comment/39241383
accepted answer: http://stackoverflow.com/a/25198825
has comment: http://stackoverflow.com/comment/39241911
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/39241471
has comment: http://stackoverflow.com/comment/39241586
type: Question
has title: How can i display all column of a database table using servlet and jsp
score: -1
has comment: http://stackoverflow.com/comment/39241352
possible better answer: http://stackoverflow.com/a/25198824
answer count: 2
has answer: http://stackoverflow.com/a/25198824
downvote count: 1
has body: I have a database table users containing columns id(int),name(string),department(string),password(string).I am storing table contents in an arrayList object in a servlet (display.java) and then forwarding it to a jsp page(home1.jsp). But i am unable to display all tables using that jsp page.Id contents is not showing and the columns of table has been shifted 1 unit right. i.e not under correct header. @WebServlet("/Display3") public class Display3 extends HttpServlet { private static final long serialVersionUID = 1L; public Display3() { super(); // TODO Auto-generated constructor stub } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); Connection conn = null; Statement st; try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection ("jdbc:mysql://localhost:3306/test?user=root&password=Tpg@1234"); ArrayList al=null; ArrayList userList =new ArrayList(); String query = "select id,name,department,password from users"; st = conn.createStatement(); ResultSet rs = st.executeQuery(query); while(rs.next()) { al = new ArrayList(); al.add(rs.getInt(1)); al.add(rs.getString(2)); al.add(rs.getString(3)); al.add(rs.getString(4)); userList.add(al); } request.setAttribute("userList",userList); RequestDispatcher dispatcher = getServletContext() .getRequestDispatcher("/home1.jsp"); dispatcher.forward(request,response); conn.close(); } catch (Exception e) { e.printStackTrace(); } } } the jsp code is here <%@ page language="java" contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"%> <%@ page import="java.util.*;" %> Insert title here Id Name Department Edit Delete <% List Li = new ArrayList(); Iterator lr; if(request.getAttribute("userList")!=null && request.g…
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/25198825
tagged with: servlets
has comment: http://stackoverflow.com/comment/39241816
type: AnsweredQuestion

http://stackoverflow.com/comment/39149622
comment on: http://stackoverflow.com/q/25147565
type: Comment
has text: @EJP A good idea, but the computations that I only want to do once are the edge connections between vertices, since those take by far the longest time for what I'm doing.
score: 0
type: QuestionComment

http://stackoverflow.com/a/25097071
score: 3
has comment: http://stackoverflow.com/comment/39054048
has body: The "standard" layout in a Maven web app is: src/ main/ java/ resources/ webapp/ WEB-INF/ test/ java/ resources/ Your screenshots indicate that your setup is a little different, that's why IntelliJ may be confused and acts strangely. I suggest you create your Maven project using a predefined archetype, then import it in IntelliJ (using File -&gt; Open and selecting the root pom.xml). I've never had any problems using the standard Maven layout. Furthermore, it follows Maven's convention over configuration and it will be easier to understand for those who are used to standard Maven projects.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25096718
answers question: http://stackoverflow.com/q/25096718
has comment: http://stackoverflow.com/comment/39122227
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/63305458
has text: @dazito It depends on a lot which certificate are you talking about. Let's assume that you are talking about MDM client certificate. The private key will be used to authenticate to the server (either while TLS tunnel negotiation or by signing all MDM messages sent from a client to MDM server).
comment on: http://stackoverflow.com/a/25084605
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/25091024
upvote count: 2
has body: You can't have print statements outside of a method. In class A System.out.println("temp = " + temp); System.out.println("sum = " + sum); System.out.println("y = " + y); need to be moved into a method. In class B System.out.println("sum = " + sum); needs to be moved into a method. If you want to see what the default values of these variables are, just put these print statements first thing in your constructors like so public A(int x){ System.out.println("temp = " + temp); System.out.println("sum = " + sum); System.out.println("y = " + y); y = temp - 2 + x; System.out.println("y = " + y); sum = temp + 3; System.out.println("sum = " + sum); temp -= 2; //System.out.println("temp = " + temp); }
answers question: http://stackoverflow.com/q/25090999
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/39278615
has text: This is a FXML scene using Java JavaFX 2. The question is about the ImageView JavaFX control, not the Image object. The image object is perfectly "_fine_". Even if it worked (and it doesn't) isError would not tell me IF something displayed, hidden or had been clipped, scroll/overflow or chopped.
comment on: http://stackoverflow.com/q/25151939
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25211253
linked to: http://stackoverflow.com/q/16667557
tagged with: windows
has title: How to use Java Native Access to set process affinity for processes besides Java.exe?
favorite count: 0
has body: Although it is fairly easy to do manually, I am attempting to automate the setting of cpu affinity in Windows 7 for various VMs after their initial creation time. The project is in Java and I am trying to avoid directly including C code, so I have been using Java Native Access, which masks things like winapi. I'm new to the library, and it's a bit lacking in tutorials or examples, although there are some basic ones findable through quick Google searches. Using the following code, I can set the affinity of the main Java process (ffffffffffffffff locally), but other processes remain completely unaffected, even when I have the privileges to manually set affinity using Task Manager. I have also iterated over all integers from 0 to 10000, rather than just entering ids I know to be valid. Main class: import com.sun.jna.Native; import com.sun.jna.Pointer; import com.sun.jna.platform.win32.WinNT.HANDLE; public class SetAffinity { public static void main(String[] args){ int pid = -1; AffinityKernel instance = (AffinityKernel)Native.loadLibrary("Kernel32",AffinityKernel.class)); System.out.println(instance.SetProcessAffinityMask(new HANDLE(new Pointer(pid)), 1)); } } Utility interface: import com.sun.jna.platform.win32.Kernel32; import com.sun.jna.platform.win32.WinNT.HANDLE; public interface AffinityKernel extends Kernel32{ public boolean SetProcessAffinityMask(HANDLE hProcess, int dwProcessAffinityMask); } Since I can check that it correctly sets the cpu affinity of the process it's running in, I know the syntax is correct. The question is: How do I access/reference processes besides the current process?
tagged with: affinity
has answer: http://stackoverflow.com/a/25211592
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25211592
tagged with: java
type: Question
upvote count: 4
answer count: 1
downvote count: 0
score: 4
tagged with: jna

http://stackoverflow.com/a/25208595
has comment: http://stackoverflow.com/comment/39260749
score: 1
has comment: http://stackoverflow.com/comment/39260636
has comment: http://stackoverflow.com/comment/39260970
upvote count: 1
has body: You could try the same in C# like below: public abstract class Module&lt;T&gt; where T : BasicData { }
answers question: http://stackoverflow.com/q/25208559
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39067821
score: 0
comment on: http://stackoverflow.com/q/25104784
type: QuestionComment
has text: There's no need to add the data @Pat; as the problem is the data the only answer anyone is going to be able to give the OP is to point out the '36' (or whatever it is) is not a month.., which isn't very useful for anyone in the future.
type: Comment

pixel
tags question: http://stackoverflow.com/q/25126971
type: Tag
tag name: pixel

http://stackoverflow.com/comment/128114558
score: 1
comment on: http://stackoverflow.com/a/25167555
type: AnswerComment
type: Comment
has text: This doesn't show how to return a model and view, it only returns a string.

http://stackoverflow.com/q/25129245
score: 1
tagged with: java
has body: I need to implement a table where each row has editable information that the user expects to submit as a whole yet buttons on each row to delete that row immediately. Because I care about the form as a whole and forms cannot be nested, the action receiving the button press probably has to handle it as an indexed property so that's the way I built it. What I am currently doing is indexing via a Long. My JSP renders the following HTML: While in my action class I am exposing and using the property like so: private Map<Long, String> removeButtons = new HashMap<Long, String>(); public Map<Long, String> getRemoveButtons() { return removeButtons; } // Later when the action is called for(Long button : removeButtons.keySet()) { // this only ever returns nothing or the one button that was pressed } This works perfectly fine for numerical indices. I now need to do this again for a different table, but the rows are indexed with a String. Converting Long to String, putting or not putting quotes inside the square brackets, changing the square brackets to parentheses... Nothing seems to work. I already know how to make it work with numbered indices and I'm capable of implementing it by adding a numerical index value to each row, however, I'd like to know how to make this work with a String key for the Map. Alternately, is there a better way to achieve what I'm trying to do (arbitrarily many buttons on a single form)?
has title: How to handle indexed-property buttons on a form in Struts 2
type: Question
tagged with: ognl
has answer: http://stackoverflow.com/a/25146048
has comment: http://stackoverflow.com/comment/39141658
accepted answer: http://stackoverflow.com/a/25135691
tagged with: struts2
answer count: 2
upvote count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/25135691
favorite count: 0
has comment: http://stackoverflow.com/comment/39120262
possible better answer: http://stackoverflow.com/a/25146048
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39146956
downvote count: 0
linked to: http://stackoverflow.com/q/21282400

http://stackoverflow.com/a/25126410
type: Answer
answers question: http://stackoverflow.com/q/25126340
score: 1
upvote count: 1
has body: As far as the space efficiency goes, on the surface, the first one is slightly more space-efficient, because the second way requires an extra local variable intNum at each level of invocation. However, since the assignment of intNum happens right before the return, Java compilers are free to optimize it out entirely: your code is equivalent to this: if (s.length()==1){ return Character.getNumericValue(s.charAt(0)); }else{ return (int) (Math.pow(10,s.length()-1)*Character.getNumericValue(s.charAt(0)))+StringToInteger(s.substring(1)); } Generally, though, one should be very careful using any state outside the recursive method itself, including instance variables, because reliance on keeping the external state makes your recursive code harder to understand.
downvote count: 0
has comment: http://stackoverflow.com/comment/39108117
has comment: http://stackoverflow.com/comment/39108265

http://stackoverflow.com/comment/39088501
type: QuestionComment
comment on: http://stackoverflow.com/q/25115883
has text: If i rename resource to original name (without version), then it will work. My problem is that in ejb module spring lookup bypassing mapping
score: 0
type: Comment

http://stackoverflow.com/q/25119207
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39095358
answer count: 1
downvote count: 0
has body: I am using https url connection to post a json content into a url and I am getting the response too. But the disappointing part is that the response time for the call is around 2 minutes. On analysing the same I found that the latency is in connecing to the server for the first time. Here's the code snippet that I'm using. Can someone tell me whats wrong with this one ? import java.net.*; import java.security.KeyStore; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.io.*; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; import org.apache.axis2.java.security.TrustAllTrustManager; import org.json.JSONObject; public class httpsurl implements X509TrustManager { public static void main(String s[]) throws ProtocolException { httpsurl.query("https://instance.service-now.com/incident.do?JSON"); } public static void query(String URLName) { HttpsURLConnection con = null; try { JSONObject json = new JSONObject(); json.put("parameter 1", "value 1"); json.put("parameter 2", "value 2"); sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder(); Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress( "proxy name", 8080)); String encodedUserPwd = encoder .encode("username:password".getBytes()); URL u = new URL(URLName); // System.setProperty("http.keepAlive", "false"); con = (HttpsURLConnection) u.openConnection(proxy); SSLContext mySsl = SSLContext.getInstance("TLS"); mySsl.init(null, new TrustManager[]{new TrustAllTrustManager()}, null); con.setRequestProperty("connection", "close"); con.setReadTimeout(10000); con.setConnectTimeout(15000); con.setRequestMethod("POST"); con.setDoInput(true); con.setDoOutput(true); con.addRequestProperty("Content-Type", "application/json"); con.setRequestProperty("Authorization", "Basic " + encodedUserPwd); con.setUseCaches(false); con.setSSLSo…
has answer: http://stackoverflow.com/a/25120741
favorite count: 0
has comment: http://stackoverflow.com/comment/39094809
has title: Response time too high for json webservice call via https url connection
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: httpsurlconnection
type: Question

http://stackoverflow.com/comment/39235178
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25186410
has text: @Garik that is handle by the for loop

http://stackoverflow.com/a/25099277
has comment: http://stackoverflow.com/comment/39065687
type: Answer
has body: According to your mapping, the sequence of operations should look like this: Person p = DAO.findPerson(id); Car car = new Car(); car.setPerson(p); DAO.saveOrUpdate(car); p.getCars().add(car); Car firstCar = p.getCars().get(0); firstCar.setPerson(null); p.getCars().remove(firstCar); if (p.officialCar.equals(firstCar)) { p.officialCar = null; p.officialCar.person = null; } DAO.delete(firstCar); An update or a delete means acquiring an exclusive lock, even on READ_COMMITTED isolation level. If another transaction wants to update the same row with the current running transaction (which already locked this row in question) you won't get a deadlock, but a lock acquisition timeout exception. Since you got a deadlock, it means you acquire locks on multiple tables and the lock acquisitions are not properly ordered. So, make sure that the service layer methods set the transaction boundaries, not the DAO methods. I see you declared the get and find methods to use SUPPORTED, meaning they will use a transaction only if one is currently started. I think you should use REQUIRED for those as well, but simply mark them as read-only = true. So make sure the transaction aspect applies the transaction boundary on the "mymethod" and not on the DAO ones.
answers question: http://stackoverflow.com/q/25097957
has comment: http://stackoverflow.com/comment/39060363
upvote count: 17
has comment: http://stackoverflow.com/comment/39067755
score: 17
has comment: http://stackoverflow.com/comment/39066990
downvote count: 0
has comment: http://stackoverflow.com/comment/39058041
has comment: http://stackoverflow.com/comment/39065390

http://stackoverflow.com/a/25108415
has comment: http://stackoverflow.com/comment/39079701
score: -1
has body: Try with android:background="#000000" or another hex color
answers question: http://stackoverflow.com/q/25107472
downvote count: 1
type: Answer
upvote count: 0

http://stackoverflow.com/q/25161661
upvote count: 1
has title: Migration from eclipse 3 to eclipse 4 clonePerspective not available
has body: I am trying to use the compatibility layer to migrate an eclipse 3.5 application to eclipse 4. We use clone perspective to create a new perspective with the same contents with a new id. When I migrate to eclipse 4 clone perspective is not working. On debug, I see that it is not supported. Is there a latest version of any jar I need to include or do I have any alternative to this? Cloning is an integral part of our application and rewriting everything to eclipse 4 is not yet feasible for us.
score: 1
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/39176188
has comment: http://stackoverflow.com/comment/41571483
downvote count: 0
linked to: http://stackoverflow.com/q/26384842
tagged with: eclipse-rcp
tagged with: perspectives
favorite count: 0
has comment: http://stackoverflow.com/comment/41654264
answer count: 0
type: UnansweredQuestion
tagged with: swt

http://stackoverflow.com/comment/39115313
comment on: http://stackoverflow.com/q/25130289
type: QuestionComment
type: Comment
has text: yes you can because you do not consume the result you could change AsyncTask<Void, Void, Boolean> to AsyncTask<Void, Void, Void> and just return and also change super.onPostExecute(result); to super.onPostExecute();
score: 0

http://stackoverflow.com/comment/39225851
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25189881
has text: then you will get `java.text.ParseException`
score: 0

http://stackoverflow.com/comment/39237437
comment on: http://stackoverflow.com/a/25184478
type: AnswerComment
score: 0
type: Comment
has text: No, Here only i gave a wrong variable name but in my actual code it was correct, that's i edited my above code.

http://stackoverflow.com/q/25110829
type: UnansweredQuestion
tagged with: android
tagged with: io
has title: CSV File in Android won't write?
tagged with: java
has answer: http://stackoverflow.com/a/25110869
type: Question
score: 0
has body: I'm not getting any errors but I am uncertain as to why this CSV implementation won't write to the file... Code: package com.tukajo.ioiograph; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.List; import com.jjoe64.graphview.CustomLabelFormatter; import com.jjoe64.graphview.GraphView; import com.jjoe64.graphview.GraphView.GraphViewData; import com.jjoe64.graphview.GraphViewSeries; import com.jjoe64.graphview.LineGraphView; import android.app.ProgressDialog; import android.database.Cursor; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.Message; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CompoundButton; import android.widget.ImageView.ScaleType; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.ToggleButton; import au.com.bytecode.opencsv.CSVWriter; public class graph_fragment extends Fragment { Boolean csvThreadRunning; private customIOIO _myIOIO; globalControlInstance globalData = globalControlInstance.getInstance(); private final Handler mHandler = new Handler(); CSVWriter writer = null; private Runnable mTimer1; private Runnable mTimer2; private GraphView graphView; private int i = 0; ToggleButton realTimeToggle; TextView graphPeakText; TextView graphAvgText; TextView graphSamplesText; ToggleButton csvToggler; private double avgSumPin39 = 0.0; private double avgSumPin40 = 0.0; private double avgSumPin41 = 0.0; private double avgSumPin42 = 0.0; private double avgSumPin43 = 0.0; int graphLoopCounter = 0; private double newValuePin39 = 0; private double newValuePin40 = 0; private double newValuePin41 = 0; private double newValuePin42 = 0; private double newValuePin43 = 0; public static Fragment newInstance() { Fragment fragment = new gra…
answer count: 1
tagged with: opencsv

http://stackoverflow.com/comment/39098869
has text: hi, I have implement like below but pdf not createing it showing null public static File fontFile = new File("arialuni.ttf"); BaseFont bf = BaseFont.createFont(fontFile.getAbsolutePath(), BaseFont.IDENTITY_H, BaseFont.EMBEDDED); document.add(new Paragraph("hello text",new Font(bf,20)));second row only problem i didn't get how to fix can u please help me
score: 0
comment on: http://stackoverflow.com/a/25077867
type: AnswerComment
type: Comment

matlab
tags question: http://stackoverflow.com/q/25105415
tags question: http://stackoverflow.com/q/25179319
tags question: http://stackoverflow.com/q/25086906
type: Tag
tags question: http://stackoverflow.com/q/25228843
tag name: matlab
tags question: http://stackoverflow.com/q/25092221
tags question: http://stackoverflow.com/q/25094200

http://stackoverflow.com/a/25199048
score: 1
has comment: http://stackoverflow.com/comment/49207605
has body: I solved my problem. it works very well. Below is my solution if it helps someone: the code below: // Find path url of files to upload final String pathDir = new java.io.File("").getAbsolutePath(); final String pathFile = pathDir + "\\src\\main\\webapp\\myFile.txt"; // End find path url of files to upload driver.findElement(By.id("upload1")).sendKeys(pathFile);
downvote count: 0
answers question: http://stackoverflow.com/q/25183478
accepted answer of: http://stackoverflow.com/q/25183478
type: AcceptedAnswer
type: Answer
upvote count: 1

live
tags question: http://stackoverflow.com/q/25158698
tag name: live
type: Tag

http://stackoverflow.com/comment/39089417
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25116722
has text: 1) See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) 2) Swing GUIs might have to work on different platforms, using different PLAFs, on different screen sizes and resolutions with different default settings for font size. As such, they are not conducive to exact placement of components. Instead use layout managers, or [combinations of layout managers](http://stackoverflow.com/a/5630271/418556) as well as [layout padding and borders](http://stackoverflow.com/q/17874717/418556) for white space.

http://stackoverflow.com/a/25102329
answers question: http://stackoverflow.com/q/25102051
score: 2
downvote count: 0
type: Answer
has body: When a class extends another class, the subclass automatically inherits any visible variables (variables that are not marked private or have no access modifier). class ParentClass { protected String url = "www.stackoverflow.com"; } class ChildClass extends ParentClass { //automatically inherits url public void run() { //im guessing this class is where you want to use url? System.out.println(url); } } //A class to start to program class Main { public static void main(String[] args) { ChildClass child = new ChildClass(); child.run(); } } ChildClass will automatically inherit the String from ParentClass, allowing you to use url within ChildClass, with no extra work.
upvote count: 2

http://stackoverflow.com/q/25221428
has title: setting POI XWPFParagraph line spacing
has body: i want to set line spacing on all paragraph in my document created using POI library. i want to set the paragraph line spacing to 1.0, and remove space before and after paragraph, but the generated document keep using 1.15 line spacing and add space after paragraph. this is my code: for (XWPFParagraph paragraph : doc.getParagraphs()) { paragraph.setSpacingAfter(0); paragraph.setSpacingAfterLines(0); paragraph.setSpacingBefore(0); paragraph.setSpacingBeforeLines(0); paragraph.setSpacingLineRule(LineSpacingRule.EXACT); paragraph.setVerticalAlignment(TextAlignment.TOP); } please help, Thanks,
downvote count: 0
has answer: http://stackoverflow.com/a/44603634
answer count: 3
score: 3
favorite count: 0
tagged with: http://stackoverflow.com/tag/docx
tagged with: apache-poi
has answer: http://stackoverflow.com/a/55101277
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27752260
type: Question
tagged with: java

http://stackoverflow.com/q/25133157
has body: I need to convert a long variable to double. The value of the long variable is a not a literal, it is a value returned by another method, say, System.currentTimeMillis(). I need to convert it into double for decimal calculations like converting milliseconds to seconds, without losing the decimal part. So one way to do that is to use Double.valueOf() and then divide the .doubleValue() output by 1000. long then = System.currentTimeMillis(); long now = System.currentTimeMillis(); double timeElapsed = Double.valueOf(now - then).doubleValue() / 1000; Is this the right approach? Or should I simply cast them as follows? double timeElapsed = ((double) now - (double) then) / 1000; I am wondering which is the best way to do this. Please shatre your opinions/suggestions. Thanks.
has answer: http://stackoverflow.com/a/25133325
linked to: http://stackoverflow.com/q/17029719
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25133395
accepted answer: http://stackoverflow.com/a/25133395
has answer: http://stackoverflow.com/a/25133247
tagged with: primitive
downvote count: 1
type: Question
tagged with: standards
upvote count: 5
tagged with: java
score: 4
answer count: 3
tagged with: casting
possible better answer: http://stackoverflow.com/a/25133247
has title: typecast vs using valueOf
has comment: http://stackoverflow.com/comment/39120210
has comment: http://stackoverflow.com/comment/39120071
favorite count: 0
has comment: http://stackoverflow.com/comment/39120293

http://stackoverflow.com/a/25145835
score: 14
has body: user&gt; (java.nio.file.Paths/get "/home/justin" (into-array [".lein" "profiles.clj"])) #&lt;UnixPath /home/justin/.lein/profiles.clj&gt; varargs java methods need an array containing all remaining args as their final argument. The first string outside the array is needed in order for the method dispatch to match the right method. For completeness, here is an example using a URI (much more straightforward): user&gt; (java.nio.file.Paths/get (java.net.URI. "file:///home/justin")) #&lt;UnixPath /home/justin&gt;
accepted answer of: http://stackoverflow.com/q/25145550
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25145550
type: Answer
has comment: http://stackoverflow.com/comment/39178701
upvote count: 14

http://stackoverflow.com/q/25163795
favorite count: 0
has answer: http://stackoverflow.com/a/25164111
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25163894
has title: Trying to access localhost from a Java restAdapter on Android
tagged with: java
upvote count: 1
tagged with: localhost
type: Question
has body: I'm making an android application wich uses a web service. To access to it, we use a restAdapter. This is the code: private String URL_PLACE = "http://myaddresstomywebservice"; public RouteCLlegar(Context ctx) { restAdapter = new RestAdapter.Builder() .setEndpoint(URL_PLACE) .build(); cLlegar = restAdapter.create(CLlegar.class); } When we access the web service hosted on the web, it works, but when we use localhost, it doesn't. private String URL_PLACE = "http://localhost:53285"; public RouteCLlegar(Context ctx) { restAdapter = new RestAdapter.Builder() .setEndpoint(URL_PLACE) .build(); cLlegar = restAdapter.create(CLlegar.class); } It gives this error: 24963-25327/ni.femer.busesmg.app I/ERROR﹕ el error java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 53285) after 15000ms: isConnected failed: ECONNREFUSED (Connection refused How can i access localhost from my rest adapter?
answer count: 2
downvote count: 0
score: 1

http://stackoverflow.com/comment/39087077
has text: yes, exactly. however I suppose you have to work also on the job code to get what you want.
comment on: http://stackoverflow.com/q/25115034
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25198735
has comment: http://stackoverflow.com/comment/39242549
has comment: http://stackoverflow.com/comment/39241891
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/39242423
has comment: http://stackoverflow.com/comment/39242512
accepted answer of: http://stackoverflow.com/q/25198627
score: 1
has comment: http://stackoverflow.com/comment/39243944
answers question: http://stackoverflow.com/q/25198627
has comment: http://stackoverflow.com/comment/39241900
has comment: http://stackoverflow.com/comment/39241920
upvote count: 1
has comment: http://stackoverflow.com/comment/39241870
has body: public static int isGreater(int limit, int[] data){ int overLimit = 0; for(int k = 0; k &lt; data.length; k++){ if (data[k] &gt; limit) overLimit++; } return (overLimit/data.length)*100; } By keeping a running calculation of the numbers that are over and under the limit, you can calculate what percentage of the overall list was greater than the limit. Hope this helps!
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39243089
has comment: http://stackoverflow.com/comment/39241957

http://stackoverflow.com/q/25104668
downvote count: 0
type: UnansweredQuestion
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39069577
type: Question
has comment: http://stackoverflow.com/comment/39072226
has comment: http://stackoverflow.com/comment/39067054
linked to: http://stackoverflow.com/q/19528304
upvote count: 2
has comment: http://stackoverflow.com/comment/39070308
has comment: http://stackoverflow.com/comment/39067086
answer count: 1
favorite count: 0
tagged with: threadpoolexecutor
has body: Per the ThreadPoolExecutor doc (Java ThreadPoolExecutor), if I create an executor service like so: new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue); and when #threads > corePoolSize, idle threads will be killed. I wanted to call some application specific cleanup code when the ThreadPoolExecutor kills any thread. I wasn't able to get a clear way to do so. Appreciate any help. Thanks in advance.
has comment: http://stackoverflow.com/comment/39069626
has title: Java ThreadPoolExecutors idle thread shutdown - calling custom cleanup code
has answer: http://stackoverflow.com/a/25107499
score: 2
has comment: http://stackoverflow.com/comment/39066978

http://stackoverflow.com/comment/39258556
has text: @BenjaminR Sure, I may have overrated some statements or made implicit assumptions. Again: No problem from my side.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25205216

http://stackoverflow.com/a/25210694
score: 0
has body: Without seeing your code, it would be tough to say what is really going on. Doing any processing row by row, which it sounds like is what is going on, is going to take a VERY long time. Generally speaking, the best way to work with data is in sets. At the end of your process, you're going to ultimately have a set of records where isProcessed needs to be true (where the operation was successful), and a set where isProcessed needs to be false (where the operation failed). As you process the data, keep track of which records could be updated successfully, as well as which could not be updated. You could do this by making a list or array of the primary key or whatever other data you use to identify the rows. Then, after you're done processing your data, do one update to flag the records that were successful, and one to update the records that were not successful. This will be a bit more code, but updating each row individually after you process it is going to be awfully slow. Again, seeing code would help, but if you're updating each record after you process it, I suspect this is what's slowing you down.
answers question: http://stackoverflow.com/q/25210475
type: Answer

http://stackoverflow.com/a/52498596
score: 0
has body: This is my example for more complex data with nested Maps public static class MapEntryConverter implements Converter { static final Converter INSTANCE = new MapEntryConverter(); public boolean canConvert(Class clazz) { return Map.class.isAssignableFrom(clazz); } public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingContext context) { Map map = (Map) value; for (Object obj : map.entrySet()) { Map.Entry entry = (Map.Entry) obj; writer.startNode(entry.getKey().toString()); Object val = entry.getValue(); if (val != null) context.convertAnother(val); writer.endNode(); } } public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { Map&lt;String, Object&gt; map = new LinkedHashMap&lt;String, Object&gt;(); while (reader.hasMoreChildren()) { reader.moveDown(); String key = reader.getNodeName(); Object value = null; if (reader.hasMoreChildren()) { value = unmarshal(reader, context); } else { value = reader.getValue(); } map.put(key, value); reader.moveUp(); } return map; } } Have fun!
type: Answer
answers question: http://stackoverflow.com/q/25097491

http://stackoverflow.com/a/25113098
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25107472
answers question: http://stackoverflow.com/q/25107472
has body: Actually its mostly depends on your application theme If you use android:Theme.Light for your application theme it looks like the below screenshot if you use android:Theme.Holo for your application theme it looks like the below screenshot EDIT : use HoloEverywhere project for your application theme.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39126687
type: Answer

http://stackoverflow.com/a/25228825
type: Answer
upvote count: 4
downvote count: 0
score: 4
has body: I would guess that you forgot to specify the packaging as "kjar". If that is the case, the plugin won't be executed during the Maven build. Simply add kjar into you pom.xml. Please see the example usage of the kie-maven-plugin: https://github.com/droolsjbpm/drools/blob/master/kie-maven-plugin-example/pom.xml To best of my knowledge the kie-maven-plugin only verifies that the resources can be compiled. Running Drools verifier is not part of the execution. If you are already using the "kjar" packaging, please post the entire pom.xml, otherwise it is hard to guess what is actually causing the described behavior.
has comment: http://stackoverflow.com/comment/39426661
has comment: http://stackoverflow.com/comment/39446518
answers question: http://stackoverflow.com/q/25189560

http://stackoverflow.com/a/25127142
has comment: http://stackoverflow.com/comment/39288716
accepted answer of: http://stackoverflow.com/q/25125696
has comment: http://stackoverflow.com/comment/39300617
has comment: http://stackoverflow.com/comment/39303794
has comment: http://stackoverflow.com/comment/39290123
has comment: http://stackoverflow.com/comment/39300499
has comment: http://stackoverflow.com/comment/39290109
has comment: http://stackoverflow.com/comment/39287712
has comment: http://stackoverflow.com/comment/39288268
has comment: http://stackoverflow.com/comment/39340444
has comment: http://stackoverflow.com/comment/39288099
has comment: http://stackoverflow.com/comment/39288164
score: 0
has comment: http://stackoverflow.com/comment/39288222
has comment: http://stackoverflow.com/comment/39289233
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39300867
has comment: http://stackoverflow.com/comment/39288192
has comment: http://stackoverflow.com/comment/39288007
answers question: http://stackoverflow.com/q/25125696
has body: What I would do is declare two int fields in the player class: private float xToMove = 0; private float yToMove = 0; Then, under your input event: if (input.down &amp;&amp; yToMove == 0) yToMove = -32; if (input.up &amp;&amp; yToMove == 0) yToMove = 32; if (input.left &amp;&amp; xToMove == 0) xToMove = -32; if (input.right &amp;&amp; xToMove == 0) xToMove = 32; And finally, in your Player class's update method: public void update() { if (xToMove &gt; 0) { xToMove--; x++; } if (xToMove &lt; 0) { xToMove++; x--; } if (yToMove &gt; 0) { yToMove--; y++; } if (yToMove &lt; 0) { yToMove++; y--; } } Of course this is simplified a bit but the concept is there EDIT: to change the speed. Note that xToMove and yToMove have been changed to floats. You can use a float to represent the amount of time 1 move takes float period = 1000; //The time one move takes in milliseconds Somewhere you should calculate the number of pixels to be moved each frame. You could make a calculateSpeed() method or just throw it into the constructor or something. Depends on if you want speed to change during the game. float speed = 32f / (fps * (period / 1000f)); //fps should be obtained dynamically and should be a float Then when you update you should do this: if (xToMove &gt; 0) { xToMove -= speed; x += speed; if (xToMove &lt;= 0) { //Set these guys to nice even numbers to prevent problems xToMove = 0; x = (float) Math.round(x); } } Also make sure that x and y are floats. EDIT 2: fps int frames = 0; int fps = 60; requestFocus(); while(running){ long xnow = System.nanoTime(); delta += (xnow-xlastTime) / xns; xlastTime = xnow; while (delta &gt;= 1) { update(); delta--; } render(); frames++; if (System.currentTimeMillis() - timer &gt; 1000){ timer += 1000; fps = frames; frame.setTitle(title + " | " + fps + " fps"); frames = 0; } } stop();
has comment: http://stackoverflow.com/comment/39289062
type: Answer
has comment: http://stackoverflow.com/comment/39300217
has comment: http://stackoverflow.com/comment/39288141

http://stackoverflow.com/comment/39019280
type: AnswerComment
type: Comment
has text: Couldn't you just use the ReentrantReadWriteLock backwards? There's nothing anywhere that says that when you have locked the writeLock you must be writing. I know it's ugly, but you could use the readLock() for writes and the writeLock() for reads.
score: 2
comment on: http://stackoverflow.com/a/25079173

http://stackoverflow.com/q/25077792
has body: Does tomcat do some regular task every 10 seconds? I notice this at my local tomcat server, but not on the remote server. Here's JVM CPU usage: Noticing that there's a peak about every 10 seconds. I'm running nothing, and, what's it doing? UPDATE : here are the threads, it's true that I'm using quartz for scheduler task. but they are always in status waiting.
type: Question
has answer: http://stackoverflow.com/a/25077875
score: 0
tagged with: java
answer count: 1
tagged with: tomcat6
tagged with: task
accepted answer: http://stackoverflow.com/a/25077875
has title: tomcat6 regular task every 10 seconds
type: AnsweredQuestion

http://stackoverflow.com/a/25125386
has comment: http://stackoverflow.com/comment/39109427
has comment: http://stackoverflow.com/comment/39106278
has comment: http://stackoverflow.com/comment/39107242
score: 0
has comment: http://stackoverflow.com/comment/39107989
has comment: http://stackoverflow.com/comment/39106565
type: Answer
answers question: http://stackoverflow.com/q/25124595
has body: The message java.lang.NoClassDefFoundError: Could not initialize class SomeClass means that the JVM has already tried and failed to perform static initialization on the class SomeClass. There may well be another error which happened earlier on when the JVM tried to load the class the first time. Taking a look at the source of the PropertyContainer class, the only static intialization is a static initializer that sets a system property, and a line that initializes a logger for the class. Setting a system property will should not cause a problem, so my guess is that the logger class used is missing from your classpath. The logger class used is org.jboss.logging.Logger. A quick Google for this class suggested a jar named jboss-logging.jar. Try getting a copy of that and adding it to your classpath. (Incidentally, if you can't find a previous error before the 'Could not initialize class' error, that may well be because the missing JAR affects logging. Logging is something applications tend to assume is always working and can be used everywhere. The exception you are seeing might have been thrown from within a finally block that tried to do some logging when the corresponding try block also tried to do some logging but threw an exception. An exception thrown from within a finally block replaces any exception that had previously been thrown.) EDIT in response to the stacktrace: I can now see that I was wrong about setting a system property not being the problem! I don't know the first thing about Blackboard Learn, but it is possible that it or something else has tightened up the security in your application and hence caused the above problem. It does however confirm my belief that the real cause of the problem was before the Could not initialize class message.
has comment: http://stackoverflow.com/comment/39108436
has comment: http://stackoverflow.com/comment/39108930
has comment: http://stackoverflow.com/comment/39106504

http://stackoverflow.com/comment/39015966
comment on: http://stackoverflow.com/q/25077282
score: 0
type: Comment
type: QuestionComment
has text: As for the actual question itself: I don't want to jump the gun but this smells like a bug in the driver. I'm assuming there is an issue tracker for it somewhere, did you check if this is perhaps a known bug?

http://stackoverflow.com/a/25091537
accepted answer of: http://stackoverflow.com/q/25081504
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
has body: The getCharacterEncoding() method only Returns the name of the character encoding used in the body of this request. But you are sending your parameters as part of the URI query string, not the request body. You can't depend on setCharacterEncoding(String) for that purpose. In Tomcat (and I assume other containers have similar configuration), there's a configuration attribute you can set to have the container use the same encoding for both the request body and the query string. That is useBodyEncodingForURI. You can set it on a (HTTP) &lt;Connector&gt; element of your Tomcat instance's server.xml file.
answers question: http://stackoverflow.com/q/25081504
score: 3

http://stackoverflow.com/comment/39163137
score: 0
type: AnswerComment
type: Comment
has text: +1 for giving both possible uses, as opposed to just assuming the use.
comment on: http://stackoverflow.com/a/25156375

http://stackoverflow.com/q/25189656
has comment: http://stackoverflow.com/comment/80951583
has title: Is there a way to make MouseListener, MouseMotionListener, and ActionListener to work at the same time?
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
upvote count: 1
tagged with: swing
has body: I've been working on a program, which uses the arrow keys to move a rectangle representing the player, and mouse movement and clicks to aim where the newly created shots go. However, every time I hold down the mouse, the shots only travel in the direction of the point where the mouse was first pressed. I know that events are normally handled in the EDT, but is there a way to check for these events at the same time using threads? https://gist.github.com/BigHairyYak/4062e1341580b6a837c0 There's a link to the program - I'm new to sharing code, so I just uploaded the whole thing. Thanks in advance for any advice on the matter.
has comment: http://stackoverflow.com/comment/39225132
has comment: http://stackoverflow.com/comment/39225204
score: 1
tagged with: java
tagged with: listeners
type: Question
has comment: http://stackoverflow.com/comment/39225421
downvote count: 0
has comment: http://stackoverflow.com/comment/39225251
tagged with: awt
favorite count: 0

http://stackoverflow.com/comment/39013810
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25076223
has text: The server being a test server doesn't prevent you from providing a form to fill and submit. Where's the problem?
type: Comment

http://stackoverflow.com/a/25082137
has comment: http://stackoverflow.com/comment/39024920
answers question: http://stackoverflow.com/q/25081761
has comment: http://stackoverflow.com/comment/39025052
type: Answer
has comment: http://stackoverflow.com/comment/39025284
downvote count: 0
has comment: http://stackoverflow.com/comment/39024861
has comment: http://stackoverflow.com/comment/39025165
score: 1
has comment: http://stackoverflow.com/comment/39036839
has comment: http://stackoverflow.com/comment/39025011
has body: Your are supposed to mention class path while running from another directory syntax is java -classpath directory_to_program Program try { runProcess("javac src/HelloWorld.java"); runProcess("java -classpath src HelloWorld"); } catch (Exception e) { e.printStackTrace(); } Read for more info How do I run a java program from a different directory?
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25081761

http://stackoverflow.com/comment/40346585
score: 0
type: AnswerComment
has text: @user2809564, see my update. :) i agree, they don't really make this clear in the documentation
type: Comment
comment on: http://stackoverflow.com/a/25770879

http://stackoverflow.com/a/25209766
has comment: http://stackoverflow.com/comment/39263111
has body: Because of your array int nob = 25; int v[][]=new int[nob][nob]; is hardcoded to size 25, but you then use a for-loop that goes to n and M (So if you enter a number for n or M larger than nob aka 25 then you will get an out of bounds exception. Your for-loops should always use the array in them like this for(int i = 0; i &lt; v.length; i++) { for(int j = 0; j &lt; v[i].length; j++){} } to avoid this issue. edit However, Your real issue, now that I re look at the question is that your for-loop does this: for(int i = 0; i &lt;= n; i++) If you have i &lt;= n starting at 0 you will run this loop 26 (not 25) times. Since I am assuming your n is 25 since you hard-coded nob to 25. Also for(int j = 0; j &lt;= M; j++) means that you will go from 0 to M (Knapsack size) which I assume is almost always above 25, so this will always cause an out of bounds exception because you hard code the size of the array.
has comment: http://stackoverflow.com/comment/39263589
has comment: http://stackoverflow.com/comment/39263670
has comment: http://stackoverflow.com/comment/39263532
accepted answer of: http://stackoverflow.com/q/25209549
has comment: http://stackoverflow.com/comment/39263242
has comment: http://stackoverflow.com/comment/39262925
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39262831
has comment: http://stackoverflow.com/comment/39263613
score: 0
has comment: http://stackoverflow.com/comment/39263200
type: Answer
has comment: http://stackoverflow.com/comment/39263350
answers question: http://stackoverflow.com/q/25209549

http://stackoverflow.com/comment/39211557
has text: @Amogh I believe so, because it is a column directive for the database structural details. JPA uses the java type to determine which object to join to, so it's not a java class join directive.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25182692
type: AnswerComment

http://stackoverflow.com/comment/122148142
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25114527
has text: @Bohemian Agreed, I merely wanted to mention that it's _possible_ to perform multiple operations on a synchronized list atomically. The answer as written suggests it's not possible and that the only recourse is to use a different implementation.
score: 0

http://stackoverflow.com/comment/39208412
has text: it's just a boring custom classloader with callbacks.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25179863
type: QuestionComment

generics
tags question: http://stackoverflow.com/q/25143522
tags question: http://stackoverflow.com/q/25120951
tags question: http://stackoverflow.com/q/25181869
tags question: http://stackoverflow.com/q/25169635
tags question: http://stackoverflow.com/q/25097136
tags question: http://stackoverflow.com/q/25209855
tags question: http://stackoverflow.com/q/25210265
tags question: http://stackoverflow.com/q/25198127
tags question: http://stackoverflow.com/q/25090245
tags question: http://stackoverflow.com/q/25115537
tags question: http://stackoverflow.com/q/25214169
tags question: http://stackoverflow.com/q/25219707
tags question: http://stackoverflow.com/q/25069671
type: Tag
tags question: http://stackoverflow.com/q/25127240
tags question: http://stackoverflow.com/q/25136666
tags question: http://stackoverflow.com/q/25208559
tags question: http://stackoverflow.com/q/25112495
tags question: http://stackoverflow.com/q/25144230
tags question: http://stackoverflow.com/q/25226014
tags question: http://stackoverflow.com/q/25128155
tags question: http://stackoverflow.com/q/25070520
tags question: http://stackoverflow.com/q/25222603
tags question: http://stackoverflow.com/q/25216255
tags question: http://stackoverflow.com/q/25175511
tags question: http://stackoverflow.com/q/25213635
tags question: http://stackoverflow.com/q/25100996
tags question: http://stackoverflow.com/q/25093531
tags question: http://stackoverflow.com/q/25226415
tags question: http://stackoverflow.com/q/25095831
tags question: http://stackoverflow.com/q/25140307
tags question: http://stackoverflow.com/q/25132499
tags question: http://stackoverflow.com/q/25163114
tags question: http://stackoverflow.com/q/25090447
tags question: http://stackoverflow.com/q/25128024
tags question: http://stackoverflow.com/q/25206985
tags question: http://stackoverflow.com/q/25149412
tags question: http://stackoverflow.com/q/25139508
tags question: http://stackoverflow.com/q/25110725
tag name: generics
tags question: http://stackoverflow.com/q/25087391
tags question: http://stackoverflow.com/q/25206185
tags question: http://stackoverflow.com/q/25085353
tags question: http://stackoverflow.com/q/25176281

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/25192342
tags question: http://stackoverflow.com/q/25072326
tags question: http://stackoverflow.com/q/25120513
tags question: http://stackoverflow.com/q/25149759
tags question: http://stackoverflow.com/q/25089755
tags question: http://stackoverflow.com/q/25111748
tags question: http://stackoverflow.com/q/25173708
tags question: http://stackoverflow.com/q/25138037
tags question: http://stackoverflow.com/q/25151627
tags question: http://stackoverflow.com/q/25220635
tags question: http://stackoverflow.com/q/25116952
tags question: http://stackoverflow.com/q/25169303
tags question: http://stackoverflow.com/q/25171207
tags question: http://stackoverflow.com/q/25164159
tags question: http://stackoverflow.com/q/25161387
tags question: http://stackoverflow.com/q/25143009
tags question: http://stackoverflow.com/q/25074448
tags question: http://stackoverflow.com/q/25073503
tags question: http://stackoverflow.com/q/25197197
tags question: http://stackoverflow.com/q/25192976
tags question: http://stackoverflow.com/q/25134511
tags question: http://stackoverflow.com/q/25092955
tags question: http://stackoverflow.com/q/25119207
tags question: http://stackoverflow.com/q/25077756
tags question: http://stackoverflow.com/q/25084225
tags question: http://stackoverflow.com/q/25101627
tags question: http://stackoverflow.com/q/25088730
tags question: http://stackoverflow.com/q/25194535
tags question: http://stackoverflow.com/q/25117329
tags question: http://stackoverflow.com/q/25117383
tags question: http://stackoverflow.com/q/25205405
tags question: http://stackoverflow.com/q/25156321
tags question: http://stackoverflow.com/q/25080038
tags question: http://stackoverflow.com/q/25120725
tags question: http://stackoverflow.com/q/25089002
tags question: http://stackoverflow.com/q/25199033
tags question: http://stackoverflow.com/q/25210193
tags question: http://stackoverflow.com/q/25095791
tags question: http://stackoverflow.com/q/25070491
tags question: http://stackoverflow.com/q/25204104
tags question: http://stackoverflow.com/q/25131282
tags question: http://stackoverflow.com/q/25156354
tags question: http://stackoverflow.com/q/25178469
tags question: http://stackoverflow.com/q/25214887
tags question: http://stackoverflow.com/q/25148941
tags question: http://stackoverflow.com/q/25081842
type: Tag
tags question: http://stackoverflow.com/q/25186382
tags question: http://stackoverflow.com/q/25111149
tags question: http://stackoverflow.com/q/25132642
tags question: http://stackoverflow.com/q/25136840
tags question: http://stackoverflow.com/q/25176612
tags question: http://stackoverflow.com/q/25124188
tags question: http://stackoverflow.com/q/25179908
tags question: http://stackoverflow.com/q/25131802
tags question: http://stackoverflow.com/q/25082963
tags question: http://stackoverflow.com/q/25076030
tags question: http://stackoverflow.com/q/25095088
tags question: http://stackoverflow.com/q/25140010
tags question: http://stackoverflow.com/q/25152109
tags question: http://stackoverflow.com/q/25206985
tags question: http://stackoverflow.com/q/25136573
tags question: http://stackoverflow.com/q/25122481
tags question: http://stackoverflow.com/q/25127659
tags question: http://stackoverflow.com/q/25085054
tags question: http://stackoverflow.com/q/25201814
tags question: http://stackoverflow.com/q/25086250
tags question: http://stackoverflow.com/q/25180667
tags question: http://stackoverflow.com/q/25169968
tags question: http://stackoverflow.com/q/25202481
tags question: http://stackoverflow.com/q/25185913
tags question: http://stackoverflow.com/q/25092650
tags question: http://stackoverflow.com/q/25156408
tags question: http://stackoverflow.com/q/25185545
tags question: http://stackoverflow.com/q/25145216
tags question: http://stackoverflow.com/q/25143522
tags question: http://stackoverflow.com/q/25104555
tags question: http://stackoverflow.com/q/25084710
tag name: json
tags question: http://stackoverflow.com/q/25092038

quartz-scheduler
tags question: http://stackoverflow.com/q/25081658
type: Tag
tags question: http://stackoverflow.com/q/25160331
tags question: http://stackoverflow.com/q/25115034
tag name: quartz-scheduler
tags question: http://stackoverflow.com/q/25197933

http://stackoverflow.com/q/25161847
has answer: http://stackoverflow.com/a/25163104
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39173450
has comment: http://stackoverflow.com/comment/39175938
tagged with: java
has answer: http://stackoverflow.com/a/25164577
accepted answer: http://stackoverflow.com/a/25164577
has comment: http://stackoverflow.com/comment/39173440
has body: I am using the following code: { // ... String[] roles = new String[resultList.size()]; int i=0; for (Iterator&lt;Object[]&gt; iter = resultList.iterator(); iter.hasNext();) { roles[i] = new String(); Object[] objArr = iter.next(); roles[i] = objArr[0].toString(); i++; } return roles; } However, I get a ClassCastException saying cannot cast from java.lang.String to Object[].
type: Question
has comment: http://stackoverflow.com/comment/39173435
has comment: http://stackoverflow.com/comment/39173612
has comment: http://stackoverflow.com/comment/39173976
has comment: http://stackoverflow.com/comment/39173558
has comment: http://stackoverflow.com/comment/39176920
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25164206
has comment: http://stackoverflow.com/comment/39173780
has comment: http://stackoverflow.com/comment/39178134
has title: ClassCastException String to Object[]
tagged with: classcastexception
possible better answer: http://stackoverflow.com/a/25163104
has comment: http://stackoverflow.com/comment/39173446

http://stackoverflow.com/comment/39253480
score: 0
type: Comment
has text: It would probably be helpful to look at the first N factorial numbers and look for a pattern in when trailing zeros appear, but every trailing zero represents a factor of ten in the number, right? And the prime factorization of ten is...? And which prime factors of ten are going to be more common, and which are going to be the limiting factor...?
type: QuestionComment
comment on: http://stackoverflow.com/q/25204619

http://stackoverflow.com/comment/39024088
type: QuestionComment
has text: @ElliotFrisch which raises the question, why have the while block at all? :)
type: Comment
comment on: http://stackoverflow.com/q/25081668
score: 0

google-cloud-datastore
tags question: http://stackoverflow.com/q/25161448
tags question: http://stackoverflow.com/q/25218630
tag name: google-cloud-datastore
tags question: http://stackoverflow.com/q/25155646
type: Tag
tags question: http://stackoverflow.com/q/25117163

http://stackoverflow.com/a/25183625
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25156812
upvote count: 6
has body: You can turn off the log for a class or package. e.g.: <priority value="OFF" /> <priority value="OFF" /> <priority value="TRACE" /> <appender-ref ref="STDOUT" /> See more in Apache log4j 1.2 - Short introduction to log4j.
score: 6

http://stackoverflow.com/q/25074613
tagged with: list
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25770879
has body: I am trying to use Render Snake HTML library to programatically generate HTML for me. I am trying to make HTML table by using Render Snake as shown below - This is just an example of how do we make table using Render Snake library. html .table(class_("city-table")) .tr() .th().content("City") .th().content("Country") ._tr() .tr() .td().content("Amsterdam") .td().content("The Netherlands") ._tr() ._table(); I need to do the same thing while iterating my object and make the proper .tr and close it as well. So this is what confusing me a lot. Below is the way I would like to have my table in an HTML using RenderSnake library - Here PoolName, TotalSyncCount, TotalAsyncCount, SyncNinetyFivePercentile and AsyncNinetyFivePercentile are my column names so I am using th for them PoolName TotalSyncCount TotalAsyncCount SyncNinetyFivePercentile AsyncNinetyFivePercentile Hello 100 100 4 0 World 300 300 2 0 And below is my object which has all these details and which I need to iterate to get the table in the above format public class PoolMetrics { private String poolName; private String totalSyncCount; private String totalAsyncCount; private String syncNinetyFivePercentile; private String asyncNinetyFivePercentile; // getters and setters } And so far I am able to create only the column names using RenderSnake. I am not sure how to add values inside those column names by iterating PoolMetrics object - public static void main(String[] args) throws IOException { List&lt;PoolMetrics&gt; poolMetricsList = new ArrayList&lt;PoolMetrics&gt;(); // here poolMetricsList has all the information as shown above in the table HtmlCanvas html = new HtmlCanvas(); html.html().body().table().tr().th().content("PoolName").th().content("TotalSyncCount").th() .content("TotalAsyncCount").th().content("SyncNinetyFivePercentile").th() .content("AsyncNinetyFivePercentile")._tr()._table()._body()._html(); // now how do I iterate poolMetricsList to add values inside the column names // as shown in the above…
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25770879
type: Question
upvote count: 2
tagged with: http://stackoverflow.com/tag/html
has title: How to generate HTML table using RenderSnake library in Java?

http://stackoverflow.com/comment/39091703
type: QuestionComment
has text: @singe31 I tried that too. I feel it's not really a syntax issue. rather something wrong with the function
score: 0
comment on: http://stackoverflow.com/q/25117834
type: Comment

http://stackoverflow.com/a/25956834
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25183272
type: Answer
answers question: http://stackoverflow.com/q/25183272
has body: use the HTML tag &lt;strong&gt; to indicate the text you want bold
score: 4
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/39078131
comment on: http://stackoverflow.com/q/25109942
score: 0
type: Comment
type: QuestionComment
has text: @morgano, I find that it's much more helpful to ignore the Prolog stuff and focus on the classic inference verifier. The new verifier is very similar, they just decided to specify it in 200 pages of Prolog instead of using a vauge English description like the old one

http://stackoverflow.com/comment/39174326
score: 0
type: Comment
type: QuestionComment
has text: @madhawapriyashantha as of now yes. OP might trying to learn method overriding :)
comment on: http://stackoverflow.com/q/25162274

http://stackoverflow.com/a/25102764
has comment: http://stackoverflow.com/comment/39064319
has body: A potential solution to your problem might be to uninstall Java6 (provided by Apple itself) and only have Java7 installed in your system. This only applies in case you have no applications that desperately need the old Java6 version to be installed. To remove the Apple-like Java6 installation open a Terminal and: sudo rm -rf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk After this step you should only have Java7 by Oracle installed in your system. To verify, open another terminal and do a: java -version It should display something like "java version "1.7.0_XX" where XX is the current update version of the Java7 installation. If not: proceed with the next step. Redefine the JAVA_HOME variable (to support IDEs like Eclipse and other developer tools...), which helps detecting where the "active" Java installation is situated in your system. Open a terminal and (Note: replace XX first!): sudo rm /Library/Java/Home sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_XX.jdk/Contents/Home /Library/Java/Home Afterwards, a fresh installation of Eclipse should detect Java7 in your system and should work with this version out of the box. You can modify an installed Eclipse to use this installation by navigating in Eclipse to: Preferences -> Java -> Installed JREs. Then remove the old Java6 system entry AND add new path (see above) with the name Java7.
type: Answer
has comment: http://stackoverflow.com/comment/83531049
has comment: http://stackoverflow.com/comment/39063397
has comment: http://stackoverflow.com/comment/39063699
downvote count: 1
accepted answer of: http://stackoverflow.com/q/25102627
has comment: http://stackoverflow.com/comment/39063427
has comment: http://stackoverflow.com/comment/39063746
answers question: http://stackoverflow.com/q/25102627
upvote count: 10
score: 9
type: AcceptedAnswer

http://stackoverflow.com/a/25155366
downvote count: 1
score: -1
has body: Try to use Jackson API @RequestMapping(value="update", method=RequestMethod.POST) @ResponseStatus(HttpStatus.OK) public void update(@RequestBody List&lt;Property&gt; properties) { // Do something with properties. }
upvote count: 0
answers question: http://stackoverflow.com/q/25152812
type: Answer
has comment: http://stackoverflow.com/comment/39161316
has comment: http://stackoverflow.com/comment/39196319

http://stackoverflow.com/q/25199764
has title: JTextPane selected text is deselected when the new text is written
has body: I used JTextPane to read logs which comes from telnet server. Problem is that when the new logs occurred and written to JTextPane, my selected text deselected I suppose that I should change default caret of JTextPane but I could not. Please give an any suggestion I want to preserve my selected text.
has comment: http://stackoverflow.com/comment/39244617
has comment: http://stackoverflow.com/comment/39243861
has comment: http://stackoverflow.com/comment/39244382
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39244443
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25200092
tagged with: jtextpane
has comment: http://stackoverflow.com/comment/39244017
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/39247546
has comment: http://stackoverflow.com/comment/39245112

http://stackoverflow.com/comment/39287786
score: 0
type: QuestionComment
has text: @whiskeyspider I'm drawing lines and typing words.
type: Comment
comment on: http://stackoverflow.com/q/25207036

http://stackoverflow.com/comment/39127329
type: Comment
type: QuestionComment
score: 1
has text: Please, take a look at this question and replies http://stackoverflow.com/questions/17255549/how-can-i-get-the-keyboard-scan-code-in-java
comment on: http://stackoverflow.com/q/25137186

http://stackoverflow.com/a/25092131
answers question: http://stackoverflow.com/q/25092107
score: 3
has body: Doing File x = new File("file_name"); does not create a file, but only a File object instance. To actually create the file, you have to call the createNewFile() method on the created instance: File x = new File("file_name"); x.createNewFile(); Note that createNewFile() will return true if the file didn't already exist and was successfully created, and false if a file with the specified name already exists. Here's a link to the documentation.
type: AcceptedAnswer
upvote count: 3
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25092107

gmail
type: Tag
tags question: http://stackoverflow.com/q/25095261
tags question: http://stackoverflow.com/q/25156129
tags question: http://stackoverflow.com/q/25229301
tag name: gmail

http://stackoverflow.com/comment/39272028
has text: @Johan, I figured it out...Thanks a lot!
comment on: http://stackoverflow.com/a/25192712
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39354231
comment on: http://stackoverflow.com/a/25216235
type: AnswerComment
score: 0
type: Comment
has text: Yes it is just another listener.

http://stackoverflow.com/comment/39213555
type: Comment
comment on: http://stackoverflow.com/q/25183780
type: QuestionComment
score: 1
has text: Can you show your attempt at implementing an [InternalFrameListener](http://docs.oracle.com/javase/7/docs/api/javax/swing/event/InternalFrameListener.html). And explain what you wish to accomplish it. Have you looked at [How to Write an Internal Frame Listener](http://docs.oracle.com/javase/tutorial/uiswing/events/internalframelistener.html)?

http://stackoverflow.com/q/25143344
favorite count: 0
has title: ORA-28040: No matching authentication protocol exception when using groovy.sql package with oracle12c
type: Question
score: 5
has answer: http://stackoverflow.com/a/25143835
tagged with: jdbc
has answer: http://stackoverflow.com/a/25143842
accepted answer: http://stackoverflow.com/a/25143835
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/25143842
upvote count: 5
has body: I am trying to connect to oracle12c database using groovy.sql.Sql Sql sql = Sql.newInstance('jdbc:oracle:thin:@'+hostName:port/serviceName, dbUser, dbPassword, 'oracle.jdbc.driver.OracleDriver') and it returns java.sql.SQLException: ORA-28040: No matching authentication protocol I guess, this is because of the dialect mismatch. It works fine with oracle11g, but not with 12c. If it is a problem with dialect, how can we externally specify dialect to groovy.sql.Sql. If not, what could be the problem/solution? I'm using ojdbc14 driver.
tagged with: groovy
type: AnsweredQuestion
tagged with: sql
downvote count: 0
linked to: http://stackoverflow.com/q/24100117
tagged with: oracle12c

http://stackoverflow.com/comment/39221347
type: AnswerComment
type: Comment
score: 2
has text: (sorry for my harsh tone in first comment) But then, the reason seems to be "because if it would be atomic, then there would be no race conditions". I.e., it sounds as if a race condition is desirable.
comment on: http://stackoverflow.com/a/25168135

http://stackoverflow.com/q/25099593
has title: Order of non-blocking writes in Java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25100757
accepted answer: http://stackoverflow.com/a/25100757
tagged with: java
has comment: http://stackoverflow.com/comment/39063654
tagged with: nio
type: Question
has comment: http://stackoverflow.com/comment/39059639
score: 0
answer count: 1
has body: Java's NIO provides lots of useful features. One of them is the possibility of non blocking write operations on channels. This means that the write method will not block until the write is done. But is it still provided that all writes are written in the same order as the writes are called even though the methods don't block?
tagged with: sockets
tagged with: io
tagged with: channel

http://stackoverflow.com/q/25080952
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25144280
downvote count: 0
has title: Call a method in MainActivity.java on event that happens in a library file
accepted answer: http://stackoverflow.com/a/25144280
tagged with: android
has body: I included the library Swipeable-Cards in my android project. In MainActvitiy.java the onCreate method includes something like that: SimpleCardStackAdapter adapter = new SimpleCardStackAdapter(this); //This should also be done on an event in the library class: adapter.add(new CardModel("Title2", "Description2 goes here", r.getDrawable(R.drawable.picture2))); Now, in the CardContainer.java (which belongs to the swipeable cards library) there is an event on which I want a new item added to the adapteradapter.add(...). The adapter was defined in the MainActvitiy.java as you can see above. How can I achieve this? I first thought about defining a new method in MainActivity and then calling it from my library-class, like that: public void callfromlibrary() { adapter.add(...); } However then the method and the adapter need to be defined static, additionally I don't know how to make this method of MainActivity available in CardContainer.java. I believe I need to create kind of a listener to check in the MainActivity what happens in CardContainer.java? I don't know how to do this. Any help is appreciated!
favorite count: 0
possible better answer: http://stackoverflow.com/a/25081270
has answer: http://stackoverflow.com/a/25081270

http://stackoverflow.com/comment/39010839
type: AnswerComment
has text: @TheLostMind Can you explain why this is not working? It appears to work for me.
type: Comment
comment on: http://stackoverflow.com/a/25074094
score: 0

http://stackoverflow.com/q/25092952
has comment: http://stackoverflow.com/comment/39045353
has body: I am working on a Java project where as you can see from the code below I have a JFormattedTextfield. What I would like to do is to introduce some tolerance in the date field. Like if the user inputs 02.02.2010 or 02.FEB.2010 or 02/02/2010, it shouldn't give an error. I am trying to search for something similar, but all I can find is examples of Simpledateformat telling to use predefined format. Kindly let me know or give some pointers. Thank you. DateFormat format = new SimpleDateFormat("dd/M/yyyy"); DateFormatter df = new DateFormatter(format); JFormattedTextField dateField = new JFormattedTextField(df);
score: 0
tagged with: java
tagged with: formatting
has title: Java date field tolerating different locales/mistakes
has comment: http://stackoverflow.com/comment/39046489
tagged with: locale
type: UnansweredQuestion
tagged with: date
has comment: http://stackoverflow.com/comment/39045816
has answer: http://stackoverflow.com/a/25094906
has comment: http://stackoverflow.com/comment/39045398
type: Question
has comment: http://stackoverflow.com/comment/39045724
answer count: 1
has comment: http://stackoverflow.com/comment/39045463

http://stackoverflow.com/comment/39242563
type: QuestionComment
score: 0
has text: debug log seems ok, maybe is impossible what am i trying to do(without a persistent db)? can i save the username and the passw encrypted in the cookie and in the next reboot read and authenticate automatically?
comment on: http://stackoverflow.com/q/25180467
type: Comment

http://stackoverflow.com/comment/39273147
comment on: http://stackoverflow.com/a/25195230
type: Comment
score: 0
type: AnswerComment
has text: Lol yes in a perfect world the DOM solution works flawlessly. But yes I'll post the code on Sunday (I'm not on my laptop right now). Saturday I have to take the kids to a party and excercise with the wife. You know how that goes lol...Family Guy

http://stackoverflow.com/q/25104556
has comment: http://stackoverflow.com/comment/39067637
has comment: http://stackoverflow.com/comment/39066683
has comment: http://stackoverflow.com/comment/39066991
has answer: http://stackoverflow.com/a/25105205
answer count: 2
tagged with: http-post
has comment: http://stackoverflow.com/comment/39066730
has comment: http://stackoverflow.com/comment/39067708
downvote count: 0
has comment: http://stackoverflow.com/comment/39066742
possible better answer: http://stackoverflow.com/a/73336636
has comment: http://stackoverflow.com/comment/39067535
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/73336636
has comment: http://stackoverflow.com/comment/39066773
has comment: http://stackoverflow.com/comment/39066756
tagged with: xmlhttprequest
has comment: http://stackoverflow.com/comment/39067606
has comment: http://stackoverflow.com/comment/39066795
accepted answer: http://stackoverflow.com/a/25105205
has body: Problem Description I'm trying to write a code which is sending POST request to the server. As server yet doesn't exist I can't test this part of code. With the request I must send XML as a String which look likes the string below: String XMLSRequest = "<?xml version="1.0" encoding="UTF-8" standalone="no"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header> Victor Apoyan </soapenv:Body></soapenv:Envelope>" Solution String url = "https://testurl.com/somerequest"; URL obj = new URL(url); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); //add reuqest header con.setRequestMethod("POST"); con.setRequestProperty("User-Agent", USER_AGENT); con.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); String urlParameters = String.format("request=%s", XMLSRequest); // Send post request con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); Question Is this right way to send String (XML like string) as POST request to the server?
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39066753
has title: JAVA Send Post Request which contains XML String
has comment: http://stackoverflow.com/comment/39067164
tagged with: post
type: Question
has comment: http://stackoverflow.com/comment/39066813
has comment: http://stackoverflow.com/comment/39066783
has comment: http://stackoverflow.com/comment/39066765

http://stackoverflow.com/comment/39051708
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25094877
has text: I don't know any tutorials for AWT, but you can check out the Swing Components [here](http://docs.oracle.com/javase/tutorial/uiswing/components/index.html). For custom painting [see here](http://docs.oracle.com/javase/tutorial/uiswing/painting/index.html). Like I said, switching from AWT to Swing isn't too difficult. Many times it's just a matter of adding a J in front of your component. See the tutorial. You'll see what I mean
score: 0

http://stackoverflow.com/a/25094242
answers question: http://stackoverflow.com/q/25094229
type: AcceptedAnswer
downvote count: 0
has body: You are not spawning a thread as you just call run method directly. You need to call start method instead. When you call start method, JVM spawns a new thread and calls the run method of the Runnable object. Calling run method directly is similar to calling any other normal method, no new thread.
type: Answer
has comment: http://stackoverflow.com/comment/39051692
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/25094229

http://stackoverflow.com/q/25212490
has comment: http://stackoverflow.com/comment/39267967
has body: I am new to all the encryption, hashing etc. I received email from my dba, telling me to read admin un, password from .properties file and it looks something like this: ldap.provider.admin.password=fc34f78f665b60c5b99bad0ee1b228269e10e9cdd81c1a Then in his email he specifies: ldap.provider.admin.password is actual password encrypted with “SHA256”. Telling me in my java programm I will have to decrypt this password in order to be able to use it. Is it me or does he have it confused with crypto hash algorithm? Can I actually get it decrypted?
tagged with: sha
type: Question
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/25212547
tagged with: java
has title: does my dba know what he is doing?
answer count: 1
favorite count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/39268222
has comment: http://stackoverflow.com/comment/39271419
downvote count: 0
has comment: http://stackoverflow.com/comment/39494568
accepted answer: http://stackoverflow.com/a/25212547
tagged with: encryption

http://stackoverflow.com/comment/57767134
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25126218
has text: Presumably you are trying to avoid the use of the ``web.xml`` and move your web app config into annotated java, rather than xml?
type: Comment

object
tags question: http://stackoverflow.com/q/25208904
tags question: http://stackoverflow.com/q/25087965
tag name: object
tags question: http://stackoverflow.com/q/25108447
tags question: http://stackoverflow.com/q/25105265
tags question: http://stackoverflow.com/q/25084286
tags question: http://stackoverflow.com/q/25079022
tags question: http://stackoverflow.com/q/25168396
tags question: http://stackoverflow.com/q/25213432
tags question: http://stackoverflow.com/q/25114491
tags question: http://stackoverflow.com/q/25146411
tags question: http://stackoverflow.com/q/25117839
tags question: http://stackoverflow.com/q/25175348
tags question: http://stackoverflow.com/q/25071871
tags question: http://stackoverflow.com/q/25162685
type: Tag
tags question: http://stackoverflow.com/q/25110438
tags question: http://stackoverflow.com/q/25130629
tags question: http://stackoverflow.com/q/25136042
tags question: http://stackoverflow.com/q/25083543

http://stackoverflow.com/a/25071279
has body: Instead : mEdit.setTitle();//ERROR try : mEdit.setTitle("A random Title");
downvote count: 0
answers question: http://stackoverflow.com/q/25071241
has comment: http://stackoverflow.com/comment/39005734
has comment: http://stackoverflow.com/comment/39005861
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39005749
type: Answer
has comment: http://stackoverflow.com/comment/39005136
accepted answer of: http://stackoverflow.com/q/25071241
score: 2

http://stackoverflow.com/comment/39089957
has text: Read this: ["Global variables in Java"](http://stackoverflow.com/questions/4646577/global-variables-in-java)
comment on: http://stackoverflow.com/q/25116778
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25092460
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39045089
has title: Using Apache POI in eclipse Juno
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has body: I am trying to develop an applicatio which needs to create,read and modify Excel sheets.So I have downloaded poi-bin-3.10-FINAL-20140208.tar.gz from http://poi.apache.org/download.html . I have followed this procedure to create the project. I have created a new java project named ApacheDemo. Right clicked the project -> Import -> General -> Existing Projects into workspace -> Select Archive file and browsed to the .tar.gz file . But it shows me "No projects are found to import" I have googled and tried an another method RIghtclick on project-> Properties -> Java Build Path -> Libraries -> Add external Jar -> browsed to poi-3.10-FINAL-20140208 This dint work too.Please Help me.
has answer: http://stackoverflow.com/a/25092873
score: 0
has answer: http://stackoverflow.com/a/25092553
tagged with: apache-poi

http://stackoverflow.com/q/25112623
answer count: 2
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/39081830
has comment: http://stackoverflow.com/comment/39081857
type: UnansweredQuestion
tagged with: path
has body: I want to know how can i directly append / at the end of path object. What i am doing right now is : - Paths.get("/Test/Location/",Group,database+"/"); I don't want to do it this way.Is there any other way through which we can directly append /.
has comment: http://stackoverflow.com/comment/39081801
score: -1
has answer: http://stackoverflow.com/a/25112666
tagged with: java
has comment: http://stackoverflow.com/comment/39081905
has comment: http://stackoverflow.com/comment/39081856
downvote count: 1
type: Question
has title: Path object ends with "/"
has answer: http://stackoverflow.com/a/25112767

http://stackoverflow.com/comment/39611963
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25378720
type: AnswerComment
has text: @ Manjunath Anand bro i have post that problem here it is working still some more correction needed and tell me if any better way possible.. here is link http://stackoverflow.com/questions/25397158/retrieve-image-or-any-document-from-database-using-mvc-pattern-in-java

http://stackoverflow.com/q/25220864
tagged with: http://stackoverflow.com/tag/csv
score: -3
has answer: http://stackoverflow.com/a/43588864
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39283628
has title: Arrays list in Java
tagged with: java
downvote count: 3
type: Question
possible better answer: http://stackoverflow.com/a/43588864
has answer: http://stackoverflow.com/a/25220906
accepted answer: http://stackoverflow.com/a/25220906
tagged with: arraylist
has body: I'm trying to insert data into a CSV file in Java, and i want to do it with an array list. Currently I'm inserting each line to the file with array list. How can i do it with a loop that running on arrays list? The main goal is to get the number of the rows as parameter, and then to let the loop to insert the data. That way i can control the number of the rows. Currently it's hard codded to 3 rows. Here is my code. How can i improve it? ArrayList&lt;String[]&gt; data = new ArrayList&lt;String[]&gt;(); data.add(new String[] {"1", "2", "3", "4", "5", "6"}); //line 1 data.add(new String[] {"1", "2", "3", "4", "5", "6"}); //line 2 data.add(new String[] {"1", "2", "3", "4", "5", "6"}); //line 3 writer.writeAll(data); //inserting the data into the CSV file
answer count: 2
upvote count: 0
favorite count: 0

http://stackoverflow.com/q/25154495
tagged with: infinite-loop
has body: I am wondering why is the following code allowed in Java, without getting compilation error? In my opinion, this code breaks method signature by not returning any String. Could someone explain what I'm missing here? public class Loop { private String withoutReturnStatement() { while(true) {} } public static void main(String[] a) { new Loop().withoutReturnStatement(); } }
tagged with: compilation
has answer: http://stackoverflow.com/a/25154535
upvote count: 66
has comment: http://stackoverflow.com/comment/39161649
has comment: http://stackoverflow.com/comment/39159712
has title: Infinite loop breaks method signature without compilation error
linked to: http://stackoverflow.com/q/16789832
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39167899
has comment: http://stackoverflow.com/comment/39199237
duplicate of: http://stackoverflow.com/q/16789832
favorite count: 0
has answer: http://stackoverflow.com/a/25154568
has comment: http://stackoverflow.com/comment/39163158
type: Question
answer count: 2
score: 65
accepted answer: http://stackoverflow.com/a/25154535
possible better answer: http://stackoverflow.com/a/25154568
has comment: http://stackoverflow.com/comment/39198454
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/39198519

http://stackoverflow.com/q/25079323
tagged with: bitmap
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39019665
type: Question
has comment: http://stackoverflow.com/comment/39026235
downvote count: 0
tagged with: arraylist
tagged with: android
has comment: http://stackoverflow.com/comment/39020000
has body: I have an ArrayList which stores a HashMap of Bitmaps, but when I try to display them with ListView adapter it shows this error(and yes I am absolutely sure that Uri is correct and links to an image): 08-01 14:03:53.103: E/BitmapFactory(7225): Unable to decode stream: java.io.FileNotFoundException: /android.graphics.Bitmap@656c2d18: open failed: ENOENT (No such file or directory) 08-01 14:03:53.103: I/System.out(7225): resolveUri failed on bad bitmap uri: android.graphics.Bitmap@656c2d18 Here's my code: ArrayList&lt;HashMap&lt;String, Bitmap&gt;&gt; imgList = new ArrayList&lt;HashMap&lt;String, Bitmap&gt;&gt;(); for(int i = 0; i &lt; jData.length(); i++) { JSONObject c = jData.getJSONObject(i); //get the imageURL and set it to string JSONObject images = c.getJSONObject(TAG_IMAGES); JSONObject thumbnail = images.getJSONObject(TAG_THUMBNAIL); String imageURL = thumbnail.getString(TAG_URL); //Decode Bitmap before putting in HashMap try { InputStream in = new java.net.URL(imageURL).openStream(); pic = BitmapFactory.decodeStream(in); } catch (Exception e) { Log.e("Error", e.getMessage()); e.printStackTrace(); } //create new HashMap HashMap&lt;String, Bitmap&gt; bitmap=new HashMap&lt;String, Bitmap&gt;(); //put HashMap in the ArrayList bitmap.put(TAG_PIC, pic); imgList.add(bitmap); } } catch (JSONException e) { e.printStackTrace(); } } else { Log.e("ServiceHandler", "Couldn't get any data from the url"); } return null; } // and finally display them in ImageView @Override protected void onPostExecute(Void result) { super.onPostExecute(result); // Dismiss the progress dialog if (pDialog.isShowing()) pDialog.dismiss(); /** * Updating parsed JSON data into ListView * */ ListAdapter adapter = new SimpleAdapter( ActivityMain.this, imgList, R.layout.list_item, new String[] { TAG_PIC }, new int[] { R.id.ivThumb }); setListAdapter(adapter); } I have also tried using for loop to go through all of the lv items and setting imageViews but it using this code it only sets the ImageView …
has comment: http://stackoverflow.com/comment/39023848
has comment: http://stackoverflow.com/comment/39024926
favorite count: 0
has comment: http://stackoverflow.com/comment/39022936
has title: Storing HashMap<String, Bitmap> in ArrayList - can't decode Bitmaps upon displaying
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/39182093
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25166160
type: Comment
has text: @DavidPostill I know how the exceptions works, and that posted helped me initially, but the real problem is that I have nested loops that both get edited, and I don't know how to keep the exception from being thrown for both

http://stackoverflow.com/comment/39214163
type: Comment
type: QuestionComment
has text: exactly ActionListener responds to an action. Triggering a specific time could also be an action. I am not using any swing or awt component like buttons or anything.
comment on: http://stackoverflow.com/q/25183873
score: 0

http://stackoverflow.com/a/25117071
type: Answer
has body: Explaining further on the above answer Suppose someone asked you give me ten coins and set the counter on the first coin to zero so in that case you are going to him him until the count reaches nine right. Same is the case here you have initialized i = 0 so you need to iterate it until the count reaches totalCount-1. Or change to this for (int i = 1; i &lt;= rsMD.getColumnCount(); i++)
score: 0
answers question: http://stackoverflow.com/q/25116783

activiti
tags question: http://stackoverflow.com/q/25117528
type: Tag
tag name: activiti
tags question: http://stackoverflow.com/q/25197356

http://stackoverflow.com/comment/39173954
type: Comment
score: 1
has text: @Kon - The OP isn't *overriding* anything as the question says :)
type: QuestionComment
comment on: http://stackoverflow.com/q/25162274

http://stackoverflow.com/comment/39155245
has text: if you are using a singleton database connection dont close it after transaction. close it when the server is closed or terminated. you can you servletcontext to achieve that
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25151693

http://stackoverflow.com/comment/39232910
comment on: http://stackoverflow.com/q/25193837
has text: http://commons.apache.org/proper/commons-lang/download_lang.cgi i am not sure, but i think i downloaded this one.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25086110
has comment: http://stackoverflow.com/comment/39121965
has answer: http://stackoverflow.com/a/25165660
type: Question
has comment: http://stackoverflow.com/comment/39072951
answer count: 2
possible better answer: http://stackoverflow.com/a/25122672
has answer: http://stackoverflow.com/a/25122672
has body: I'm new to ATG and I'm failing to do something that looks fairly simple. I'm trying to get an Order in the database by the number of the order. But this number is not the orderId so I can't just use the OrderManager.loadOrder method. This is the code I have so far: Repository orderRepository = getOrderManager().getOrderTools().getOrderRepository(); RepositoryView view = orderRepository.getView("order"); RqlStatement statement = RqlStatement.parseRqlStatement("orderNumber EQUALS ?0"); Object params[] = { pOrderNumber }; RepositoryItem items[] = statement.executeQuery(view, params); RepositoryItem order = null; if( (items != null) &amp;&amp; (items.length &gt; 0) ) { order = items[0]; } //Now I want to convert this order of type "RepositoryItem" to an actual Order object I can do this by getting the repository ID and calling loadOrder form the OrderManager, but that seems like going back to the database and finding again what I already have in my hands. Is there another way to get an actual Order object out of this RepositoryItem object?
has title: How to cast a RepositoryItem to an Order on ATG
score: 0
tagged with: atg
has comment: http://stackoverflow.com/comment/39115230
accepted answer: http://stackoverflow.com/a/25165660
has comment: http://stackoverflow.com/comment/39052023
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39114171

http://stackoverflow.com/q/25203729
favorite count: 0
has comment: http://stackoverflow.com/comment/39251127
tagged with: android
accepted answer: http://stackoverflow.com/a/25203923
has answer: http://stackoverflow.com/a/25203992
type: AnsweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39251032
type: Question
has answer: http://stackoverflow.com/a/25203923
score: -1
has comment: http://stackoverflow.com/comment/39251317
has body: I've managed to make it run to the point after the dialog is pressed, it runs the main UI, but eventually it crashed after I moved to another EditText. I'm not how do I use the onProgressUpdate() to make sure that my EditText are disabled accordingly. What I'm looking for is, if the user clicks Large Character, I want the program to check the ToggleButton condition with a While loop. If its still ON, I want it to basically check for the EditText focus and have some SetOnFocusChangeListener(); It gave me an error saying the Only the original thread that created a view hierarchy can touch its views. This is my main class in onCreate(): //Row 1-4 EditText row1TextField = (EditText) findViewById(R.id.row1); row2TextField = (EditText) findViewById(R.id.row2); row3TextField = (EditText) findViewById(R.id.row3); row4TextField = (EditText) findViewById(R.id.row4); //ToggleButton toggleButton = (ToggleButton) findViewById(R.id.toggle1); AlertDialog.Builder characterChoose = new AlertDialog.Builder(context); characterChoose.setTitle("Character Input Option"); characterChoose.setMessage("Please choose the option the below").setCancelable(false) .setPositiveButton("Large Character", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { toggleButton.setTextOn("LARGE"); toggleButton.setChecked(true); backgroundThread bckgnd = new backgroundThread(); bckgnd.execute(); } This is my AsyncTask class: private class backgroundThread extends AsyncTask&lt;Boolean, Boolean, Boolean&gt;{ //Run on background thread. @Override protected Boolean doInBackground(Boolean... params) { while(toggleButton.isChecked()) { if(row1TextField.isFocused()) { row2TextField.setEnabled(false); } row2TextField.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View textfield3, boolean isFocus) { if(textfield3.isFocused()) { row3TextField.setEnabled(false); } } }); row3TextField.setOnFocusChangeListener(new OnFocusChan…
possible better answer: http://stackoverflow.com/a/25203992
answer count: 2
downvote count: 1
has title: AysncTask doInBackground() with ToggleButton and EditText

http://stackoverflow.com/a/40049018
answers question: http://stackoverflow.com/q/25099640
has comment: http://stackoverflow.com/comment/106275014
has comment: http://stackoverflow.com/comment/77166070
has comment: http://stackoverflow.com/comment/80173321
has comment: http://stackoverflow.com/comment/92207629
has comment: http://stackoverflow.com/comment/106267669
has comment: http://stackoverflow.com/comment/87465077
type: Answer
has comment: http://stackoverflow.com/comment/92205697
has comment: http://stackoverflow.com/comment/92205982
has comment: http://stackoverflow.com/comment/77187690
has body: I see this is an old question, but I think something was missed here, that @nickdu attempted to point out but wasn't quite clear. There are four types of IO pertinent to this discussion: Blocking IO Non-Blocking IO Asynchronous IO Asynchronous Non-Blocking IO The confusion arises I think because of ambiguous definitions. So let me attempt to clarify that. First Let's talk about IO. When we have slow IO this is most apparent, but IO operations can either be blocking or non-blocking. This has nothing to do with threads, it has to do with the interface to the operating system. When I ask the OS for an IO operation I have the choice of waiting for all the data to be ready (blocking), or getting what is available right now and moving on (non-blocking). The default is blocking IO. It is much easier to write code using blocking IO as the path is much clearer. However, your code has to stop and wait for IO to complete. Non-Blocking IO requires interfacing with the IO libraries at a lower level, using select and read/write instead of the higher level libraries that provide convenient operations. Non-Blocking IO also implies that you have something you need to work on while the OS works on doing the IO. This might be multiple IO operations or computation on the IO that has completed. Blocking IO - The application waits for the OS to gather all the bytes to complete the operation or reach the end before continuing. This is default. To be more clear for the very technical, the system call that initiates the IO will install a signal handler waiting for a processor interrupt that will occur when the IO operation makes progress. Then the system call will begin a sleep which suspends operation of the current process for a period of time, or until the process interrupt occurs. Non-Blocking IO - The application tells the OS it only wants what bytes are available right now, and moves on while the OS concurrently gathers more bytes. The code uses select to determine what IO operations …
has comment: http://stackoverflow.com/comment/75101478
upvote count: 145
has comment: http://stackoverflow.com/comment/87421532
has comment: http://stackoverflow.com/comment/87465028
has comment: http://stackoverflow.com/comment/87464951
has comment: http://stackoverflow.com/comment/87465068
has comment: http://stackoverflow.com/comment/80824493
has comment: http://stackoverflow.com/comment/87464990
has comment: http://stackoverflow.com/comment/106259866
has comment: http://stackoverflow.com/comment/80823851
has comment: http://stackoverflow.com/comment/75101426
has comment: http://stackoverflow.com/comment/87464953
has comment: http://stackoverflow.com/comment/87465142
has comment: http://stackoverflow.com/comment/80833432
has comment: http://stackoverflow.com/comment/80833358
has comment: http://stackoverflow.com/comment/92205946
has comment: http://stackoverflow.com/comment/72351261
has comment: http://stackoverflow.com/comment/106304579
has comment: http://stackoverflow.com/comment/74692999
has comment: http://stackoverflow.com/comment/87465125
has comment: http://stackoverflow.com/comment/80833439
downvote count: 0
score: 145
has comment: http://stackoverflow.com/comment/80083460
has comment: http://stackoverflow.com/comment/69657086
has comment: http://stackoverflow.com/comment/80833204
has comment: http://stackoverflow.com/comment/80833108

http://stackoverflow.com/q/25132635
tagged with: polymorphism
has title: Feedback code review dealing Inheritance and Polymorphism for Java?
favorite count: 0
has comment: http://stackoverflow.com/comment/39126466
has comment: http://stackoverflow.com/comment/39119247
type: AnsweredQuestion
has body: I am working on a programming project dealing with Inheritance and Polymorphism. I just need that, someone can provide me a feedback of my work, in the meantime I want to thank you for your time in providing your feedback. The textbook question follows: Design a class named Triangle that extends to GeometricObject. The class contains: Three double data fields named side1, side2 and side3 with default values 1.0 to denote three sides. A no-arg constructor that creates a default triangle. A constructor that creates a triangle with the specified side1, side2 and side3. The accessor methods for all three data fields. A method named getArea() that returns the area of this triangle. A method named getPerimeter() that returns the perimeter of this triangle. a method named toString() that returns a string description for the triangle. The toString() method is implemented as follows: return Triangle: side1 = " + side1 + " side2= " side2 + "side3" + side3; Without taking in consideration for the GeometricObeject class, I only done the Triangle class and the test program so here is my code: public class Triangle extends GeometricObject { private double side1, side2, side3; private double base, height; public Triangle() { side1 = 1.0; side2 = 1.0; side3 = 1.0; } public Triangle(double side1, double side2, double side3, double base, double height) { this.side1 = side1; this.side2 = side2; this.side3 = side3; this.base = base; this.height = height; } public double getSide1() { return side1; } public double getSide2() { return side2; } public double getSide3() { return side3; } public double getBase() { return base; } public double getHeight() { return height; } public void setBase(double newBase) { base = newBase; } public void setHeight(double newHeight) { height = newHeight; } public void setSide1(double newSide1) { side1= newSide1; } public void setSide2(double newSide2) { side2= newSide2; } public void setSide3(double newSide3) { side3= newSide3; } public String toString() { …
tagged with: java
has answer: http://stackoverflow.com/a/25132830
upvote count: 1
downvote count: 1
type: Question
tagged with: inheritance
has comment: http://stackoverflow.com/comment/39119368
score: 0
accepted answer: http://stackoverflow.com/a/25132830
answer count: 1
has comment: http://stackoverflow.com/comment/39119240

http://stackoverflow.com/comment/39229688
score: 0
comment on: http://stackoverflow.com/q/25191918
type: QuestionComment
type: Comment
has text: I don't think that's happening. I've disabled caching at the moment, and in the logs it seems as if the session was even cleared when I access a "USER" secured path: `2014-08-07 16:58:36.931 INFO 2132 --- [nio-8080-exec-2] o.s.b.a.audit.listener.AuditListener : AuditEvent [timestamp=Thu Aug 07 16:58:36 EDT 2014, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null}]`

http://stackoverflow.com/q/25112462
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/25112628
downvote count: 0
has body: I am new to Android app development. I try to connect my app with facebook using SocialAuth SDK. but am getting a error as "no package identifier when getting value for resource number 0x00000000" and thread id=1: thread exiting with uncaught exception (group=0xb2a40ba8) then it goes to FATAL EXCEPTION: main. I have tried to clean and build the project, but nothing happens, still getting same errors. Can anyone help me to resolve this problem.?
has comment: http://stackoverflow.com/comment/39081589
accepted answer: http://stackoverflow.com/a/25112628
tagged with: android
tagged with: facebook
has comment: http://stackoverflow.com/comment/39081656
favorite count: 0
linked to: http://stackoverflow.com/q/25094724
upvote count: 1
has title: no package identifier when getting value for resource number 0x00000000
tagged with: socialauth
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39081720
has comment: http://stackoverflow.com/comment/39081765

http://stackoverflow.com/q/25211659
tagged with: android
tagged with: timer
accepted answer: http://stackoverflow.com/a/25211694
type: Question
type: AnsweredQuestion
has title: Toggle button does not turn off timer
tagged with: java
has body: I've got a timer set to excecute a task every 30 seconds for testing purposes and currently it turns on and the timer works but it doesn't toggle off and the task just keeps executing. Toggle Button Code @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Timer myTimer = new Timer(); MyTimerTask myTimerTask = new MyTimerTask(); if (isChecked) { myTimer.scheduleAtFixedRate(myTimerTask,0,30000); Toast.makeText(getBaseContext(),"Check-In will be done every 30 seconds",Toast.LENGTH_SHORT).show(); } else { myTimer.cancel(); Toast.makeText(getBaseContext(),"Manual Check-In enabled",Toast.LENGTH_SHORT).show(); } } This code is in the onCreate method toggler = (ToggleButton) findViewById(R.id.togglelocationupdate); toggler.setOnCheckedChangeListener(this); My MainActivity implements CompoundButton.OnCheckedChangeListener
answer count: 1
has answer: http://stackoverflow.com/a/25211694
score: 0

http://stackoverflow.com/comment/126059833
comment on: http://stackoverflow.com/q/25161074
type: QuestionComment
type: Comment
has text: Similar problem leads me here, do you get a solution?
score: 0

http://stackoverflow.com/a/25202533
downvote count: 0
score: 1
has body: If you address the class with fully qualified name such as com.myproject.bar.Foo, you need to specify it every time when you try to access that class. But in case of import, you dont need to. That's one of the advantages.
answers question: http://stackoverflow.com/q/25202223
upvote count: 1
type: Answer

http://stackoverflow.com/comment/67013201
type: AnswerComment
comment on: http://stackoverflow.com/a/25088382
type: Comment
score: 0
has text: Sorry Bastien, just a curiosity...You mean that if I have a JBoss instance running remotely, and if I configure Eclipse on two different laptop with the same Java Remote App configuration (socket attach way with same host and port), it means that is possible to debug concurrently on the same (for example same Java classes) JBoss server instance?

http://stackoverflow.com/comment/39837844
type: Comment
has text: Thank you for trying to help. This is a pure hibernate issue, not a general 'any applicatoin, with any framework' issue.
comment on: http://stackoverflow.com/a/25363868
score: 0
type: AnswerComment

http://stackoverflow.com/q/25115138
type: Question
linked to: http://stackoverflow.com/q/8593498
tagged with: inheritance
has comment: http://stackoverflow.com/comment/39086979
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25115187
accepted answer: http://stackoverflow.com/a/25115187
possible better answer: http://stackoverflow.com/a/25115221
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25115221
tagged with: java
has title: Confusion with subclasses and superclasses
has comment: http://stackoverflow.com/comment/39086642
has body: Master test = new Inner(); System.out.println(test.getClass()); In the above example the Inner class extends the Master class, but what I'm confused about is that test.getClass() returns Inner, but isn't test really of the type Master? Other than the constructor no methods/properties can be used from the Inner class, only what's in the Master class. Furthermore the constructor for Inner actually sets properties exclusive to Inner, but somehow these properties don't exist in test even though it uses the constructor -- which doesn't seem like it should work. For example if define the classes as: public class Master { public int number = 0; public Master() { number = 9; } } public class Inner extends Master { public int innerNumber = 0; public Inner() { number = 1; innerNumber = 2; } } test will use Inner's constructor which sets innerNumber, but test.innerNumber doesn't even exist because innerNumber isn't apart of the Master type. Also, test.getClass() says it's of the Inner type, not Master.

http://stackoverflow.com/comment/39270452
type: AnswerComment
has text: `The more you use static, the further you drift away from object orientation.` -1, this is a complete blanket statement. You're now introducing ownership conflicts, resulting in copied arrays and **redundant data**, which could cause more problems than it solves. The OP is perfectly fine looking for a static solution, assuming proper ownership of the array is handled.
score: 0
comment on: http://stackoverflow.com/a/25213817
type: Comment

http://stackoverflow.com/a/25214307
type: Answer
has body: You've called the methods public RAMDAOFactory() { log.trace("insdie RAMDAOFactory"); RAMUserDAO.getRAMUserDAO(); RAMTradeDAO.getRAMTradeDAO(); RAMLogDAO.getRAMLogDAO(); } but you haven't assigned their value to anything @Override public UserDAO getUserDAO() { return ramUserDAO; } Either always call RAMUserDao.getRAMUserDAO(); when you want to return the UserDAO or assign it to ramUserDAO and return that.
accepted answer of: http://stackoverflow.com/q/25214292
has comment: http://stackoverflow.com/comment/39271574
has comment: http://stackoverflow.com/comment/39271903
answers question: http://stackoverflow.com/q/25214292
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39283169
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25220611
has text: @jadbalout it should have been `activity_main.xml`. get hold of a tutorial

http://stackoverflow.com/q/25088095
has title: Designing WCF Async service with java interop
type: Question
tagged with: java
tagged with: interop
downvote count: 0
tagged with: .net
has body: I am looking for some feedback on the designing a WCF service, which invokes 2-4 other services and aggregates a response back to the client which is a Java based application. Although the number of requests expected are low, &lt;50 a day max, based on the long running nature of certain calls, I suppose it would be better to design it async but other than marking it async in operationcontract (as below), I am unsure what other features of .NET 4.5 can be leveraged for a scalable design. [ServiceContract] public interface IService2 { //IAsyncResult asynchronous pattern [OperationContractAttribute(AsyncPattern = true)] IAsyncResult BeginWorkerMethod(string message, AsyncCallback callback, object asyncState); string EndWorkerMethod(IAsyncResult result); } I would appreciate some help in suggestions on the design
favorite count: 0
tagged with: wcf
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/29329353
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/112909876
upvote count: 23
score: 23
has comment: http://stackoverflow.com/comment/63828529
has body: Yes, using Maven, Spring project with Java EE compliance we face this issue with Tomcat. To fix this problem please execute the list of commands to make the project as Java EE compliance. $ mvn eclipse:clean - to clean the eclipse files like .project .classpath $ mvn eclipse:eclipse -Dwtpversion=2.0 to create the eclipse compatible with Java EE. At last open the project in eclipse select the server tomcat now click run on servers(Alt+Shift+x,R) select tomcat7.0 to run.
answers question: http://stackoverflow.com/q/25087833

http://stackoverflow.com/comment/39057145
type: Comment
comment on: http://stackoverflow.com/a/25099270
type: AnswerComment
has text: @user2864740 Then the application is probably beeing terminated as with all uncaught excetions
score: 0

java-7
tags question: http://stackoverflow.com/q/25115335
tags question: http://stackoverflow.com/q/25205130
tags question: http://stackoverflow.com/q/25116658
tags question: http://stackoverflow.com/q/25077850
tag name: java-7
tags question: http://stackoverflow.com/q/25139508
type: Tag
tags question: http://stackoverflow.com/q/25094866
tags question: http://stackoverflow.com/q/25133363
tags question: http://stackoverflow.com/q/25223122
tags question: http://stackoverflow.com/q/25178763
tags question: http://stackoverflow.com/q/25177678
tags question: http://stackoverflow.com/q/25115866
tags question: http://stackoverflow.com/q/25093531
tags question: http://stackoverflow.com/q/25115059
tags question: http://stackoverflow.com/q/25190347
tags question: http://stackoverflow.com/q/25134706
tags question: http://stackoverflow.com/q/25166618
tags question: http://stackoverflow.com/q/25227794
tags question: http://stackoverflow.com/q/25215832

http://stackoverflow.com/comment/39255251
score: 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25205894
has text: It depends and there isn't.

http://stackoverflow.com/comment/39300797
type: QuestionComment
type: Comment
has text: Can you please simply remove x+ from your code and let me is it working ? And please keep in mind which regular exp. your using for split which is not include in splited array so plz check value of splited array then you getting exect idea.
comment on: http://stackoverflow.com/q/25230003
score: 0

http://stackoverflow.com/a/25113942
has body: I suspect you want this type of construct. // stop when any element evaluates to true boolean any = stream.anyMatch(t -&gt; t); You can check this with peek Stream.of(1, 2, 3, 4).peek(System.out::println).anyMatch(i -&gt; i == 2); prints 1 2 For a parallel example AtomicInteger count = new AtomicInteger(); IntStream.range(0, 1000).parallel().peek(t -&gt; count.incrementAndGet()).anyMatch(i -&gt; i == 2); System.out.println("count: " + count); prints a number like count: 223 The exact number varies. For a referencePipeline, the anyMatch calls @Override public final boolean anyMatch(Predicate&lt;? super P_OUT&gt; predicate) { return evaluate(MatchOps.makeRef(predicate, MatchOps.MatchKind.ANY)); } which calls this public static &lt;T&gt; TerminalOp&lt;T, Boolean&gt; makeRef(Predicate&lt;? super T&gt; predicate, MatchKind matchKind) { Objects.requireNonNull(predicate); Objects.requireNonNull(matchKind); class MatchSink extends BooleanTerminalSink&lt;T&gt; { MatchSink() { super(matchKind); } @Override public void accept(T t) { if (!stop &amp;&amp; predicate.test(t) == matchKind.stopOnPredicateMatches) { stop = true; value = matchKind.shortCircuitResult; } } } return new MatchOp&lt;&gt;(StreamShape.REFERENCE, matchKind, MatchSink::new); } where you can start to see the short circuiting code.
has comment: http://stackoverflow.com/comment/39084453
has comment: http://stackoverflow.com/comment/39085387
score: 20
type: AcceptedAnswer
upvote count: 20
has comment: http://stackoverflow.com/comment/118633013
type: Answer
accepted answer of: http://stackoverflow.com/q/25113748
has comment: http://stackoverflow.com/comment/39085518
answers question: http://stackoverflow.com/q/25113748
downvote count: 0
has comment: http://stackoverflow.com/comment/39084306

http://stackoverflow.com/comment/39238032
comment on: http://stackoverflow.com/a/25196617
score: 0
type: Comment
has text: I don't understand how can some people simple down vote without analyzing things
type: AnswerComment

http://stackoverflow.com/q/25204539
has body: I am new to Java and have taken a course fundamentals for it. Currently I am using vaadin as my framework to create a simple webapp but am running into problems with implementing the accordion. I would like some pointers in my code, there is an error with casting accordion to component in the main app. My current code so far: Main java class: package Main; import UI.Accordiontest; import com.vaadin.ui.SplitPanel; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; public class test extends Application { private SplitPanel horizontalSplit = new SplitPanel( SplitPanel.ORIENTATION_HORIZONTAL); private Accordiontest accordion = new Accordiontest(this); public void init() { buildMainLayout(); } private void buildMainLayout () { // error: cast accordion to Component horizontalSplit.setFirstComponent(accordion); //error end setMainWindow(new Window("test))' VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.addComponent(horizontalSplit); layout.setExpandRatio(horizontalSplit, 1); getMainWindow().setContent(layout); UI accordiontest: package UI; import Main.test; import com.vaadin.ui.Accordion; import com.vaadin.ui.Label; public class Accordiontest extends test{ public Accordiontest(test app) { final Accordion accordion = new Accordion(); for (int i = 0; i &lt; 5; i++) { VerticalLayout layout = new VerticalLayout(); accordion.addCOmponent(layout); layout.setCaption("tab" + (i + 1)); Label label = new Label("These are the contents of Tab " + (i + 1) + "."); layout.addComponent(label); TextField textfield = new TextField("some text field"); layout.addComponent(textfield); } } } thanks!
type: AnsweredQuestion
tagged with: java
has title: Implementing Accordion using Vaadin 6
type: Question
tagged with: vaadin
has answer: http://stackoverflow.com/a/25207742
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25207742

http://stackoverflow.com/q/25123245
has comment: http://stackoverflow.com/comment/39101974
tagged with: editor
has comment: http://stackoverflow.com/comment/39102217
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/25123495
has comment: http://stackoverflow.com/comment/39101869
has title: After update to Ubuntu 14.04 Eclipse error detection and auto-completion do not work
tagged with: ubuntu-14.04
tagged with: ubuntu
score: 0
answer count: 1
type: UnansweredQuestion
has body: After the update to Ubuntu 14.04, the error detection and auto-suggestion of Eclipse do not work, or they work in the wrong way. For example, it does not suggest local variables, like if they are not defined. Or the dot symbol . to access a method (e.g. myobj.methodName() ) is considered a wrong token. The language I am using is Java, and the Eclipse I downloaded has the plugin for Java. I also updated to Eclipse Luna, but the behaviour is the same. How is it possible? Maybe did the upgrade remove some essential package for Eclipse?

soa
type: Tag
tag name: soa
tags question: http://stackoverflow.com/q/25155577
tags question: http://stackoverflow.com/q/25115232

http://stackoverflow.com/q/25096127
has title: Openshift JNDI jdbc
type: UnansweredQuestion
tagged with: openshift
type: Question
tagged with: jndi
has answer: http://stackoverflow.com/a/25123580
tagged with: java
has body: Im trying to get connection to my database(MYSQL) in openshift, using JNDI. Once i get connection i make my transactions by jdbc connection. I dont use hibernate, or any kind of container, just simple JDBC with statments,etc.. I looked to my standalone.xml, and like always that file has a datasource mysql, so i wrote my code like this. String jndiName = "java:jboss/datasources/MySQLDS"; Context ic = new InitialContext(); Object obj = ic.lookup(jndiName); javax.sql.DataSource ds = (javax.sql.DataSource) obj; Connection con = ds.getConnection(); Commited my code to openshift server and tryied to execute my code. First time i got connection for my database, but the second time,third,and so on, i got an error, saying that datasource doesnt exist.. Edit: error log Unable to get managed connection for "java:jboss/datasources/MySQLDS"
tagged with: mysql
answer count: 1
score: 0
tagged with: jdbc

http://stackoverflow.com/a/28753641
type: Answer
answers question: http://stackoverflow.com/q/25150931
has body: To get the heightmap information from the image, you simply code: try { BufferedImage height = ImageIO.read(new File("utah.jpg")); hm = new double[height.getHeight()][height.getWidth()]; for (int row = 0; row &lt; height.getHeight(); row++) { for (int col = 0; col &lt; height.getWidth(); col++) { hm[row][col] = (height.getRGB(col, row) &amp; 255) / 255.0; } } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } To draw the points, you just do the following(translate from JOGL to LWJGL): gl.glPushMatrix(); for (int x = 0; x &lt; (257 - 1); x++) { gl.glBegin(GL.GL_TRIANGLE_STRIP); for (int z = 0; z &lt; (257 - 1); z++) { double[] row = hm[0]; double y = hm[(x * hm.length) % 10][(z + row.length) % 10] * 5; gl.glColor3d(1, 1, 1); gl.glVertex3d(x, y, z); //gl.glTexCoord3d(x, y, z); y = hm[((x + 1) * hm.length) % 10][((z + 1) + row.length) % 10] * 5; gl.glColor3d(1, 1, 1); gl.glVertex3d(x + 1, y, z + 1); //gl.glTexCoord3d(x + 1, y, z + 1); } gl.glEnd(); } gl.glPopMatrix();
score: 0

http://stackoverflow.com/comment/39223787
type: Comment
has text: I could use Spring Rest Template. Thanks.
comment on: http://stackoverflow.com/a/25088372
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39021244
type: Comment
type: QuestionComment
has text: @nafas it seems they are separated by spaces, according to `String[] strings = s.split(" ");`
comment on: http://stackoverflow.com/q/25080269
score: 0

http://stackoverflow.com/q/25214905
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25216272
tagged with: apache-mina
tagged with: java
type: Question
score: 0
answer count: 2
has body: How could i connect to my server in Apache Mina using spring mvc xml configuration? i have this configuration in my server this will bind my acceptor to port 8000 right? how about in my client side? how could i connect to my server in port 8000? how could i configure my IoConnector in my xml file?
tagged with: spring
possible better answer: http://stackoverflow.com/a/33558513
has answer: http://stackoverflow.com/a/33558513
has answer: http://stackoverflow.com/a/25216272
has title: apache mina connection using spring
tagged with: spring-mvc

http://stackoverflow.com/comment/41866498
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25113154
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/63858/discussion-between-samuli-karkkainen-and-m-deinum).
type: Comment

http://stackoverflow.com/q/25162082
type: Question
score: 0
upvote count: 1
downvote count: 1
favorite count: 0
tagged with: cucumber-jvm
has comment: http://stackoverflow.com/comment/39173618
has title: Whats wrong with this step / method?
has body: For the feature Feature: One Scenario Outline: Validate Given ["&lt;a&gt;"|"&lt;b&gt;"|"&lt;c&gt;"|"&lt;d&gt;"|"&lt;e&gt;"|"&lt;f&gt;"|"&lt;g&gt;"|"&lt;h&gt;"|"&lt;i&gt;"|"&lt;j&gt;"|"&lt;k&gt;"|"&lt;l&gt;"] Examples: | a | b | c | d | e | f | g | h | i | j | k | l | .... Auto generated step is @Given("^\\[\"(.*?)\"|\"(.*?)\"|\"(.*?)\"|\"(.*?)\"|\"(.*?)\"|\"(.*?)\"|\"(.*?)\"|\"(.*?)\"|\"(.*?)\"|\"(.*?)\"|\"(.*?)\"|\"(.*?)\"\\]$") public void (String arg1, String arg2, String arg3, String arg4, String arg5, String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12) throws Throwable { ... } but this method is not recognized. In IntelliJ, error Variable 'String' is already defined in scope for args (2,4,6,8,10 and 12) is thrown. Even spaces in method definiton (e.g. space between void and ( throws identifier expected. Whats wrong with this method?.
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39173665
has comment: http://stackoverflow.com/comment/39174599
has comment: http://stackoverflow.com/comment/39174652
tagged with: java

http://stackoverflow.com/comment/39242334
comment on: http://stackoverflow.com/q/25177437
has text: @rohit31dec91, we need to see the definition of the number and of the types of arguments the `calcuate` method has so please edit your question and show that information.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39179877
has text: *"I have a self-signed certificate (in the future I'll get an official one)"* - Try [Startcom](http://www.startcom.org/) or [CAcert](http://www.cacert.org/). They offer free Class 1 server certificates. The certificates are trusted by most desktop and mobile browsers. Class 1's are domain validated via email and *don't* allow wildcards. If you need a wildcard, then you'll have to purchase a Class 2 or higher. Startcom and CAcert charge for revocation, if needed.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25161886

permissions
tag name: permissions
tags question: http://stackoverflow.com/q/25163174
type: Tag
tags question: http://stackoverflow.com/q/25070041

http://stackoverflow.com/comment/39185302
type: AnswerComment
has text: You can reference the [Java Virtual Machine Specification](http://docs.oracle.com/javase/specs/jvms/se7/html/).
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25168121

http://stackoverflow.com/comment/39266960
type: QuestionComment
has text: For FHIR gForge read-only access, use "anonymous" with your email address as the password. And if you use gForge, make sure that you use the DSTU branch if you are using the DSTU
comment on: http://stackoverflow.com/q/25209559
type: Comment
score: 0

http://stackoverflow.com/comment/39021857
comment on: http://stackoverflow.com/q/25080320
has text: you can put example for this (remember a have 4 class for i can save only A or only B or ongly C and D)
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25169474
answer count: 1
has title: Add bundled maven project as external jar
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/39188646
has body: I have a maven project that depends on another maven project which is not available on a public repo. Let's call them projects A and B, and A depends on B. I'm currently pulling in B in project A by declaring it as an external dependency which I've placed inside an in project repo. (I call mvn bundle:bundle in project B and just copy the generated jar over to project A) The problem is, by doing this maven can't infer which dependencies B relies on since it's a bundled jar. Let's suppose both projects A and B rely on another maven project C which is available on the remote maven repository. Project A uses project C, version 0.2 and project B uses project C, version 0.1. However, since project B is being loaded in project A as an external bundled jar, maven doesn't know this. During run time, project A tries to call a method which exists in C 0.2 but not in C 0.1. However maven built the project by importing project B first then C as the remote dependency, so C 0.2 is not in the bundled project A jar, and we get a runtime methodNotFound error. Any idea how I can deal with this? Is it possible to just include a pom.xml file with the bundled project B jar somehow so maven knows that B relies on C as a dependency and can sort the issue out itself? The way I'm currently working around this is just by manually setting the build order outside of maven and not using it at all for compilation. EDIT: OK I got it to work by just including a (artifactId)-(version).pom file in the same directory as the jar for maven to get a dependency list
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/25173896
has answer: http://stackoverflow.com/a/25170092
has comment: http://stackoverflow.com/comment/39188745
tagged with: jar
score: 0

http://stackoverflow.com/comment/39305138
score: 0
type: QuestionComment
type: Comment
has text: your "ClassLoader" folder is at the root of the JAR ? To retrieve the path ----> System.getProperty("user.dir")
comment on: http://stackoverflow.com/q/25228371

http://stackoverflow.com/comment/43088426
type: QuestionComment
type: Comment
has text: Have you got your answer? I got the same error and can't find the solution except to change datatype of that variable to String instead of enum
comment on: http://stackoverflow.com/q/25113293
score: 0

http://stackoverflow.com/q/25135007
has title: metrics-spring configuration via .properties file
tagged with: spring
type: AnsweredQuestion
has body: I'm trying to configure metrics-spring via configuration file In my spring.xml I've added classpath:metrics.properties filled with something like metrics.reporter.type=console and then I'm setting it in the spring config accessing that property via ${metrics.reporter.type} <metrics:reporter metric-registry="metrics" type="${metrics.reporter.type}" period="1m"/> During the startup of the web application, spring throws a BeanDefinitionParsingException due to the unresolved variable above Configuration problem: No ReporterElementParser found for reporter type '${metrics.reporter.type}' I'm using this configuration method (via properties file) for mongo host and port and it works like a charm. I'm running in Tomcat7, Spring 4.0.5.RELEASE, metrics framework 3.1.0-SNAPSHOT (I need jersey 2 support) and metrics-spring 3.0.1. I also tried with a self-compiled metrics-spring 3.1.0-SNAPSHOT but doesn't solve my problem. [EDIT] Found this issue which explain that SpEL is not supported by the ElementParser.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39124205
has comment: http://stackoverflow.com/comment/39124266
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/39124524
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/39124040
tagged with: jersey-2.0
has comment: http://stackoverflow.com/comment/39124400
favorite count: 0
tagged with: metrics
has comment: http://stackoverflow.com/comment/39124352
has answer: http://stackoverflow.com/a/25212670
accepted answer: http://stackoverflow.com/a/25212670

http://stackoverflow.com/a/25100342
has comment: http://stackoverflow.com/comment/39059710
answers question: http://stackoverflow.com/q/25099640
has comment: http://stackoverflow.com/comment/41634441
type: AcceptedAnswer
has body: So what is actually "non-blocking async IO"? To answer that, you must first understand that there's no such thing as blocking async I/O. The very concept of asynchronism dictates that there's no waiting, no blocking, no delay. When you see non-blocking asynchronous I/O, the non-blocking bit only serves to further qualify the async adjective in that term. So effectively, non-blocking async I/O might be a bit of a redundancy. There are mainly two kinds of I/O. Synchronous and Asynchronous. Synchronous blocks the current thread of execution until processing is complete, while Asynchronous doesn't block the current thread of execution, rather passing control to the OS Kernel for further processing. The kernel then advises the async thread when the submitted task is complete Asynchronous Channel Groups The concept of Async Channels in java is backed by Asynchronous Channel Groups. An async channel group basically pools a number of channels for reuse. Consumers of the async api retrieve a channel from the group (the JVM creates one by default) and the channel automatically puts itself back into the group after it's completed its read/write operation. Ultimately, Async Channel Groups are backed by surprise, threadpools. Also, Asynchronous channels are threadsafe. The size of the threadpool that backs an async channel group is configured by the following JVM property java.nio.channels.DefaultThreadPool.initialSize which, given an integer value will setup a threadpool of that size, to back the channel group. The channel group is created and maintained transparently to the developer otherwise. And how all them can be implemented in Java Well, I'm glad you asked. Here's an example of an AsynchronousSocketChannel (used to open a non-blocking client Socket to a listening server.) This sample is an excerpt from Apress Pro Java NIO.2, commented by me: //Create an Asynchronous channel. No connection has actually been established yet AsynchronousSocketChannel asynchronousSocketChann…
accepted answer of: http://stackoverflow.com/q/25099640
upvote count: 67
score: 64
type: Answer
has comment: http://stackoverflow.com/comment/39060077
has comment: http://stackoverflow.com/comment/81382667
has comment: http://stackoverflow.com/comment/66536866
has comment: http://stackoverflow.com/comment/108494310
has comment: http://stackoverflow.com/comment/39059770
has comment: http://stackoverflow.com/comment/41668307
downvote count: 3
has comment: http://stackoverflow.com/comment/106259516

http://stackoverflow.com/q/25073997
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25074094
downvote count: 0
has answer: http://stackoverflow.com/a/25074175
has comment: http://stackoverflow.com/comment/39010407
possible better answer: http://stackoverflow.com/a/25074175
accepted answer: http://stackoverflow.com/a/25074094
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/39009738
has body: I have a snippet of code that creates 3 threads and expect them to print sequentially using synchronized block on the integer object. But apparently I am getting deadlock sometimes. See below: public class SequentialExecution implements Runnable { private Integer i = 1; public void run() { String tmp = Thread.currentThread().getName(); if (tmp.equals("first")) { synchronized(i) { first(); i = 2; } } else if (tmp.equals("second")) { while (i != 2); synchronized(i) { second(); i = 3; } } else { while (i != 3); synchronized(i) { third(); } } } public void first() { System.out.println("first " + i); } public void second() { System.out.println("second " + i); } public void third() { System.out.println("third " + i); } public static void main(String[] args) { //create 3 threads and call first(), second() and third() sequentially SequentialExecution se = new SequentialExecution(); Thread t1 = new Thread(se, "first"); Thread t2 = new Thread(se, "second"); Thread t3 = new Thread(se, "third"); t3.start(); t2.start(); t1.start(); } } The result I am expecting(and sometimes getting) is: first 1 second 2 third 3 One sample result I am getting with deadlock(and eclipse hangs) is: first 1 second 2 Anyone know why this is not working? I know I can use locks but I just don't know why using synchronized block is not working.
tagged with: multithreading
has title: Sequential execution of threads using synchronized
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39010344

http://stackoverflow.com/a/25191557
has body: I decided to roll this method: public static String extractPayload(String a,String tag) { if(a=="" || a==null ) { return a; } String beginTag="&lt;"+tag,endTag="&lt;/"+tag+"&gt;"; int i,j,l; i=a.indexOf(beginTag); l=endTag.length(); j=a.indexOf(endTag); if(i&gt;=0 &amp;&amp; i&lt;j) { a=a.substring(i,j+l); } return a; }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25172233

http://stackoverflow.com/a/25204726
answers question: http://stackoverflow.com/q/25204615
downvote count: 0
has body: The javadoc on Runtime.addShutdownHook has quite a bit of detail about this: Shutdown hooks run at a delicate time in the life cycle of a virtual machine and should therefore be coded defensively. They should, in particular, be written to be thread-safe and to avoid deadlocks insofar as possible. They should also not rely blindly upon services that may have registered their own shutdown hooks and therefore may themselves in the process of shutting down. Attempts to use other thread-based services such as the AWT event-dispatch thread, for example, may lead to deadlocks.
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/39024771
has text: Commenting code should always be a last resort--to be used only when you are doing something so evil that there is no other way to explain it: Before I add comments I would try wrapping the ReadWriteLock in another class with a class name and method names that explain what's going on.
comment on: http://stackoverflow.com/a/25079437
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/40597224
downvote count: 0
type: Answer
score: 11
upvote count: 11
answers question: http://stackoverflow.com/q/25087833
has body: If you are getting "Tomcat version 7.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 and 6 Web modules" error when trying to add project to Tomcat 7. Simply, Right click on the project --> go to project facets --> uncheck the dymanic web module (which should be 3.1)--> apply --> then change the dynamic web module to 3.0 --> apply and then save. Try to add now and it should work.

http://stackoverflow.com/a/25101971
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: hmmm... So you can do disable the Android Package Builder (right-click on project#Properties#Builders) use ant for build and deployment of apk. see android-workaround-for-slow-building-workspace-problem-in-eclipse for details 2.ADT 21 pre-dex all libraries. This means regular compilation only re-dex the output of your project (faster) and then merges the result with the pre-dexed libraries (pretty quick).
answers question: http://stackoverflow.com/q/25101899

http://stackoverflow.com/a/25189596
has body: It looks to me that you are trying to zoom into your actual game environment. You can achieve this without setting the scale to every object in your game. If you implement a camera (since you are using libgdx) you can simply zoom into your game at 2x and it will give you a scaled view of you game. Follow this tutorial and experiment! https://github.com/libgdx/libgdx/wiki/Orthographic-camera
answers question: http://stackoverflow.com/q/25187947
score: 0
type: Answer

http://stackoverflow.com/comment/39207502
type: Comment
has text: @Amz : ok then there are 2 ways, one is to check like a said or second one is other answer given by the : Vipul Paralikar.
comment on: http://stackoverflow.com/a/25177666
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39176637
type: Comment
comment on: http://stackoverflow.com/q/25163488
score: 0
has text: Do you have your own class called Connection? if not you may import something else. check the imports
type: QuestionComment

http://stackoverflow.com/q/25215274
has answer: http://stackoverflow.com/a/25218702
has comment: http://stackoverflow.com/comment/39274931
answer count: 1
has body: I have to create a custom realm in Shiro and I have to use a password with "salt" The code I use is something like: protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { ... Admin admin = query.getByUsername(username); String passwordSalted = admin.getPassword(); SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(username, passwordSalted, new SimpleByteSource(MY_PRIVATE_SALT), getName()); return info; } public Admin createAdmin(AuthenticationToken authenticationToken){ DefaultHashService hashService = new DefaultHashService(); hashService.setHashIterations(500000); hashService.setHashAlgorithmName(Sha256Hash.ALGORITHM_NAME); hashService.setPrivateSalt(new SimpleByteSource(MY_PRIVATE_SALT)); // Same salt as in shiro.ini, but NOT base64-encoded. hashService.setGeneratePublicSalt(true); DefaultPasswordService passwordService = new DefaultPasswordService(); passwordService.setHashService(hashService); String encryptedPassword = passwordService.encryptPassword(authenticationToken.getCredentials()); Admin admin = new Admin(); String principal = authenticationToken.getPrincipal().toString(); admin.setUsername(principal); admin.setPassword(encryptedPassword); return admin; } I use the function "createAdmin" to create a Admin, then I store it in the database, like this: UsernamePasswordToken u = new UsernamePasswordToken("foo","qwerty") ; Admin admin = createAdmin(u); query.save(admin); The password saved is something like: $shiro1$SHA-256$50000$M7T93MZ65TCxXBsD7JFa9A==$gJcEf2oSKE/RKXifwYiJCaHU7X10ng1PxqL3AEMvmjE= I don't know why it failed to authenticated: Factory&lt;SecurityManager&gt; factory = new IniSecurityManagerFactory("classpath:shiro.ini"); SecurityManager securityManager = factory.getInstance(); SecurityUtils.setSecurityManager(securityManager); AuthenticationToken authenticationToken = new UsernamePasswordToken("foo", "qwerty"); Subject usr = SecurityUtils.getSubject(); try { secu…
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has title: failed in the authentication using Shiro
has comment: http://stackoverflow.com/comment/39274347
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39274139
type: Question
tagged with: shiro
has comment: http://stackoverflow.com/comment/39274679
downvote count: 0
has comment: http://stackoverflow.com/comment/39273869
has comment: http://stackoverflow.com/comment/39274072

http://stackoverflow.com/comment/53549108
comment on: http://stackoverflow.com/a/32610967
type: AnswerComment
score: 0
type: Comment
has text: small comment, your textview doesn't have to be in a linearlayout. it can be the only view in the xml.

http://stackoverflow.com/comment/39276416
comment on: http://stackoverflow.com/q/25216951
type: Comment
type: QuestionComment
has text: Please check answer given by me on this (question)[http://stackoverflow.com/questions/25182540/error-when-persisting-entity-with-foreign-key-field/25186366#25186366] he also want the same solution like you, selecting foreign key from select box and at the time save he don't want to save in foreign entity, I guess I m right?
score: 0

http://stackoverflow.com/comment/39294003
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25226458
has text: we may did any mistake in configuration check it
score: 0

http://stackoverflow.com/a/25140365
answers question: http://stackoverflow.com/q/25140203
type: Answer
has body: You can probably affect your listener to a variable and assign it to views : OnClickListener listener = new OnClickListener(){ @Override public void onClick(View v) { Toast.makeText(v.getContext(),"button clicked",Toast.LENGTH_SHORT).show(); } }; view1.setOnClickListener(listener); view2.setOnClickListener(listener);
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/a/25140194
has comment: http://stackoverflow.com/comment/39211134
answers question: http://stackoverflow.com/q/25132605
score: 0
has body: I am not sure if selenium supports the :not() pseudo selector. You may want to try something like this: List&lt;WebElement&gt; anchors = driver.findElements( By.css("#myDiv :not(.skip1) a, #myDiv &gt; a") ); Instead of using :not(.skip1) you can also use something like :not(table). I am not that familiar with the :not() yet. It maybe that the selector above matches something like &lt;div id="myDiv&gt; &lt;div class="skip1"&gt; &lt;div class="evilDivMaybeBypassingTheNotPart"&gt;&lt;a href="..."&gt;...&lt;/a&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; accidently. Here's a fiddle to play around with: http://jsfiddle.net/fabian_barney/ad4vuaf9/ Another fiddle with your HTML code: http://jsfiddle.net/fabian_barney/n5Lcg9ar/2/
has comment: http://stackoverflow.com/comment/39211726
type: Answer
has comment: http://stackoverflow.com/comment/39211322

http://stackoverflow.com/comment/39169296
type: AnswerComment
type: Comment
has text: thats a bit more complicated. But it is no longer a Swing issue. Its just plain arrayList manipulation. If you have more than one checkbox checked, then you are going to run into a number of issues.
comment on: http://stackoverflow.com/a/25159940
score: 0

http://stackoverflow.com/comment/39011145
type: Comment
type: QuestionComment
has text: post the code where you loop it.
score: 0
comment on: http://stackoverflow.com/q/25074893

http://stackoverflow.com/comment/39219181
score: 0
type: Comment
has text: I am not hiding anything from here. I've posted all the complete setup in my local machine. Actually this 'Integer' thing is an existing project setup & the trouble was identified recently. So I tested the issue by creating the local setup only with the piece of code that is suspected to cause the trouble. And fortunately that is replicated too. :( And for your @Value question, we are using some dynamic configurations to populate the bean value in xml file during deployment (the value varies between different environments, so it's been setup like this)
type: QuestionComment
comment on: http://stackoverflow.com/q/25186326

http://stackoverflow.com/q/25091221
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25091246
has comment: http://stackoverflow.com/comment/39050790
type: Question
has answer: http://stackoverflow.com/a/25091246
answer count: 1
score: 4
favorite count: 0
has title: Convert Java-Based Configuration to Spring XML-based
has body: I'm trying to convert Birt application done in java annotation to XML based but 'am having difficulties changing this part to xml @Bean public BirtViewResolver birtViewResolver() throws Exception { BirtViewResolver bvr = new BirtViewResolver(); bvr.setBirtEngine(this.engine().getObject()); bvr.setViewClass(HtmlSingleFormatBirtView.class); bvr.setDataSource(this.birtDataServiceConfiguration.dataSource()); bvr.setReportsDirectory("Reports"); bvr.setOrder(2); return bvr; } I tried this but couldn't figure out how to set birtEngine, viewClass, and dataSource part &lt;beans:bean id="birtViewResolver" class="org.eclipse.birt.spring.core.BirtViewResolver"&gt; &lt;beans:property name="birtEngine" value="?" /&gt; &lt;beans:property name="viewClass" value="?" /&gt; &lt;beans:property name="dataSource" value="?" /&gt; &lt;beans:property name="reportsDirectory" value="Reports" /&gt; &lt;beans:property name="order" value="2" /&gt; &lt;/beans:bean&gt; Thank you in advance
upvote count: 4
tagged with: http://stackoverflow.com/tag/xml
tagged with: birt
tagged with: spring
has comment: http://stackoverflow.com/comment/39055355
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/comment/39249591
score: 0
type: AnswerComment
has text: @user1613360: That's not what your question says. You've said: "I am converting it to x = 1333.212... * 10^1200". What do you think that "* 10^1200" would do?
type: Comment
comment on: http://stackoverflow.com/a/25203071

http://stackoverflow.com/a/25102729
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: The JAva languages uses the algorithm that is documented in java.util.Random. There it also states that all implementations must use this algorithm seed = (seed * 0x5DEECE66DL + 0xBL) &amp; ((1L &lt;&lt; 48) - 1); return (int)(seed &gt;&gt;&gt; (48 - bits)); Hence it is not true for Java that "which algorithm a particular language uses varies".
answers question: http://stackoverflow.com/q/25101994

http://stackoverflow.com/a/25101392
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25101383
has body: Because you can't update the caller's reference in the called method (the change is local) and arrays are immutable. Just return the new reference and update it in the caller. public static String[] reverse(String[] list) { String[] temp = new String[list.length]; for (int i = 0; i &lt; list.length; i++) { temp[i] = list[list.length - i - 1]; } return temp; } Then in main() simpsons = reverse(simpsons); When I run it, I get the expected output Apu Flanders Homer Or, on further consideration you could be efficient and reverse() the array in place - public static void reverse(String[] list) { for (int i = 0; i &lt; list.length / 2; i++) { String t = list[list.length - i - 1]; list[list.length - i - 1] = list[i]; list[i] = t; } } Which also works here.
answers question: http://stackoverflow.com/q/25101383
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39061383
type: Answer

http://stackoverflow.com/a/25194611
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/39234339
has comment: http://stackoverflow.com/comment/39234628
has comment: http://stackoverflow.com/comment/39234275
has body: You can't pass an Object to a "thread that created this object", but you can pass it to a thread that invoked the execute() method, which would be the normal definition of the currently running thread case RUNNING_THREAD: // pass the runnable to the thread that created this object runnable.run(); break; The "main" thread doesn't exist as a concept in Java, sorry, you can't do that one. (What I mean is the main thread doesn't get stored specially so you can access it. There's a main startup thread of course, but it's not special.)
has comment: http://stackoverflow.com/comment/39234428
has comment: http://stackoverflow.com/comment/39234348
has comment: http://stackoverflow.com/comment/39243070
type: Answer
has comment: http://stackoverflow.com/comment/39234330
answers question: http://stackoverflow.com/q/25194582
score: 2

http://stackoverflow.com/comment/49207605
type: Comment
has text: `driver.findElement(By.id("upload1")).sendKeys(filePath);` works!. But I used `String filePath = System.getProperty("user.dir") + "/src/resources/test.pdf";` to get absolute file path of the file
comment on: http://stackoverflow.com/a/25199048
type: AnswerComment
score: 0

http://stackoverflow.com/q/25199404
has title: set unique identifier for RunningTaskInfo
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/59842532
has body: I am writing an Android App recently and I create several activities using FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_MULTIPLE_TASKS. And I want to get the info of these new tasks(as well as activities)by using getRunningTasks. Also I want to set some unique identifiers for these tasks in order to manage them conveniently. I have tried to use the description, but it can not be modified.Codes are as followed: ActivityManager am = (ActivityManager)this.getSystemService(ACTIVITY_SERVICE); List&lt;ActivityManager.RunningTaskInfo&gt; taskInfos = am.getRunningTasks(2); ActivityManager.RunningTaskInfo currentTaskInfo = taskInfos.get(0); am.getRunningTasks(2).get(0).description = "dfasdfsa"; Toast.makeText(this,am.getRunningTasks(2).get(0).description, 10).show(); When the Toast shows, the value of description is still null.I seems I can not change it. Please give me a solution to set a unique identifier for a task. I really appreciate your help! :)
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/39077607
score: 0
type: Comment
type: QuestionComment
has text: Sorry, but I do not assume anything, I am trying to learn to persist object in database using JPA and facing this issue
comment on: http://stackoverflow.com/q/25110240

http://stackoverflow.com/comment/39255753
type: Comment
has text: this is create an overhead on memory, the application will always be loaded in memory, if you restart your system, your application will be lost.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25206074

http://stackoverflow.com/q/25222145
has comment: http://stackoverflow.com/comment/39285950
has title: Comparison with == in Java
has answer: http://stackoverflow.com/a/25222186
accepted answer: http://stackoverflow.com/a/25222166
upvote count: 3
score: 0
tagged with: java
answer count: 2
has body: public static void main(String[] args) throws FileNotFoundException, IOException { Integer a = 120; Integer b = 120; Integer c = 130; Integer d = 130; System.out.println(a==b); //true System.out.println(c==d); //false } This behavior confused me. Can anyone explain it?
downvote count: 3
tagged with: comparison
linked to: http://stackoverflow.com/q/3131136
linked to: http://stackoverflow.com/q/3130311
has answer: http://stackoverflow.com/a/25222166
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/3131136
favorite count: 0
has comment: http://stackoverflow.com/comment/39285869
type: Question
possible better answer: http://stackoverflow.com/a/25222186

http://stackoverflow.com/comment/39111255
comment on: http://stackoverflow.com/q/25128056
has text: Take a look at [Packaging Programs in JAR Files](http://docs.oracle.com/javase/tutorial/deployment/jar/) for more details
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25072190
downvote count: 0
answers question: http://stackoverflow.com/q/25071872
upvote count: 2
has body: It sounds like you have a number of hurdles to overcome: How to use Eclipse How to manage Java dependencies How to use Spring I'm not sure what your level of experience is, but you may wish to consider using Spring Tool Suite as your IDE - it's based on Eclipse with additonal plugins to aid Spring development. I also urge you to use Maven or Gradle to manage your dependencies. The Spring documentation provides the configuration for adding the dependencies in both. I'd recommend Maven as a starting point as it is easy to use with little knowledge and is well suited to small, standard projects. Gradle is worth a look once you are comfortable with Maven. Work though the Guides - I'd start with 'Building Java Projects with Maven'. Edit Maven is a dependency management and build tool that favours convention over configuration. Dependency management is powerful in that you can declare a dependency on Spring Core, for example, and it will download all the related dependencies for you. Gradle performs similar functions to Maven but also provides the ability to use scripting. Gradle is seen by many as Maven's predecessor and has been adopted by Spring over Maven. In my opinion Maven is easier for you at this stage.
has comment: http://stackoverflow.com/comment/39006601
type: Answer
score: 2

http://stackoverflow.com/comment/93091720
score: 1
comment on: http://stackoverflow.com/a/25116598
type: AnswerComment
type: Comment
has text: Java 9 onwards, `javac` creates the output directory if it doesn't exist.

http://stackoverflow.com/comment/39301169
type: AnswerComment
comment on: http://stackoverflow.com/a/25230199
score: 0
type: Comment
has text: If you want i can write the code i spoke of in a new answer

http://stackoverflow.com/comment/39262131
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25209166
type: AnswerComment
has text: I am not sure I understand what you mean by 'methods called in version classes in their superclass'?

http://stackoverflow.com/a/25092022
upvote count: 1
has body: If you use java.util.Properties class to load the config file, you will get the following result: {company=My Company, age=22, user={, name="Jack", }=, num_users=3} The reason, you could refer to the javaDoc for "public void load(Reader reader)" method of Properties class. Since you don't describ the detailed syntax format for your config file, base on your example input, the following sample code could retrive the name=value correctly: String reg="(\\w+)\\s*=\\s*((?&gt;\\{[^\\{\\}]*\\})|(?&gt;.*$))"; Pattern pMod = Pattern.compile(reg, Pattern.MULTILINE); Matcher mMod = pMod.matcher(line); while (mMod.find()) { System.out.println(mMod.group(1)); System.out.println(mMod.group(2)); } The output is: company My Company num_users 3 user { name="John" age=24 } user { name="Anna" age=27 } user { name="Jack" age=22 }
accepted answer of: http://stackoverflow.com/q/25091818
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25091818
type: Answer

http://stackoverflow.com/comment/42982057
type: Comment
has text: So sorry I only got around to it now, but it works like a charm, thank you very much! I went with the Filter based approach, as tenants and databases are in a many-to-many relationship.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25418873

http://stackoverflow.com/q/25202707
has title: Compare hash values stored in text file in Java
upvote count: 0
has body: I have a text file that stores hash values of files generated in a Java program and I would like to write Java codes to compare the hash values stored in the file to see if they match or not. For example, the text file (md5.txt) contains the following: File: file.doc Hash: 0dcf2e7a00cf1b9673ddc7b699e93aa9 File: file-copy.doc Hash: 0dcf2e7a00cf1b9673ddc7b699e93aa9 The hash values are on lines 2 and 4. Therefore, is it possible to compare alternate lines such as 2 and 4, 6 and 8 and so on?
type: UnansweredQuestion
tagged with: lines
favorite count: 0
has comment: http://stackoverflow.com/comment/39248977
type: Question
tagged with: compare
has answer: http://stackoverflow.com/a/25202875
answer count: 2
downvote count: 3
has answer: http://stackoverflow.com/a/25202740
tagged with: java
tagged with: alternate
score: -3

http://stackoverflow.com/comment/39271260
has text: You are completely going wrong way. Please post your complete and code and update your question. M not sure where to help you. You are asking different questions. Sometimes about declaration and sometimes about other. Please be stable. And let me see your exact code up to now. thank you
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25213916

http://stackoverflow.com/q/25075389
type: Question
upvote count: 5
tagged with: java
score: 5
answer count: 3
tagged with: functional-programming
downvote count: 0
has answer: http://stackoverflow.com/a/25076331
has body: I want to transfer a stream of objects to different objects depending on a type. For example : Stream&lt;Animal&gt; animals = Arrays.stream(Arrays.asList(new Animal("A"),new Animal("B"))); Stream result = animals.map(animal) -&gt;{ switch (animal.getType()) { case "A" : return new Bird(animal); case "B" : return new LION(animal); case "C" : return new Tiger(animal); case "D" : return new FISH(animal); } } Is this an functional-programming "anti-pattern"? Can I achive the above differently with functional programming? (Remark: I also don't like is that every time I add a new type I have to update all my switch statements)
has answer: http://stackoverflow.com/a/25076292
favorite count: 0
has title: Should I use the java Stream.map Function together with an switch statement?
possible better answer: http://stackoverflow.com/a/25076292
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25076331
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/25075656

http://stackoverflow.com/q/25147096
has body: I've built a class named ConvertToPdf, and used the following commands to compile&amp;run it : javac -cp C:/Users/Itamar/Desktop/JARs/aspose-cells.jar;C:/Users\Itamar/Desktop/JARs/aspose-slides.jar;C:/Users\Itamar/Desktop/JARs/aspose-words.jar ConvertToPdf.java java -cp .;C:/Users/Itamar/Desktop/JARs/aspose-cells.jar;C:/Users/Itamar/Desktop/JARs/aspose-slides.jar;C:/Users/Itamar/Desktop/JARs/aspose-words.jar ConvertToPdf It worked just fine on Windows, but when I tried to run the same commands in Linux (I've replaced the ; with : as needed ),the first one with the javac also works fine , but the second ends with : Could not find or load main class. I'd like to know what changes I have to make in order to make it run properly. I'd be grateful if anyone could point me to the solution, thanks in advance.
has comment: http://stackoverflow.com/comment/39146635
has comment: http://stackoverflow.com/comment/39146711
tagged with: linux
tagged with: javac
has comment: http://stackoverflow.com/comment/39149757
has answer: http://stackoverflow.com/a/25147154
answer count: 1
has comment: http://stackoverflow.com/comment/39150600
tagged with: shell
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/39146511
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/39146514
has title: Java - Could not find or load main class - Only on Linux
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/39157323
type: Question
has comment: http://stackoverflow.com/comment/39152500

http://stackoverflow.com/q/25157198
type: UnansweredQuestion
tagged with: android
has body: The toast that says not reachable is not showing up, but all the above are showing up, why does my code stop execution on that line? if (msg_from.equals(MainActivity.PHONENUMBER)){ if (msgBody.startsWith("Your")){ //have seen this toast Toast.makeText(context, "Yes!!", Toast.LENGTH_SHORT).show(); //have seen this toast LocationManager imLoca = SysService.locationMan; Toast.makeText(context, "Yes 2!!", Toast.LENGTH_SHORT).show(); //have seen boolean gpsEnabled = imLoca.isProviderEnabled(LocationManager.GPS_PROVIDER); Toast.makeText(context, "not reachable", Toast.LENGTH_SHORT).show(); //but this does not show up, and any thing after this line is not working; boolean netOn = imLoca.isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (gpsEnabled){ //do some thing } else if (netOn){ //do some thing } else{ Toast.makeText(context, "Failing", Toast.LENGTH_SHORT).show(); } } }
has comment: http://stackoverflow.com/comment/39164874
has comment: http://stackoverflow.com/comment/39164619
tagged with: java
has title: Java Android Toast not showing after boolean declaration
has comment: http://stackoverflow.com/comment/39164975
type: Question
linked to: http://stackoverflow.com/q/23353173
has comment: http://stackoverflow.com/comment/39164713
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39164602
has comment: http://stackoverflow.com/comment/39164608
tagged with: toast
has answer: http://stackoverflow.com/a/25157972
has comment: http://stackoverflow.com/comment/39165157
has comment: http://stackoverflow.com/comment/39164609
has answer: http://stackoverflow.com/a/25158130

http://stackoverflow.com/q/25168586
linked to: http://stackoverflow.com/q/6764035
has answer: http://stackoverflow.com/a/25169036
tagged with: linux
answer count: 3
has body: I am using Apache HttpClient 4 to communicate with a REST API and most of the time I do lengthy PUT operations. Since these may happen over an unstable Internet connection I need to detect if the connection is interrupted and possibly need to retry (with a resume request). To try my routines in the real world I started a PUT operation and then I flipped the Wi-Fi switch of my laptop, causing an immediate total interruption of any data flow. However it takes a looong time (maybe 5 minutes or so) until eventually a SocketException is thrown. How can I speed up to process? I'd like to set a timeout of maybe something around 30 seconds. Update: To clarify, my request is a PUT operation. So for a very long time (possibly hours) the only operation is a write() operation and there are no read operations. There is a timeout setting for read() operations, but I could not find one for write operations. I am using my own Entity implementation and thus I write directly to an OutputStream which will pretty much immediately block once the Internet connection is interrupted. If OutputStreams had a timeout parameter so I could write out.write(nextChunk, 30000); I could detect such a problem myself. Actually I tried that: public class TimeoutHttpEntity extends HttpEntityWrapper { public TimeoutHttpEntity(HttpEntity wrappedEntity) { super(wrappedEntity); } @Override public void writeTo(OutputStream outstream) throws IOException { try(TimeoutOutputStreamWrapper wrapper = new TimeoutOutputStreamWrapper(outstream, 30000)) { super.writeTo(wrapper); } } } public class TimeoutOutputStreamWrapper extends OutputStream { private final OutputStream delegate; private final long timeout; private final ExecutorService executorService = Executors.newSingleThreadExecutor(); public TimeoutOutputStreamWrapper(OutputStream delegate, long timeout) { this.delegate = delegate; this.timeout = timeout; } @Override public void write(int b) throws IOException { executeWithTimeout(() -&gt; { delegate.write(b)…
has comment: http://stackoverflow.com/comment/39596669
accepted answer: http://stackoverflow.com/a/25411657
has answer: http://stackoverflow.com/a/25492364
downvote count: 0
favorite count: 0
tagged with: apache-httpclient-4.x
tagged with: sockets
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: timeout
has title: Faster detection of interrupted connections during PUT operation with Apache 'HttpClient'
has answer: http://stackoverflow.com/a/25411657
has comment: http://stackoverflow.com/comment/39595496
type: Question
has comment: http://stackoverflow.com/comment/39599941
possible better answer: http://stackoverflow.com/a/25169036

android-asynctask
tags question: http://stackoverflow.com/q/25109851
tags question: http://stackoverflow.com/q/25140012
tags question: http://stackoverflow.com/q/25200193
tags question: http://stackoverflow.com/q/25228109
tags question: http://stackoverflow.com/q/25130289
type: Tag
tags question: http://stackoverflow.com/q/25226506
tags question: http://stackoverflow.com/q/25115677
tag name: android-asynctask
tags question: http://stackoverflow.com/q/25125856
tags question: http://stackoverflow.com/q/25121686
tags question: http://stackoverflow.com/q/25111839
tags question: http://stackoverflow.com/q/25087216
tags question: http://stackoverflow.com/q/25218504
tags question: http://stackoverflow.com/q/25122097
tags question: http://stackoverflow.com/q/25102316
tags question: http://stackoverflow.com/q/25127720
tags question: http://stackoverflow.com/q/25121743
tags question: http://stackoverflow.com/q/25082631
tags question: http://stackoverflow.com/q/25229685
tags question: http://stackoverflow.com/q/25143657
tags question: http://stackoverflow.com/q/25106880
tags question: http://stackoverflow.com/q/25227125
tags question: http://stackoverflow.com/q/25140857
tags question: http://stackoverflow.com/q/25218853
tags question: http://stackoverflow.com/q/25145738
tags question: http://stackoverflow.com/q/25155031

http://stackoverflow.com/a/25209512
type: Answer
has body: Use Hibernate Tools Reverse Engineering. It doesn't parse raw SQL files, but can connect to a SQL database, and generate Java POJOs from your schema. http://docs.jboss.org/tools/4.1.0.Final/en/hibernatetools/html_single/index.html#refeng_codegen It won't make parameterized constructors for you out-of-the-box, but you could customize its templates, or use Lombok: http://projectlombok.org/features/Constructor.html Frankly, I'd go the other way. Update the database schema from Java POJOs. Why? Database Table Inheritance. It's easy to declare using JPA, but there's no common pattern for declarative table inheritance in SQL.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25208493
answers question: http://stackoverflow.com/q/25208493
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/a/50470493
downvote count: 0
has body: Just found a bit simpler solution using JPQL. I stole part of the example from @zbig's answer: @Entity public class Address { @Id int id; String street; } @Entity public class Person { @Id int id; String name; Address address; } public class PersonDTO { String name; String street; public PersonDTO(String name, String street) { this.name = name; this.street = street; } } List&lt;PersonDTO&gt; listOfPersons = em.createQuery("select new com.example.PersonDTO(p.name, a.street) " + "from Person p, Address a " + "WHERE p.address.id=a.id", PersonDTO.class).getResultList(); The benefit of this solution is that you don't need to use the @SqlResultSetMapping annotation, which must be placed on any entity class, not the DTO class! And that's sometimes confusing because the entity class could only be partially related (when joining multiple tables for example). More info here
score: 10
answers question: http://stackoverflow.com/q/25179180
has comment: http://stackoverflow.com/comment/116922365
upvote count: 10
type: Answer

http://stackoverflow.com/a/25115271
upvote count: 30
has body: File -> Settings -> Compiler -> Java Compiler -> Project bytecode version -> 1.7
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25115059
accepted answer of: http://stackoverflow.com/q/25115059
type: Answer
score: 30
downvote count: 0

http://stackoverflow.com/a/25292722
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25167256
has body: Please refer to PS 3.3 section C.11.2.1.2 of the DICOM Standard for explanation of Window Center and Window Width. This section includes pseudo code showing how to apply Window Level to extended grayscale image (e.g. over 8 bits per pixel gray value in the pixel data element). Also, note that you may need to apply the Modality LUT transformation if dataset contains Rescale Slope (0028, 1053) and Rescale Intercept (0028, 1052) before applying the VOI LUT transformation (e.g. applying Window Center and Window Width). Please refer to table C.11-1b under section C.11.1 for information on how to apply Modality LUT transformation.
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/25167256
score: 2

http://stackoverflow.com/comment/39282622
type: Comment
has text: @MZAmin: you should realize that the performance of my server, using the technology I chose, on my network and hardware, and executing my business logic, has nothing to do with the performance of your server, running your logic on your hardware and network. If your server computes the meaning of life and sends back 5 MBs of data at each request, on a Pentium 2, on a 4kbits/sec network, it will obviously be much slower than computing the sum of 1 and 1, on a gigabit network and a cluster of 8 16-core machines.
type: QuestionComment
comment on: http://stackoverflow.com/q/25220281
score: 0

junit
tags question: http://stackoverflow.com/q/25103532
type: Tag
tags question: http://stackoverflow.com/q/25173524
tags question: http://stackoverflow.com/q/25213920
tags question: http://stackoverflow.com/q/25105175
tags question: http://stackoverflow.com/q/25151697
tags question: http://stackoverflow.com/q/25138354
tags question: http://stackoverflow.com/q/25132318
tags question: http://stackoverflow.com/q/25225390
tags question: http://stackoverflow.com/q/25208727
tags question: http://stackoverflow.com/q/25110240
tags question: http://stackoverflow.com/q/25197986
tags question: http://stackoverflow.com/q/25101884
tags question: http://stackoverflow.com/q/25120796
tag name: junit
tags question: http://stackoverflow.com/q/25085141
tags question: http://stackoverflow.com/q/25163853
tags question: http://stackoverflow.com/q/25219233
tags question: http://stackoverflow.com/q/25183041
tags question: http://stackoverflow.com/q/25201015
tags question: http://stackoverflow.com/q/25191083
tags question: http://stackoverflow.com/q/25170372
tags question: http://stackoverflow.com/q/25130386
tags question: http://stackoverflow.com/q/25079008
tags question: http://stackoverflow.com/q/25187922
tags question: http://stackoverflow.com/q/25203136
tags question: http://stackoverflow.com/q/25115789
tags question: http://stackoverflow.com/q/25087257
tags question: http://stackoverflow.com/q/25189281
tags question: http://stackoverflow.com/q/25125059
tags question: http://stackoverflow.com/q/25180697
tags question: http://stackoverflow.com/q/25213027
tags question: http://stackoverflow.com/q/25120820
tags question: http://stackoverflow.com/q/25195214
tags question: http://stackoverflow.com/q/25162501
tags question: http://stackoverflow.com/q/25122414
tags question: http://stackoverflow.com/q/25187016

http://stackoverflow.com/q/25073130
has comment: http://stackoverflow.com/comment/39008203
answer count: 4
has answer: http://stackoverflow.com/a/25073219
tagged with: c++
has answer: http://stackoverflow.com/a/25073404
tagged with: java
has answer: http://stackoverflow.com/a/25073245
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/39008025
score: 0
has answer: http://stackoverflow.com/a/25073922
has comment: http://stackoverflow.com/comment/39008066
tagged with: windows
has comment: http://stackoverflow.com/comment/39009680
has body: I'm testing my company software project and would like to see how it works under heavy load conditions. Is there anyway to create a task that takes up a big amount of CPU and only stops if I tell it to? If it's not programmatically possible, what are other options? E.g. what software and input out there can quickly help me create such condition? Thanks in advance.
type: UnansweredQuestion
tagged with: python
has title: Create a task that takes up a specific amount of CPU and RAM

http://stackoverflow.com/comment/39244928
has text: @zaratustra I am not able to run this statement through Prepared statement It is giving exception in java program .
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25197664

http://stackoverflow.com/comment/39014197
comment on: http://stackoverflow.com/a/25075864
has text: Just realized, that this approach will not work if your tests are linking classes from `submodule1` (i.e. they are **compile time** dependencies for test classes). Surefire is responsible for test execution, not compilation. What my approach can only do is to make sure `submodule1` is on the classpath when running tests.
type: AnswerComment
score: 0
type: Comment

joystick
type: Tag
tag name: joystick
tags question: http://stackoverflow.com/q/25216703

http://stackoverflow.com/q/25207582
favorite count: 0
has answer: http://stackoverflow.com/a/25207705
type: UnansweredQuestion
has body: I am trying to create a calculator. It may not be the most efficient way but I would like help on what I have done so far. package me.Nelsin.Calculator; import java.text.DecimalFormat; import java.util.Scanner; public class Calculator { public static void main(String args[]) { double answer; //2 numbers System.out.println("Enter your first number: "); Scanner fnumb = new Scanner(System.in); double fnum = fnumb.nextDouble(); System.out.println("Enter your operation, *, /, +, -: "); Scanner operation = new Scanner(System.in); String op = operation.nextLine(); System.out.println("Enter your second number: "); Scanner snumb = new Scanner(System.in); double snum = snumb.nextDouble(); //Answers if(op.equals("*")) { answer = fnum * snum; DecimalFormat df = new DecimalFormat("#.##"); System.out.println(df.format(answer)); } if (op.equals("/")) { answer = fnum / snum; DecimalFormat df = new DecimalFormat("#.##"); System.out.println(df.format(answer)); } if (op.equals("+")) { answer = fnum + snum; DecimalFormat df = new DecimalFormat("#.##"); System.out.println(df.format(answer)); } if (op.equals("-")) { answer = fnum - snum; DecimalFormat df = new DecimalFormat("#.##"); System.out.println(df.format(answer)); } System.out.println("Enter your operation, *, /, +, -: "); Scanner operation2 = new Scanner(System.in); String op2 = operation2.nextLine(); System.out.println("Enter your third number here: "); Scanner tnumb = new Scanner(System.in); double tnum = tnumb.nextDouble(); if (op2.equals("*")) { double answer2 = answer * tnum; DecimalFormat df = new DecimalFormat("#.##"); System.out.println(answer2); } } } So my error is here: double answer2 = answer * tnum; I believe its because answer is not set until the user runs the program. The error: The local variable may have not been initialised.
has title: How to use the value of a string that is yet to be set by scanner/system.in - Java
has answer: http://stackoverflow.com/a/25207710
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/25207655
downvote count: 1
type: Question
score: 0
answer count: 3

http://stackoverflow.com/comment/39003383
score: 1
comment on: http://stackoverflow.com/q/25070375
has text: An array with size 200M doesn't found efficient. You can't polish biological waste.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39219902
score: 0
comment on: http://stackoverflow.com/a/25186531
type: AnswerComment
type: Comment
has text: Thanks, I already knew about JodaTime, but I don't want one more dependency in my project only to do this once in the whole code. Anyway, the second link answers my question: there's no JodaTime's `PeriodType` equivalent in Java Time API.

http://stackoverflow.com/q/25179330
type: AnsweredQuestion
has title: Stresstest Memory on Android
tagged with: java
type: Question
tagged with: testing
has comment: http://stackoverflow.com/comment/39205578
possible better answer: http://stackoverflow.com/a/55736340
has answer: http://stackoverflow.com/a/25179730
accepted answer: http://stackoverflow.com/a/25179730
has answer: http://stackoverflow.com/a/55736340
score: 0
answer count: 2
has body: Is it possible to stresstest an Android system to check what happens if available memory decreases (and therefor which applications are killed, ...). I currently have a testing application that periodically allocates 10MB in a vector. But an OutOfMemory exception is thrown reaching 500MB. But the system under test was not influenced sufficiently. I need to aquire even more memory. Are there any known libraries/programs to use or is there any other method that let an application use more memory than 500MB. Add: I'm already using android:largeHeap="true" in my manifest.
tagged with: stress-testing
tagged with: android

http://stackoverflow.com/comment/39151231
comment on: http://stackoverflow.com/q/25149412
has text: @PauloLeite `short[]` is an "array type". And being non-T[]/Object[], this special primitive handling is still relevant.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25076110
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/39013525
has comment: http://stackoverflow.com/comment/39013965
tagged with: java
has comment: http://stackoverflow.com/comment/39013816
has comment: http://stackoverflow.com/comment/39014527
type: Question
has body: I have conflict two persistence.xml file one of them server configuration with filter and other test configuration. When I run the test sometimes maven uses server jpa configuration and ignores test configuration. What is solution in this case qwe conf.prop src/test/resources conf true
has comment: http://stackoverflow.com/comment/39014818
tagged with: jpa
score: 0
has title: conflict two persistence.xml
has comment: http://stackoverflow.com/comment/39016940
answer count: 0

http://stackoverflow.com/q/25159297
has answer: http://stackoverflow.com/a/25159369
type: Question
has comment: http://stackoverflow.com/comment/39168175
tagged with: java
possible better answer: http://stackoverflow.com/a/25159474
has answer: http://stackoverflow.com/a/25159474
answer count: 3
has answer: http://stackoverflow.com/a/25159522
accepted answer: http://stackoverflow.com/a/25159369
favorite count: 0
has comment: http://stackoverflow.com/comment/39167996
has title: Casting Double to Integer
type: AnsweredQuestion
has body: I am running into a casting issue. I cannot seem to figure out the problem since everything appears to be in order. I understand that to explicitly cast from the Double wrapper class to the Integer wrapper class it can be done however, my compiler does not recognize it. Am I missing something obvious? The exact error I'm getting is : "Inconvertible types; cannot cast 'double' to 'java.lang.Integer'. Thanks for your help! private HashMap&lt;String, Integer&gt; shortestPath(String currentVertex, Set&lt;String&gt; visited) { double tempVal = Double.POSITIVE_INFINITY; String lowestVertex = ""; Map&lt;String, Integer&gt; adjacentVertex = this.getAdjacentVertices(currentVertex); HashMap&lt;String, Integer&gt; lowestCost = new HashMap&lt;String, Integer&gt;(); for(String adjacentNames : adjacentVertex.keySet()) { Integer vertexCost = adjacencyMap.get(currentVertex).get(adjacentNames); if(!visited.contains(adjacentNames) &amp;&amp; (vertexCost &lt; tempVal)) { lowestVertex = adjacentNames; tempVal = vertexCost; } } lowestCost.put(lowestVertex, (Integer)tempVal); return lowestCost; }
linked to: http://stackoverflow.com/q/5404149
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39168241
has comment: http://stackoverflow.com/comment/39168045
downvote count: 1

http://stackoverflow.com/comment/39155372
score: 0
type: Comment
has text: It is, and 123134235-(480993*256) = 27.
comment on: http://stackoverflow.com/a/25151957
type: AnswerComment

http://stackoverflow.com/q/25105330
accepted answer: http://stackoverflow.com/a/25105371
tagged with: swing
type: AnsweredQuestion
tagged with: java
has title: Refresh JTable after adding records in an easier way than using a TableModel or fireRowValueChanged() methods
type: Question
tagged with: user-interface
answer count: 1
has answer: http://stackoverflow.com/a/25105371
tagged with: awt
tagged with: jtable
score: 0
has body: I am doing a simple JTable program which doesn't have any serious code. Just the basic ones. Here is my code fragment import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JTable; public class SampleClass implements ActionListener{ JFrame frame; JTable table; JButton button; String columnName[] = {"Science"}; String rowName[][] = new String[10][1]; int i; public static void main(String args[]) { SampleClass obj = new SampleClass(); obj.setRowValues(); obj.build(); } public void build() //Constructing GUI { frame = new JFrame(); frame.setSize(400, 400); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); table = new JTable(rowName, columnName); table.setFillsViewportHeight(true); button = new JButton("New Value"); frame.getContentPane().add(table, BorderLayout.NORTH); frame.getContentPane().add(button, BorderLayout.SOUTH); frame.setVisible(true); } public void setRowValues() //Setting initial row values { for (i = 0 ; i &lt; 5 ; i++) { rowName[i][0] = i + " First"; } } public void actionPerformed(ActionEvent arg0) { //Incrementing rowValues and repainting with no effect rowName[i][0] = "New Value"; i++; table.repaint(); } } Here my problem is when I click on button an extra value is added inside rowName[][] array. I want this to be reflected into the JTable table. I tried repaint() but it doesn't help. Please tell me the easiest way to update or refresh JTable I have seen other stackoverflow entries which uses AbstractTableModel and calling fireRowValueChanged() methods. Here I using just the basics.

http://stackoverflow.com/q/25197322
type: AnsweredQuestion
score: 1
tagged with: scala
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25197681
possible better answer: http://stackoverflow.com/a/25197681
has answer: http://stackoverflow.com/a/25197425
answer count: 2
has title: List of upcoming Six months including this month
downvote count: 0
accepted answer: http://stackoverflow.com/a/25197425
favorite count: 0
has body: i can get the current month in this format by val dateFormat: SimpleDateFormat = new SimpleDateFormat("YYYYMM") dateFormat.format(new Date())//201408 but how get List(201408,201409,201410,201411,201412,201501)
tagged with: datetime
has comment: http://stackoverflow.com/comment/39239310
has comment: http://stackoverflow.com/comment/39239472

http://stackoverflow.com/comment/39280942
comment on: http://stackoverflow.com/q/25219394
type: QuestionComment
type: Comment
score: 1
has text: What about setting up all your directions using an enumerable type and calling the .name() or .toString() method on it in your return? http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html

http://stackoverflow.com/q/25101884
tagged with: java
has title: Is it possible to create a JUnit Rule inside an interface
type: Question
upvote count: 3
answer count: 1
tagged with: junit
has body: I'm trying to create test automation suite using JUnit. For all the tests, I want to create a Rule, for this I have created an Interface and placed the Rule inside it. Any tests that I want to run will have to implent that interface. It didn't throw any compiler error, however, when my Test class implements that interface, this doesn't seem to work. Following is the Interface I created. public interface IBaseTest { @Rule public TestRule test = new TestWatcher(){ @Override protected void starting(Description description) { System.out.println("Starting Test: " + description); } }; } Alternatively, I could have created the above as a class and extend all my test classes from that class, I tried that and it worked perfectly, however this would prevent me from extending my test methods from any other class. Is there a way for me to create rules that will be applicable for all my tests without extending from a base class?
favorite count: 0
tagged with: junit-rule
tagged with: interface
has answer: http://stackoverflow.com/a/25102931
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/25102931
downvote count: 0

http://stackoverflow.com/a/50968509
answers question: http://stackoverflow.com/q/25074017
score: 0
type: Answer
has body: Yes, it is true that in order to deal with mismatching versions we need to modify the PATH variable, and the where command (at least, in Windows) is very handy in finding out which program gets picked first. There's, however, a twist: when you look at the contents of yout PATH var after running, for example, echo %path% &gt; path.txt you should be aware of the fact that PATH is actually composed of TWO sections: one is System PATH and the other is Current User PATH, and it is System Path that gets evaluated first but printed last. So simply placing a path to your, say, brand-new JDK in front of everything will be useless as long as there's another place with older version somewhere in the System PATH. This particular problem is especially common when you have entries such as C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath in your System PATH. Simply move them to the tail of your Current User PATH section to make these entries the last ones within the search queue.

parsing
tags question: http://stackoverflow.com/q/25102338
tags question: http://stackoverflow.com/q/25125381
tags question: http://stackoverflow.com/q/25147392
tags question: http://stackoverflow.com/q/25122481
tags question: http://stackoverflow.com/q/25186625
tag name: parsing
tags question: http://stackoverflow.com/q/25091818
tags question: http://stackoverflow.com/q/25163401
tags question: http://stackoverflow.com/q/25203541
tags question: http://stackoverflow.com/q/25088705
tags question: http://stackoverflow.com/q/25116597
type: Tag
tags question: http://stackoverflow.com/q/25070059
tags question: http://stackoverflow.com/q/25211367
tags question: http://stackoverflow.com/q/25077236
tags question: http://stackoverflow.com/q/25173708
tags question: http://stackoverflow.com/q/25177303
tags question: http://stackoverflow.com/q/25136840
tags question: http://stackoverflow.com/q/25192976
tags question: http://stackoverflow.com/q/25118619
tags question: http://stackoverflow.com/q/25096744
tags question: http://stackoverflow.com/q/25116129
tags question: http://stackoverflow.com/q/25098788
tags question: http://stackoverflow.com/q/25208493
tags question: http://stackoverflow.com/q/25118742
tags question: http://stackoverflow.com/q/25217519

http://stackoverflow.com/comment/39257395
has text: @AlexeyGavrilov is there a way to reach out to you directly? I have a question regarding ExpectIt.
type: Comment
comment on: http://stackoverflow.com/q/25171856
score: 0
type: QuestionComment

http://stackoverflow.com/q/25204889
answer count: 1
tagged with: web
has answer: http://stackoverflow.com/a/25205111
accepted answer: http://stackoverflow.com/a/25205111
tagged with: spring
type: AnsweredQuestion
tagged with: java
type: Question
has title: Spring / Java call variable from one method as a Variable
tagged with: jsp
has body: I have a variable I'm calling "UtilityStartDate", lets just say it's in Class 1, and it pulls the value from a Stored Proc. Class 1 @Override public void populateUtility(Date utilityStartDate, String utilityStatus) { if(this.Utility != null) { this.Utility.populate(utilityStartDate, utilityStatus); } } I wanted to populate it here, in a different class (Class 2), where currently it's using a constant. "READ_DASHBOARD_START_DATE", also used as "dateFrom". Class 2 @Loggable(value = LogLevel.DEBUG) public List &lt;MeterReadChart&gt; populateMeterReadChart(String customerId) { Calendar cal = Calendar.getInstance(); String dateTo = DateUtils.formatDate(cal.getTime()); **cal.add(Calendar.YEAR, Constant.READ_DASHBOARD_START_DATE); String dateFrom = DateUtils.formatDate(cal.getTime());** return meterReadingDao.populateMeterReadingDetail(customerId, dateFrom, dateTo); } I'm VERY new to java/spring, and not sure how to go and call it from Class 1, to the Method in Class 2
has comment: http://stackoverflow.com/comment/39254839
score: 0
tagged with: sql

http://stackoverflow.com/comment/39247129
comment on: http://stackoverflow.com/a/25201554
has text: yes Balduz. But I am getting java.lang.ArrayIndexOutOfBoundsException: 1 in myArray[i][j] = ((DoubleWritable)currentArray[i][j]).get();
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39090475
score: 1
comment on: http://stackoverflow.com/q/25117313
type: Comment
type: QuestionComment
has text: Make propFile as `"..//src//config//config.properties";`

http://stackoverflow.com/comment/39198131
has text: Thankyou so much. That really does mean a lot. I want my job to be programming of some kind when I grow up :)
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25174817
type: Comment

http://stackoverflow.com/q/25138744
accepted answer: http://stackoverflow.com/a/25139312
score: 11
answer count: 1
tagged with: jpa
downvote count: 0
has body: I wonder why I got "An identification variable must be provided for a range variable declaration." error when I don't have alias. Seems like I solved by problem when I added alias to the table. Code with problem: List result = entityManager.createQuery( "from Rental", Rental.class ).getResultList(); Solution: List result = entityManager.createQuery( "from Rental r", Rental.class ).getResultList();
favorite count: 0
upvote count: 11
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25139312
has title: JPA - An identification variable must be provided for a range variable declaration
type: Question

http://stackoverflow.com/comment/39283041
comment on: http://stackoverflow.com/q/25220522
has text: Show code where you declare your adapter and where you initialise it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39223186
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25188687
has text: You can set the background to be transparent `(shell.setBackgroundMode(SWT.INHERIT_FORCE);`).
type: Comment

http://stackoverflow.com/comment/39210021
type: Comment
comment on: http://stackoverflow.com/a/25177018
type: AnswerComment
has text: can you explain me where I have to put the code, as I do it, it doesn't work ._.
score: 0

http://stackoverflow.com/comment/41900864
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26618592
has text: sure please post your question here in the comments box or at stackoverflow
type: AnswerComment

http://stackoverflow.com/comment/39221400
type: Comment
has text: Will update my post, just need to get my code back to where it was when I posted this.
type: QuestionComment
comment on: http://stackoverflow.com/q/25187691
score: 0

http://stackoverflow.com/q/25127272
type: UnansweredQuestion
tagged with: datastax-enterprise
has title: SSTable loader streaming failed giving java.io.IOException: Connection reset by peer
has body: I am trying to use sstableloader to stream data to a Cassandra database, which is in fact in the same node. It used to work when i was using DSE 2.2 but when i upgraded it to DSE 4.5 and made all the relevant changes in the cassandra.yaml file, it stopped working and now it is throwing an error like this: Established connection to initial hosts Opening sstables and calculating sections to stream Streaming relevant part of demo/test_yale/demo-test_yale-jb-2-Data.db demo/test_yale/demo-test_yale-jb-1-Data.db to [/127.0.0.1] Streaming session ID: 02225ef0-1c17-11e4-a1ea-5f2d4f6a32c1 progress: [/127.0.0.1 1/2 (88%)] [total: 88% - 2147483647MB/s (avg: 14MB/s)]ERROR 16:36:29,029 [Stream #02225ef0-1c17-11e4-a1ea-5f2d4f6a32c1] Streaming error occurred java.io.IOException: Connection reset by peer at sun.nio.ch.FileDispatcherImpl.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) at sun.nio.ch.IOUtil.write(IOUtil.java:65) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487) at java.nio.channels.Channels.writeFullyImpl(Channels.java:78) at java.nio.channels.Channels.writeFully(Channels.java:98) at java.nio.channels.Channels.access$000(Channels.java:61) at java.nio.channels.Channels$1.write(Channels.java:174) at com.ning.compress.lzf.LZFChunk.writeCompressedHeader(LZFChunk.java:77) at com.ning.compress.lzf.ChunkEncoder.encodeAndWriteChunk(ChunkEncoder.java:132) at com.ning.compress.lzf.LZFOutputStream.writeCompressedBlock(LZFOutputStream.java:203) at com.ning.compress.lzf.LZFOutputStream.write(LZFOutputStream.java:97) at org.apache.cassandra.streaming.StreamWriter.write(StreamWriter.java:151) at org.apache.cassandra.streaming.StreamWriter.write(StreamWriter.java:101) at org.apache.cassandra.streaming.messages.OutgoingFileMessage$1.serialize(OutgoingFileMessage.java:59) at org.apache.cassandra.streaming.messages.OutgoingFileMessage$1.serialize(OutgoingFileMessage.java:42) a…
has comment: http://stackoverflow.com/comment/46223749
score: 3
tagged with: cassandra-2.0
tagged with: java
type: Question
upvote count: 3
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39945265
favorite count: 0
has answer: http://stackoverflow.com/a/38721994

http://stackoverflow.com/a/25074653
answers question: http://stackoverflow.com/q/25074313
upvote count: 1
downvote count: 0
has body: You can try something like this String str = "START_READING_20140723_093539.jpg"; Scanner scanner = new Scanner(str.substring(0, str.lastIndexOf('.'))); scanner.useDelimiter("[^\\p{Alnum},\\.-]"); String[] arr=new String[2]; int i=0; while (scanner.hasNext()) { if (scanner.hasNextInt()) { arr[i]=scanner.next(); i++; } else { scanner.next(); } } String dateStr=arr[0]+"_"+arr[1]; DateFormat df1=new SimpleDateFormat("yyyyMMdd_HHmmss"); DateFormat df2=new SimpleDateFormat("dd-MM-yyyy HH:mm:ssa"); System.out.println(df2.format(df1.parse(dateStr))); Out put: 23-07-2014 09:35:39AM
type: Answer
score: 1

http://stackoverflow.com/q/25142522
has comment: http://stackoverflow.com/comment/39140609
tagged with: android
has comment: http://stackoverflow.com/comment/39137273
has title: ImageView- cannot find image by id
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: It seems that when I try to set the id of an image in an ImageView, I get an error imageView1 = (ImageView) findViewById(R.id.image1); *error at "R.id.image1" and when I look in R.java, the image names I put in res are in drawable class and not in id class. public static final class drawable { public static final int image1=0x7f020011; public static final int image2=0x7f020012; public static final int image3=0x7f020013; public static final int ic_launcher=0x7f020017; } public static final class id { public static final int button1=0x7f080002; public static final int button2=0x7f080003; public static final int button3=0x7f080004; public static final int button4=0x7f080005; public static final int imageView1=0x7f080001; } but when I put "R.drawable.image1" it seem to work fine but R.id is necessary to avoid any future errors. What seems to be the problem? And how do I fix it? I cannot seem to find any related posts.
type: Question
has answer: http://stackoverflow.com/a/25142606
answer count: 2
has answer: http://stackoverflow.com/a/25142604
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/39137281

http://stackoverflow.com/comment/39294559
type: Comment
comment on: http://stackoverflow.com/a/25226898
has text: @newUser 5 lines including printing of results and class, main def?
type: AnswerComment
score: 0

http://stackoverflow.com/q/25147141
upvote count: 2
tagged with: swing
tagged with: css
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2438201
tagged with: java
has answer: http://stackoverflow.com/a/25147343
type: Question
has body: Wondering if you could help me? I'm trying to create some coding in Java to execute html code in a JEditorPane by implementing CSS. I get it to implement some of the CSS coding as a rule, but it seems to ignore the "float:" bit in the coding. On JSFiddle (link) I get it to run flawlessly, but on Java/NB it creates the container, left div which is small, and the supposed right div, but it puts it below the left div, instead of to the right of it. What I'm thinking is that Java and HTMLEditorKit as well as StyleSheet doesn't support what I want to do. Can anybody give some clarity on this? Edit: It seem that only HTML 3.2 is supported. Is there a possible workaround for this? import java.awt.Dimension; import javax.swing.*; import javax.swing.text.Document; import javax.swing.text.html.HTMLEditorKit; import javax.swing.text.html.StyleSheet; @SuppressWarnings("serial") public class jBulletins extends JPanel { javax.swing.JEditorPane bulletinBoard = new javax.swing.JEditorPane(); public jBulletins() { Dimension d = new Dimension(); d.setSize(800, 600); bulletinBoard.setPreferredSize(d); bulletinBoard.setContentType("text/html"); // NOI18N add(new JScrollPane(bulletinBoard)); loadBulletins(); } private void loadBulletins() { //&lt;editor-fold defaultstate="collapsed" desc="HTML/CSS Script"&gt; String eBullStyles = "#divMsgs{ " + "height: 99px; " + "margin: auto; " + "background-color: #3399FF; " + "} " + "#divLeft{ " + "float: left; " + "width: 110px; " + "height: 85px; " + "border: 2px #6666ff outset; " + "padding: 5px; " + "background-color: #189cd8; " + "color: #ffffff; " + "font-size: 11px; " + "font-weight: normal; " + "font-family: Tahoma, Geneva, sans-serif; " + "font-style: normal; " + "text-decoration: inherit; " + "} " + "#divRight{ " + "float: right; " + "width: 50px; " + "height: 85px; " + "border: 2px #6666ff outset; " + "background-color: #189cd8; " + "padding: 5px; " + "color: #ffffff; " + "font-size: 11px; " + "font-weight: normal; " + "font-family: Tahom…
answer count: 2
score: 2
accepted answer: http://stackoverflow.com/a/25147343
possible better answer: http://stackoverflow.com/a/25147190
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
has title: Why isn't my CSS working right in Java?
has answer: http://stackoverflow.com/a/25147190
favorite count: 0

http://stackoverflow.com/q/25129557
accepted answer: http://stackoverflow.com/a/25129886
type: Question
tagged with: java
has title: How to copy an object so that original does not change while changing copied one
answer count: 2
has comment: http://stackoverflow.com/comment/39113741
has body: I want to write a method in java which gives ArrayList&lt;ArrayList&lt;Integer&gt;&gt; (say result) from ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(say original) without changing the original one. So I have to first store original in some variable but i dont find a proper or easy way for ex. I want to remove a certain object (Integer) from original this is how i am coding static ArrayList&lt;ArrayList&lt;Integer&gt;&gt; rmv(Integer a,ArrayList&lt;ArrayList&lt;Integer&gt;&gt; original){ ArrayList&lt;ArrayList&lt;Integer&gt;&gt; result=new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); //storing original to other variable for(int i=0;i&lt;original.size();i++){ ArrayList&lt;Integer&gt; temp=new ArrayList&lt;Integer&gt;(); for(int j=0;j&lt;original.get(i).size();j++){ temp.add(original.get(i).get(j)); } result.add(temp); } // not so important here for(int i=0;i&lt;b.size();i++){ result.get(i).remove(a); } return result; } plz suggest me if there is any shortcut method
possible better answer: http://stackoverflow.com/a/25129574
has answer: http://stackoverflow.com/a/25129574
has comment: http://stackoverflow.com/comment/39113689
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25129886
score: 0

http://stackoverflow.com/comment/39291020
has text: In which activity you have created the options menu. Can you please add some details.
type: AnswerComment
comment on: http://stackoverflow.com/a/25224527
score: 0
type: Comment

http://stackoverflow.com/q/25209613
has comment: http://stackoverflow.com/comment/39267218
has comment: http://stackoverflow.com/comment/39267288
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25378657
has comment: http://stackoverflow.com/comment/39262578
score: 0
has title: Apache POI append data to excel sheet not working
answer count: 1
has comment: http://stackoverflow.com/comment/127999518
has body: I am reading data from an arraylist and writing this to an excel sheet. The problem is my excel is getting overwritten each time. Here is my code. I can't figure out what is wrong here :( Can someone please help? public static void main( String[] args ) throws Exception { List&lt;String&gt; fileData = new ArrayList&lt;String&gt;(); for(File file:files) { fileData.add(readFileContents(file.getAbsolutePath())); } for(String fileContent:fileData) { //do some stuff that in turn calls the writeDataToExcel method } } private static void writeDataToExcel(String test,Map&lt;String,String&gt; dataMap,Object object) throws IOException { File file = new File("input/data.xls"); Map&lt;String,Object[]&gt; data = new LinkedHashMap&lt;String,Object[]&gt;(); XSSFWorkbook workbook = null; int count = 0; XSSFSheet sheet = null; if(file.exists()) { workbook = new XSSFWorkbook(new FileInputStream(file)); sheet = workbook.getSheet("Data Sheet"); } else { workbook = new XSSFWorkbook(); sheet = workbook.createSheet("Data Sheet"); //count = sheet.getLastRowNum(); } data.put("1", new Object[]{"Id","Name","Field","Description","Value"}); for(Map.Entry&lt;String, String&gt; dataMp:dataMap.entrySet()) { data.put(Integer.toString(count+2), new Object[]{id,object.getClass().getSimpleName(),dataMp.getKey(),dataMp.getValue(),"null"}); count++; } Set&lt;String&gt; keyset = data.keySet(); int rownum = 0; for (String key : keyset) { Row row = sheet.createRow(rownum++); Object [] objArr = data.get(key); int cellnum = 0; for (Object obj : objArr) { Cell cell = row.createCell(cellnum++); if(obj instanceof String) cell.setCellValue((String)obj); } } FileOutputStream fis = new FileOutputStream("input/data.xls"); workbook.write(fis); if(fis!=null) fis.close(); }
has comment: http://stackoverflow.com/comment/39265610
has comment: http://stackoverflow.com/comment/39263063
tagged with: apache-poi

http://stackoverflow.com/comment/39026032
has text: you can use broadcast receiver, in onPostExecute register one broadcast and in onReceive refresh your adapter, or make your class as inner class and use `adapter.notifyDatasetChanged`
comment on: http://stackoverflow.com/q/25082631
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39089321
comment on: http://stackoverflow.com/q/25115313
has text: The only difference I can see between the red and blue versions could be accounted for by an `EmptyBorder` on the container that holds the components.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25133306
tagged with: multi-catch
accepted answer: http://stackoverflow.com/a/25133392
tagged with: catch-block
type: AnsweredQuestion
type: Question
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25133392
has title: Automaticall replacing single catch clauses with duplicate catch clauses
answer count: 1
has body: Does anyone know whether there is a tool or something similar to replace single catch clauses with duplicate code within it in java with multiple catch clauses to remove duplicate code? Context is an upgrade vom java jdk6 to 7. Thanks and cheers, Ste

http://stackoverflow.com/comment/39214414
comment on: http://stackoverflow.com/q/25183872
score: 1
has text: @JohnB This is not just about line count; it is about respecting the best practice with as little chance as possible of going wrong about it.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25086252
has answer: http://stackoverflow.com/a/25086349
tagged with: java
has answer: http://stackoverflow.com/a/25086379
has answer: http://stackoverflow.com/a/25086343
type: Question
has title: How to create Connection class
score: 0
answer count: 3
has body: This is a code i tried for common Connection class jdbc project but it returns only null package dbDemo; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class ConnectionDemo { Connection con; public Connection getConnection() { try { Class.forName("com.mysql.jdbc.driver"); String url="jdbc:mysql://localhost:3306/myserver"; String name="root"; String pwd="admin123"; con=DriverManager.getConnection(url,name,pwd); } catch(Exception e) { System.out.println(e.getMessage()); } return con; }} anybody can please help this code right or wrong.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39033063

http://stackoverflow.com/q/25134298
has comment: http://stackoverflow.com/comment/39125187
has body: Is there any way to make labels selectable in SWT? or are there any other widgets in SWT that are selectable and can be used as labels? I am building a calendar.
has answer: http://stackoverflow.com/a/25135451
tagged with: swt
accepted answer: http://stackoverflow.com/a/25135451
downvote count: 1
type: AnsweredQuestion
score: 7
tagged with: java
type: Question
has title: Is there any way to make labels selectable in SWT?
answer count: 1
tagged with: user-interface
favorite count: 0
has comment: http://stackoverflow.com/comment/39126140
upvote count: 8
has comment: http://stackoverflow.com/comment/39125823
has comment: http://stackoverflow.com/comment/39125966
has comment: http://stackoverflow.com/comment/39122351

http://stackoverflow.com/q/25157183
downvote count: 3
type: Question
tagged with: tablecolumn
has body: private TableColumn&lt;?, ?&gt; colname; I want to know what is use of this in declaration of tablecolumn.
has comment: http://stackoverflow.com/comment/39164523
answer count: 2
has answer: http://stackoverflow.com/a/25166029
tagged with: variables
has answer: http://stackoverflow.com/a/25157948
favorite count: 0
has title: What is use of <?,? > in the declaration in javafx
type: UnansweredQuestion
score: -3
upvote count: 0
tagged with: declaration
tagged with: java
tagged with: javafx

http://stackoverflow.com/comment/39150193
comment on: http://stackoverflow.com/q/25149163
type: Comment
type: QuestionComment
has text: @Emrakul Various parameters for an API.
score: 0

http://stackoverflow.com/a/25226030
upvote count: 1
answers question: http://stackoverflow.com/q/25225946
type: Answer
has body: they are almost the same except one difference: myObject+"" will not throw NPE when myObject is null,but myObject.toString()+"" will.
downvote count: 0
score: 1

http://stackoverflow.com/a/25216224
score: 0
has body: NullPointerException generally means you tried to call a method or access a field on a variable doesn't refer to any object. The only variables you're using in this file, aside from the predefined request and response, are username and password. The request.getParameter method returns null if the request doesn't have a parameter with the specified name. So if your request doesn't include a txt_username and/or txt_password parameter, the username and/or password variable will be null. On the line below, when you call username.equals and password.equals, you'll get the exception if those variables are null. You can't call the method if there's no object to call it on. You need to add some code to handle the case where username or password are null.
answers question: http://stackoverflow.com/q/25216152
type: Answer

http://stackoverflow.com/q/25197935
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/5185480
answer count: 1
tagged with: variables
has comment: http://stackoverflow.com/comment/39241169
score: 0
has comment: http://stackoverflow.com/comment/39240416
has comment: http://stackoverflow.com/comment/39240635
has comment: http://stackoverflow.com/comment/39241365
has comment: http://stackoverflow.com/comment/39241487
has comment: http://stackoverflow.com/comment/39240650
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39240579
has body: Is there any possible way how to refactor variable fields in eclipse? long interval; public WebsiteConnectionPing(String url, long interval, String serviceName) { this.url = url; this.interval = interval; this.serviceName = serviceName; } //...... I want to refactor interval which is type long to type String is it possible? String interval; public WebsiteConnectionPing(String url, String interval, String serviceName) { this.url = url; this.interval = interval; this.serviceName = serviceName; } //....
has title: Refactoring int,long etc
tagged with: refactoring
tagged with: java
has answer: http://stackoverflow.com/a/25200375

http://stackoverflow.com/comment/39102973
comment on: http://stackoverflow.com/q/25123416
score: 0
has text: We can help with if you create a minimal example. See [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve).
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25226441
has comment: http://stackoverflow.com/comment/41951688
has answer: http://stackoverflow.com/a/25286248
tagged with: spring-aop
answer count: 3
has title: Java AOP JoinPoint does not get parameter names
downvote count: 0
has body: I'm using Java Spring Mvc and Spring AOP to find the parameter names from the user. I have a controller which get parameters from user and call a service. I have an aspect that running before the service. The aspect should check if username and apiKey parameters are exist. Here is my code : Controller : @RequestMapping(method = RequestMethod.POST, produces=MediaType.APPLICATION_JSON_VALUE) public @ResponseBody String getDomainWithFoundIn(@RequestParam (value="domain") String domain, @RequestParam (value="user") String user, @RequestParam (value="apiKey") String apiKey) throws JsonGenerationException, JsonMappingException, IOException { return domainService.getDomainDataWithFoundIn(domain, user, apiKey); } Domain Service Interface : public interface IDomainService { public String getDomainDataWithFoundIn(String domainStr, String user, String apiKey); } DomainService : @Override @ApiAuthentication public String getDomainDataWithFoundIn(String domainStr, String user, String apiKey) { //Do stuff here } And my AOP class : @Component @Aspect public class AuthAspect { @Before("@annotation(apiAuthentication)") public void printIt (JoinPoint joinPoint, ApiAuthentication apiAuthentication) throws NoAuthenticationParametersException, UserWasNotFoundException { final MethodSignature signature = (MethodSignature) joinPoint.getSignature(); final String[] parameterNames = signature.getParameterNames(); **//parameterNames is null here.** } In this case, I'd expect to get on my aspect the "domain", "user" and "apiKey" parameter names. Any idea what am i missing here ? Thanks, Or.
possible better answer: http://stackoverflow.com/a/47071101
favorite count: 0
has comment: http://stackoverflow.com/comment/39301563
has comment: http://stackoverflow.com/comment/39303814
tagged with: spring
has comment: http://stackoverflow.com/comment/39301826
tagged with: spring-mvc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26676719
tagged with: spring-aspects
upvote count: 3
has answer: http://stackoverflow.com/a/47071101
has comment: http://stackoverflow.com/comment/39293633
type: Question
has comment: http://stackoverflow.com/comment/39293676
score: 3
has comment: http://stackoverflow.com/comment/39301872
has answer: http://stackoverflow.com/a/26676719
tagged with: java

deserialization
type: Tag
tags question: http://stackoverflow.com/q/25205694
tags question: http://stackoverflow.com/q/25126596
tags question: http://stackoverflow.com/q/25169303
tags question: http://stackoverflow.com/q/25086515
tag name: deserialization
tags question: http://stackoverflow.com/q/25076030
tags question: http://stackoverflow.com/q/25171211

http://stackoverflow.com/a/25164172
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: As a prologue, first rule of cryptography : do not do it yourself, use proven tools in their documented use cases to perform the operations. So I'd first check if you XML document is indeed signed using a standard (I don't know of an XML signature format that is based on PKCS7, but then, I sure don't know everything). If so, I'd find a library that supports this specific format. XML Signature is standardized along the XMLD Sig umbrella, formalized here : http://www.w3.org/TR/xmldsig-core/. The Oracle JDK ships with a reference implementation (that is derived from an Apache implementation of the standard), using the XMLSignatureFactory base class. PKCS7 is not used as part of XML DSig, though, so you may have to "do it yourself" (a small enough part of if) in the end, unless there is a protocol that I do not know of. That said, indeed PKCS7 (superseeded in some cases by CMS) is a standard cryptographic format that allows the signature of arbitrary content. The structure is flexible enough to hold notably : the content to be signed (it can be embedded, or not), the signature and associated algorithm identifiers, plus X509 material linked to the signature (such as Certificates and public keys, certificate revocation lists...). The Java language does not provide a generic implementation of PKCS7 processing to my knowledge, although the Oracle JDK does under the sun.security.pkcs package. A popular, common library for PKCS7 processing in Java is BouncyCastle. I'm more familiar with it, so this is what I'll talk about. You can find a usage sample here : http://i-proving.com/2007/09/21/pkcs7-signatures-using-bouncy-castle/ Bouncy Castle has a fairly good example package when you download the source, and also Javadoc. So you can check it out for up-to-date usage of the API. Check for example : https://www.bouncycastle.org/docs/pkixdocs1.5on/org/bouncycastle/cms/CMSSignedData.html, reproduced here for easier reference CMSSignedData s = new CMSSignedData(inputStream); Store c…
answers question: http://stackoverflow.com/q/25162605
accepted answer of: http://stackoverflow.com/q/25162605
has comment: http://stackoverflow.com/comment/40641718
type: AcceptedAnswer

http://stackoverflow.com/a/53495986
answers question: http://stackoverflow.com/q/25107945
has body: You have to use the 8.1 version of NetBeans IDE
type: Answer
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/39247214
score: 0
type: AnswerComment
type: Comment
has text: Sorry I edited it there but the comment did not get saved. int n = Integer.parseInt(readNumberTV.getText().toString()); announceNumber(n); For the first time announceNumber has to be called explicitly but the next times would be called recursively.
comment on: http://stackoverflow.com/a/25167633

http://stackoverflow.com/a/25118572
has comment: http://stackoverflow.com/comment/39113936
type: Answer
answers question: http://stackoverflow.com/q/25111864
has body: If you do not what to use form validation, I don't think you need to create a class. Instead, you can use AJAX function like $.ajax(), that will be route to your specific controller function. Moreover, you can call your model function from your controller then at last return the result. The result will be caught by the $.ajax() function. $.ajax type: "POST" url: url data: data success: success dataType: dataType
score: 0

http://stackoverflow.com/a/25154842
has body: You can use the Calendar class's add method to add specify time of date from seconds, minute, hours, etc. in Calendar's constant. sample: Date date1 = new Date(); Calendar c = Calendar.getInstance(); c.setTime(date1); c.add(Calendar.MINUTE, 5); //adds five minute to the calendar's date System.out.println(date1.getTime()); //current time System.out.println(c.getTime().getTime()); //current time + 5 minutes
score: 5
upvote count: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25154754
type: Answer
accepted answer of: http://stackoverflow.com/q/25154754

http://stackoverflow.com/q/25109138
favorite count: 0
has answer: http://stackoverflow.com/a/25109709
answer count: 4
type: AnsweredQuestion
has title: Setter / getter method inheritance
has comment: http://stackoverflow.com/comment/39075706
tagged with: java
has answer: http://stackoverflow.com/a/25110007
downvote count: 1
has comment: http://stackoverflow.com/comment/39075309
possible better answer: http://stackoverflow.com/a/57524702
type: Question
accepted answer: http://stackoverflow.com/a/25109709
score: 3
has answer: http://stackoverflow.com/a/57524702
has comment: http://stackoverflow.com/comment/39075374
upvote count: 4
has body: So I was studying about inheritance in java and I didn't get it quite clear. Suppose we have a parent method with a private variable and public setter getter methods. A subclass inherits these methods but not the private variable. Are these methods always connected with the superclass which also runs with the subclass? I can't declare a variable with the same name in the subclass, so inherited method would access it instead. I know doesn't work. Do the setter/getter methods always affect only values in objects where they are declared, even called from a subclass by inheritance?
has answer: http://stackoverflow.com/a/25109269
has comment: http://stackoverflow.com/comment/39075319

http://stackoverflow.com/comment/39234325
comment on: http://stackoverflow.com/q/25194570
has text: i don't know, it works. I don't know the difference between the two.
score: 0
type: Comment
type: QuestionComment

search-engine
type: Tag
tag name: search-engine
tags question: http://stackoverflow.com/q/25133026
tags question: http://stackoverflow.com/q/25093821

http://stackoverflow.com/comment/39289254
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25223756
type: AnswerComment
has text: Thanks, that worked. How can I modify the `writeNewFile()` function to automatically write to the desktop and name the file `output.txt`? I've tried several things and the code compiles and runs, but the file never shows up on the desktop.

http://stackoverflow.com/q/25214669
has comment: http://stackoverflow.com/comment/39272085
linked to: http://stackoverflow.com/q/8511063
answer count: 0
type: UnansweredQuestion
upvote count: 1
has body: I have created a GUI project and compile the program using CMD. For Creating .jar File, I created manifest.txt and made the jar by using following command: jar cmf manifest.txt Client.jar *.class this created a .jar file but when I open the Client.jar a Window pops up saying "A JAVA Exception has Occurred" but when I run the jar from CMD java -jar Client.jar It runs properly from CMD but not by clicking on it directly. What Could be wrong ....? This is my manifest.txt Main-Class: ClientTextEdit \n \n \n----> newline these are the .class files: ClientTextEdit.class ClientTextEdit$1.class ClientTextEdit$2.class ClientTextEdit$3.class ClientTextEdit$4.class ClientConnection.class
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39273727
type: Question
has comment: http://stackoverflow.com/comment/39273974
has title: A java Exception has Occurred when Running .jar File of GUI
downvote count: 0
tagged with: executable-jar
tagged with: jar
favorite count: 0

http://stackoverflow.com/a/74154708
type: Answer
answers question: http://stackoverflow.com/q/25175448
score: 0
has body: As of version 4.0.0 of the Java client, automatic recovery is enabled by default. It can be done like this, ConnectionFactory factory = new ConnectionFactory(); factory.setAutomaticRecoveryEnabled(true); // connection that will recover automatically Connection conn = factory.newConnection();

http://stackoverflow.com/a/25077875
type: Answer
has comment: http://stackoverflow.com/comment/39028388
answers question: http://stackoverflow.com/q/25077792
has comment: http://stackoverflow.com/comment/39029057
downvote count: 0
has comment: http://stackoverflow.com/comment/39028284
score: 1
has comment: http://stackoverflow.com/comment/39016855
has body: Try to use the Java monitor or visualVM like tool and check that which classes are involved.Could be possible your tomcat is using Quartz.
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25077792

http://stackoverflow.com/q/25085054
answer count: 3
has body: I am getting the error: Unchecked call to 'put(K, V)' as a member of raw type 'java.util.HashMap' This is the line that shows the error: JSONArray FieldValues = new JSONArray(new JSONObject(new HashMap().put(K, V))); Am I doing anything wrong or is there something I should add? any help is greatly appreciated
favorite count: 0
possible better answer: http://stackoverflow.com/a/41034580
upvote count: 36
has answer: http://stackoverflow.com/a/41034580
has comment: http://stackoverflow.com/comment/39030633
has title: Error Unchecked call to 'put(K, V)' as a member of raw type 'java.util.HashMap'
has comment: http://stackoverflow.com/comment/39030619
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/56744664
has comment: http://stackoverflow.com/comment/39030489
type: Question
tagged with: hashmap
tagged with: arrays
has answer: http://stackoverflow.com/a/25085119
accepted answer: http://stackoverflow.com/a/25085119
score: 36

http://stackoverflow.com/comment/39226419
comment on: http://stackoverflow.com/q/25190292
has text: @KevinKrumwiede I can totally understand that Gintas_ knows that the `super.onBackPressed` method doesn't exist, but doesn't know how to refer to the `super.onBackPressed` of the enclosing `Activity`. Why not?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39295920
type: Comment
comment on: http://stackoverflow.com/a/25184650
score: 0
type: AnswerComment
has text: Interesting. I have heard that the use of insanceof is very inefficient, so I'm reluctant use it. I like the use of values() which allows for really short methods, which we could implement in a common base class. Although i really should be part of Object to be really nice. I guess we could add rules to Sonar or similar that no class, except the new base class, may inherit directly from Object.

http://stackoverflow.com/q/25168519
has body: I have an SSL function on my C side that receives only the exact number of bytes sent. Problem is that I'm sending strings &amp; JSON of different byte length's from my servlet. My Approach: I'm sending the length of each string first then the actual message. //For Json String (349 bytes) outputstreamwriter.write(jsonLength); outputstreamwriter.write(jsonData); outputstreamwriter.flush(); // For other request strings final String path = request.getPathInfo(); String all_Users = "GET ALL USERS"; String user_length = Integer.toString(all_Users.length()); String all_Keys = "GET ALL KEYS"; String key_length = Integer.toString(all_Keys.length()); if (path == null || path.endsWith("/users")) { outputstreamwriter.write(user_length); outputstreamwriter.write(all_Users); } else if (path.endsWith("/keys")) { outputstreamwriter.write(key_length); outputstreamwriter.write(all_Keys); } On the C side: I first read the incoming bytes for the incoming string length and then call the function again to expect that message. Now, my Json is 349 while the other requests are 12. These are 3 and 2 bytes respectively. debug_print("Clearing Buffer\n", NULL); memset(inBuf, 0, 1024); ssl_recv_exactly(rs_ssl, inBuf, 2, &amp;ssllog)) lengthValue = atoi(inBuf); printf("successfully received %d bytes of request:\n&lt;%s&gt;\n", lengthValue, inBuf); } if (lengthValue == 13) { // Call this function else if (lengthValue == 12) { // call this function } Current solution: I'm adding a zero to my 2 byte requests to make them 3 bytes. Any smarter way of doing this?
has title: Sending bytes over socket (Java Servlet to C)
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/39190093
has comment: http://stackoverflow.com/comment/39186120
has comment: http://stackoverflow.com/comment/39192960
answer count: 1
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/39190711
score: 0
has answer: http://stackoverflow.com/a/25454223
tagged with: sockets
accepted answer: http://stackoverflow.com/a/25454223
type: AnsweredQuestion

http://stackoverflow.com/a/48596506
answers question: http://stackoverflow.com/q/25229124
has comment: http://stackoverflow.com/comment/84195669
type: Answer
has body: public static void main(String[] args) { DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss") .withZone(ZoneId.systemDefault()); System.out.println(DATE_TIME_FORMATTER.format(new Date().toInstant())); }
downvote count: 1
score: 73
upvote count: 74
has comment: http://stackoverflow.com/comment/84198190
has comment: http://stackoverflow.com/comment/117027977

http://stackoverflow.com/comment/39042274
type: Comment
comment on: http://stackoverflow.com/a/25091271
has text: but the thing is it should not have any relation.
type: AnswerComment
score: 0

http://stackoverflow.com/q/25094517
has comment: http://stackoverflow.com/comment/39048279
has comment: http://stackoverflow.com/comment/39048206
favorite count: 0
has comment: http://stackoverflow.com/comment/39048302
has comment: http://stackoverflow.com/comment/39048394
has comment: http://stackoverflow.com/comment/39048236
has body: I am getting below error pls help "parse error: Error on line 1 of document : The markup in the document preceding the root element must be well-formed. Nested exception: The markup in the document preceding the root element must be well-formed. XML is below <?xml version=\"1.0\" encoding=\"UTF-8\"?> <'env:Envelope' xmlns>:env=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:ns1=\"urn:zimbraAdmin\"> xmlns:ns2=\"urn:zimbraAdmin\"><env:Header><ns2:context/></env:Header><env:Body> 4d41ec71-d898-42b8-b522-3c3cdc5583a0 TRUE </env:Body></env:Envelope>
tagged with: soap
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/39048243
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/28843991
upvote count: 1
downvote count: 1
type: Question
tagged with: zimbra
has comment: http://stackoverflow.com/comment/39048361
score: 0
has title: XML Parse error
answer count: 1

hk2
tags question: http://stackoverflow.com/q/25212944
type: Tag
tag name: hk2
tags question: http://stackoverflow.com/q/25075296

http://stackoverflow.com/a/25187998
has body: You can edit the xhtml file in place (as in, in the place from which it is running - often your build area for development environments) and it will update on the next refresh. We have a maven build that only moves xhtml files from our development project to our development (local to each developer's workstation) deployment area.
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25185428
score: 1

http://stackoverflow.com/comment/39210090
comment on: http://stackoverflow.com/q/25181107
score: 0
has text: actually, yes its very similar. I have not seen it before. The answer provided there is not satisfying me however it may be correct :)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25104846
answers question: http://stackoverflow.com/q/25104536
has comment: http://stackoverflow.com/comment/39074050
type: Answer
score: 0
has body: Generally speaking new FileWriter(file); will overwrite the file leaving it empty. In your case, else if (action.equals(clear)) { // Need to close this first to avoid resource leak pw.close(); File data = new File("StoredInfo.txt"); // I believe you will need pw later pw = new PrintWriter(new FileWriter(data, false)); } Hope that helped.
accepted answer of: http://stackoverflow.com/q/25104536
type: AcceptedAnswer

http://stackoverflow.com/comment/81417243
comment on: http://stackoverflow.com/a/47071101
type: Comment
has text: I am not sure why this was downvoted. It works from the spring docs `To enable CGLIB, you need to set the attribute proxy-targetclass= true in aop:aspectj-autoproxy.`
score: 0
type: AnswerComment

http://stackoverflow.com/q/25215008
tagged with: sockets
has title: Unable to send message from server to the client in android through text field
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25215493
type: Question
tagged with: client-server
score: 0
tagged with: android
has body: UPDATE: ok so I kept trying to press send until I received the java.net.SocketException: sendto failed: EPIPE (Broken pipe) exception as a toast message once and then there was no activity once again when I pressed the send button. Meaning I didn't get the exception again. I have two apps where one acts as the server and the other as a client. I was able to send a message from the server to the client like this dataOutputStream.writeUTF("hello"); basically as a hardcoded string but when I added a textfield and a button to the server app and tried listening to the onClick like this sendChatbtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { dataOutputStream.writeUTF(chatMsg); } catch (IOException e) { e.printStackTrace(); Toast.makeText(ServerActivity.this, "An exception occurred: " + e.toString(), Toast.LENGTH_SHORT).show(); // TODO Auto-generated catch block } } }); Absolutely NOTHING happened when I press the SEND button and the client did not receive any message, I don't even get any exception as a toast. By the way I am able to send messages from the client to the server and the server receives the client's messages but the client doesn't get any messages from the server. The logcat although shows this: 08-09 04:13:45.694: E/LocSvc_adapter(761): E/virtual loc_api_adapter_err LocApiV02Adapter::injectPosition(double, double, float):632]: error! status = eLOC_CLIENT_FAILURE_INVALID_PARAMETER, inject_pos_ind.status = UNKNOWN 08-09 04:15:25.220: A/ActivityManager(761): Service ServiceRecord{42e78d58 u0 com.estrongs.android.pop/com.estrongs.android.ui.notification.ESTaskService} in process ProcessRecord{449c4320 9734:com.estrongs.android.pop/u0a245} not same as in map: null 08-09 04:16:06.444: E/AudioStreamOutALSA(269): PCM_Write set_amp_mode,1 Here's my Server code: public class ServerActivity extends Activity { TextView info, infoip, msg; String message = ""; ServerSocket serverSocket; EditText chatBoxText; Button sendChatbtn…
answer count: 1
has answer: http://stackoverflow.com/a/25215493
tagged with: tcp

http://stackoverflow.com/a/38982272
answers question: http://stackoverflow.com/q/25189281
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25189281
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I faced exactly the same problem today. It's definitely not a dependency problem. The stack trace already hints that Arquillian is trying to run the Drone test in the server itself instead of acting as client. This is in first place strange as we actually want to run it as client. How to do that is described in Arquillian's guide Functional Testing using Drone and Graphene: Enabling Client Mode How do you activate client mode? Quite simply. You either mark a deployment as non-testable, meaning Arquillian will not enrich the archive, or you can mark a specified method with the annotation @RunAsClient. In other words, you need either @RunWith(Arquillian.class) public class Test { @Deployment(testable = false) public static Archive&lt;?&gt; createDeployment() { // ... } @Test public void test() { // ... } } or @RunWith(Arquillian.class) public class Test { @Deployment public static Archive&lt;?&gt; createDeployment() { // ... } @Test @RunAsClient public void test() { // ... } } This has at least solved your problem for me.

http://stackoverflow.com/comment/39185528
type: QuestionComment
comment on: http://stackoverflow.com/q/25147030
score: 0
type: Comment
has text: Was my answer able to help you? Do you still need any help with this?

http://stackoverflow.com/q/25222304
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/45488730
tagged with: libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/39296018
type: Question
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/39290011
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/25899837
has body: I have a button that I want to use on my screen. However when I resize my desktop window, the touch coordinates messes up itself. I have no idea how to solve this. So first of all I'm using cam = new PerspectiveCamera(); viewport = new FitViewport(screenWidth, screenHeight, cam); and called viewport.update(width, height, true); in my resize method so that my screen would always look scaled proportional to its original size. For my input Gdx.input.setInputProcessor(new InputHandler((float) scaleX, (float) scaleY, world)); Now after resizing my window, the images are at correct places but the touch coordinates are not. It's kind of hard to explain but I will try my best. The scale is working properly. However, since I am using Fitviewport, when I call Gdx.graphics.getHeights() or .getWidth(), it's getting the height and width of the entire screen (including the black areas when I increase one side only). Thus, this makes my scale for my input proportional to the entire screen. While the images are being illustrated via Fitviewport and being resized proportional to it's original size. This makes my input position where the button responses to be too far left or right or up or down compared to the images that are drawn. I have also tried cam.unproject. How do I solve this? I have some log provided in hopes that it will help you understand my situation better. ---not resized(original) --- resize called Resizing x : 480 y : 800 Scales x : 1.0 y : 1.0 (coordinates where the button originally is and where the button response to input) Before Scaled X : 398 Y : 75 After Scaled X : 398 Y : 75 Gdx input X : 398 Y : 75 cam unproject X : 240.26144 Y : 400.53613 ---after resizing--- resize called Resizing x : 807 y : 743 Scales x : 1.68125 y : 0.92875 -where button appears on screen- Before Scaled X : 542 Y : 38 After Scaled X : 322 Y : 40 Gdx input X : 542 Y : 38 cam unproject X : 240.13632 Y : 400.5924 -touch coordinate at which button response to- Before Scaled X : 677 Y : 36 …
tagged with: android
has comment: http://stackoverflow.com/comment/39787090
has comment: http://stackoverflow.com/comment/39286442
accepted answer: http://stackoverflow.com/a/25899837
favorite count: 0
linked to: http://stackoverflow.com/q/7286681
has comment: http://stackoverflow.com/comment/39292683
has title: touch position not correct after resizing libGDX
has comment: http://stackoverflow.com/comment/39295461
possible better answer: http://stackoverflow.com/a/45488730
has comment: http://stackoverflow.com/comment/39294818
has comment: http://stackoverflow.com/comment/40383970

android-gridview
type: Tag
tag name: android-gridview
tags question: http://stackoverflow.com/q/25110279

http://stackoverflow.com/comment/39323401
type: Comment
type: QuestionComment
has text: Okay so I got it to work - the apache.commons.codec.binary.Base64 class was not being linked in (required for GsonPlus). So that's solved, but surely there has to be a better way of debugging such issues? The CNFE gives no clue as to the problem - deconstructing things and building them back up piece by piece is really a last resort method of dealing with things (although clearly very effective). I can deal with such errors in development by sheer brute force, but what about the future when its deployed on multiple servers and something is missing?
score: 0
comment on: http://stackoverflow.com/q/25227794

http://stackoverflow.com/q/25173848
has comment: http://stackoverflow.com/comment/39200195
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39200531
has comment: http://stackoverflow.com/comment/39200149
has comment: http://stackoverflow.com/comment/39196105
has comment: http://stackoverflow.com/comment/39455437
tagged with: runtime.exec
tagged with: java
downvote count: 3
tagged with: dosbox
has comment: http://stackoverflow.com/comment/39349701
has comment: http://stackoverflow.com/comment/39199933
type: Question
has comment: http://stackoverflow.com/comment/39200220
has comment: http://stackoverflow.com/comment/39200058
has comment: http://stackoverflow.com/comment/39351379
has comment: http://stackoverflow.com/comment/39200250
score: -3
has comment: http://stackoverflow.com/comment/39349691
upvote count: 0
has body: String run="c:\\Program Files\DOSBox-0.74\dosbox.exe dosbox -c mount c c:\games"; The word c c:\games gets removed. Please advise how do I prevent this? Should I use a literal to insert the spaces in the command?
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/39199980
has comment: http://stackoverflow.com/comment/39200025
favorite count: 0
has answer: http://stackoverflow.com/a/25256568
has title: DOSBox commands through Java Program-word gets removed

http://stackoverflow.com/q/25111149
upvote count: 3
type: UnansweredQuestion
has title: JSON.stringify(array) from jsp to servlet (loop using javax.json-api1.0. jar or javax.json-1.0.jar only)
has comment: http://stackoverflow.com/comment/39160118
score: 3
has comment: http://stackoverflow.com/comment/39079762
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39079894
tagged with: servlets
type: Question
has body: HTML : JS : var array = $.map($('table tr'), function (val, i) { var obj = {}, inputs = $(val).find('td input:not(:hidden)'); obj[inputs.filter(':first').val()] = $.map(inputs.not(':first'), function (val, i) { return val.value; }); return obj; }); alert(JSON.stringify(array)); $(document).on("click","#save",function(){ $.post("servlet.html","data="+JSON.stringify(array)+"",function(response){ }); }); Java servlet contains this : String data = request.getParameter("data"); data looks like this : [{"flag1":["orange","1.00","5"]},{"flag2":["apple","2.00","5"]}]//this is get from table row data using stringify i want to get on first loop using javax.json-api1.0.jar or javax.json-1.0.jar only : on first loop : flag1 Orange 1.00 5 on second loop : flag2 Apple 2.00 5 Any help will be best.
answer count: 1
tagged with: jar
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/39079737
has answer: http://stackoverflow.com/a/25158270

http://stackoverflow.com/comment/39160964
has text: `op1` and `op2` are *local* to the `Artithmatic` class's constructor.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25155225

http://stackoverflow.com/comment/45556501
type: Comment
comment on: http://stackoverflow.com/a/25224555
has text: An equivalent way to return: `return p2.getPrice() - p1.getPrice();` for descending, like above. Or, `return p1.getPrice() - p2.getPrice();` for ascending prices. :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39370919
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25203606
has text: C:\Users\MyUser\Pictures\Lighthouse.jpg works, and so does C:\Users\MyUser\stuff\projName\projectName\projectName\src\test\resources\Lighthouse.jpg. At this point I have the file stored in multiple locations. My code uses double slashes, of course.
type: Comment

datetime
tags question: http://stackoverflow.com/q/25134511
tags question: http://stackoverflow.com/q/25122796
tags question: http://stackoverflow.com/q/25081394
tags question: http://stackoverflow.com/q/25210882
tags question: http://stackoverflow.com/q/25197322
tags question: http://stackoverflow.com/q/25229124
tags question: http://stackoverflow.com/q/25226881
tags question: http://stackoverflow.com/q/25076329
tags question: http://stackoverflow.com/q/25204043
tags question: http://stackoverflow.com/q/25217356
tag name: datetime
tags question: http://stackoverflow.com/q/25154754
type: Tag
tags question: http://stackoverflow.com/q/25227357
tags question: http://stackoverflow.com/q/25078967

http://stackoverflow.com/comment/39182538
type: QuestionComment
comment on: http://stackoverflow.com/q/25139604
score: 0
has text: See: [Grouping and Aggregation in CQEngine with Java 8 Lambda Expressions](https://code.google.com/p/cqengine/#Java_version_8_or_later_-_lambda_expressions).
type: Comment

http://stackoverflow.com/q/25151295
score: 0
has body: I want to monitor whether a device has been attached to my computer. I can monitor it at Control Panel\Hardware and Sound\Devices and Printers. But how can I get this info in my Java code? The device is been attached with USB port and it's a keyboard and mouse simulator. I use it to remote control other computer
has answer: http://stackoverflow.com/a/25151702
answer count: 1
has comment: http://stackoverflow.com/comment/39154777
has comment: http://stackoverflow.com/comment/39154079
has comment: http://stackoverflow.com/comment/39154159
has title: How can I know that some devices have been connected with my computer?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/9932206
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39154093
accepted answer: http://stackoverflow.com/a/25151702
has comment: http://stackoverflow.com/comment/39154336
has comment: http://stackoverflow.com/comment/39154378

http://stackoverflow.com/comment/39091555
type: Comment
comment on: http://stackoverflow.com/q/25116778
score: 0
type: QuestionComment
has text: Just in case you didn't get it: **You can't declare global variables in java**, whether you add the static modifier or not. You have to move the declarations **inside the class** and make them static (or don't make them static, if they are associated with the `Table` object).

http://stackoverflow.com/comment/39083119
score: 1
has text: use native SQLQuery,not HQL with Session.createSQLQuery()
comment on: http://stackoverflow.com/q/25111422
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25117492
has comment: http://stackoverflow.com/comment/39090858
score: 0
upvote count: 1
has body: I never suggest you to use Reflection instead use getter method to access field directly. If still there is no option other than Reflection then try f.getType().getName().equals(JLabel.class.getName()) Read more...
has comment: http://stackoverflow.com/comment/39091489
type: Answer
has comment: http://stackoverflow.com/comment/39092955
answers question: http://stackoverflow.com/q/25117232
has comment: http://stackoverflow.com/comment/39090884
downvote count: 1
has comment: http://stackoverflow.com/comment/39090891
has comment: http://stackoverflow.com/comment/39090956
has comment: http://stackoverflow.com/comment/39093159

http://stackoverflow.com/comment/134717183
comment on: http://stackoverflow.com/a/25202635
type: Comment
score: 0
type: AnswerComment
has text: This is really not good because you'll end up polluting entities and also people will be wondering how entityManger is failing to map certain native query results to a POJO when they don't know where to find this. The should have allowed it to be picked up without an entity

http://stackoverflow.com/comment/39146032
type: QuestionComment
has text: yes it have already exist and checked it
score: 0
comment on: http://stackoverflow.com/q/25146938
type: Comment

http://stackoverflow.com/comment/39108930
type: Comment
has text: I added a link to the full stack trace in the question. Looks like this is an java.security.AccessControlException issue that is causing PropertyContainer to not be initialized.
type: AnswerComment
comment on: http://stackoverflow.com/a/25125386
score: 0

http://stackoverflow.com/a/25165871
downvote count: 0
answers question: http://stackoverflow.com/q/25143666
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25143666
score: 1
has body: You are programmatically opening a FileHandler on deploy so you have close and remove the FileHandler from the logger on undeploy. Per the FileHandler docs: Normally the "%u" unique field is set to 0. However, if the FileHandler tries to open the filename and finds the file is currently in use by another process it will increment the unique number field and try again. This will be repeated until FileHandler finds a file name that is not currently in use. If there is a conflict and no "%u" field has been specified, it will be added at the end of the filename after a dot. (This will be after any automatically added generation number.) You have to either setup your FileHandler via the logging.properties so it is only installed once or you have move your setup and teardown code to a ServletContextListener
has comment: http://stackoverflow.com/comment/39338237
type: AcceptedAnswer

http://stackoverflow.com/q/25087250
tagged with: eclipse
linked to: http://stackoverflow.com/q/14059685
type: Question
has body: I am using eclipse juno and maven plugin. I had a problems with maven at the begin after installation - it wasn't working. I marked an option "Download repository index updates on startup" and everything was fine. Now after week i try to search for some jars and it's not working again. Option with download on startup is still marked. I tried also : In Maven Repositories tab Expand Global Repositories, Right-click on central and Update Index. I updated Index, rebuilded it. One thing - when i add to pom.xml for example junit junit 3.8.1 test It's getting downloaded and looks fine, but GUI doesn't work
has comment: http://stackoverflow.com/comment/39035741
has comment: http://stackoverflow.com/comment/39037993
score: 0
has title: maven not searching(gui not working)
has comment: http://stackoverflow.com/comment/39037722
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/39050032
has comment: http://stackoverflow.com/comment/39037855
answer count: 0
tagged with: java

http://stackoverflow.com/a/25146993
upvote count: 1
type: Answer
has body: Keep track of the previous Transaction as you go through the list. Transaction prev = null; for (Transaction transaction : transactions) { if (transaction.equals(targetTransaction)) { System.out.println("Previous transaction: " + (prev = null ? "[none]" : prev)); } prev = transaction; }
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39147505
answers question: http://stackoverflow.com/q/25146945

http://stackoverflow.com/q/25193058
tagged with: java
downvote count: 2
tagged with: bukkit
linked to: http://stackoverflow.com/q/25196339
type: Question
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/39231585
tagged with: minecraft
has comment: http://stackoverflow.com/comment/39256658
has title: Reading arguments as Integer for a Bounty in a Bukkit plugin
has body: This is just the start of the plugin and there will be more. This is what I want to have: For /bounty &lt;name&gt; &lt;amount&gt; I want to be able to read what is read on the amount to make a variable like int a = args[1], but I don't know how to do that. I have tried and it gave me some errors. I also want it so it can only be a number on the command. I am using bukkit version: craftbukkit-1.7.10-R0.1-20140804.183445-7 Here is my code: public class Main extends JavaPlugin { public void onEnable() { Bukkit.getServer().getLogger().info("[Bounty] Enabled"); Bukkit.getServer().getLogger().info("[Bounty] Developed by ITaco_v2"); } public void onDisable() { Bukkit.getServer().getLogger().info("[Bounty] Disabled"); } public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if ( !(sender instanceof Player)) { sender.sendMessage(ChatColor.RED + "[" + ChatColor.GREEN + "Bounty" + ChatColor.RED + "] " + ChatColor.GOLD + "In game use only!"); return true; } if (cmd.getName().equalsIgnoreCase("bounty")) { if (sender.hasPermission("bounty.setbounty")); if (args.length == 0) { sender.sendMessage(ChatColor.RED + "Please specify a Player and a bounty amount."); sender.sendMessage(ChatColor.GREEN + "Like this: /bounty &lt;playername&gt; &lt;amount&gt;"); return true; } Player target = Bukkit.getServer().getPlayer(args[0]); if (target == null) { sender.sendMessage(ChatColor.RED + "Could not find player!"); return true; } if (target != null) { sender.sendMessage(ChatColor.RED + "Please specify a bounty amount."); sender.sendMessage(ChatColor.GREEN + "Like this: /bounty " + args[0] + " &lt;amount&gt;"); return true; } } return false; } }
has comment: http://stackoverflow.com/comment/39231472
favorite count: 0
has comment: http://stackoverflow.com/comment/39235381
has answer: http://stackoverflow.com/a/25207944
has answer: http://stackoverflow.com/a/25215580
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39259400
score: 2

http://stackoverflow.com/a/25225872
downvote count: 0
answers question: http://stackoverflow.com/q/25225839
has body: ans[indexThatYouWantToaccess] make sure array index starts with 0 ans[0] -&gt; + ans[1] -&gt; - ans[2] -&gt; / ans[3] -&gt; *
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/q/25086361
tagged with: dependency-injection
has title: Spring Data JPA - Why do I get null bean exception in the test?
tagged with: jpa
score: 0
tagged with: spring-data-jpa
has answer: http://stackoverflow.com/a/25086774
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25086400
linked to: http://stackoverflow.com/q/23319864
tagged with: java
has body: I want to use Spring Data JPA to do the ORM. I have the following declared repository interface: public interface SegmentRepository extends JpaRepository&lt;Segment, Integer&gt; { // query methods ... } Following is the Java Config class: @Configuration @EnableJpaRepositories("com.example.cap.repositories") @EnableTransactionManagement public class CAPRepositoryConfig { @Bean public DataSource dataSource() { BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName(org.postgresql.Driver.class.getName()); ds.setUsername("postgres"); ds.setPassword("password"); ds.setUrl("jdbc:postgresql://localhost:5432/postgres"); ds.setInitialSize(10); return ds; } @Bean public EntityManagerFactory entityManagerFactory() { EclipseLinkJpaVendorAdapter vendorAdapter = new EclipseLinkJpaVendorAdapter(); vendorAdapter.setGenerateDdl(true); LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); Map&lt;String, Object&gt; jpaProperties = new HashMap&lt;String, Object&gt;(); jpaProperties.put("eclipselink.weaving", "false"); factory.setJpaVendorAdapter(vendorAdapter); factory.setPackagesToScan("com.example.cap.repositories"); factory.setDataSource(dataSource()); factory.setJpaPropertyMap(jpaProperties); factory.afterPropertiesSet(); return factory.getObject(); } @Bean public PlatformTransactionManager transactionManager() { JpaTransactionManager txManager = new JpaTransactionManager(); txManager.setEntityManagerFactory(entityManagerFactory()); return txManager; } } And the Segment class is defined in com.example.cap.repositories as: @Entity public class Segment { @Id private int segmentID; private int caseID; private Timestamp segStartTime; private Timestamp segEndTime; //setter and getters } But when I run the JUnit test using auto injected bean SegmentRepository, I got null point exception for the bean repository: @ContextConfiguration(classes=CAPRepositoryConfig.class) public class CAPRepositoryTest { @Autowired private SegmentRepository r…
tagged with: spring-java-config
type: Question
answer count: 2

http://stackoverflow.com/comment/39059360
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25100422
has text: run program, click on a button, click on the red border button and change the action(change color of the buttons - from the red border button to the blue border button)...but even JOptionPane is ok, as long as I manage to change the action.
score: 0

http://stackoverflow.com/comment/39319537
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25167225
has text: I understood the algo, so accepted it. But stuck at `You could maintain an FTL variable for each column`. :( How to do this?
type: Comment

http://stackoverflow.com/comment/39583048
has text: its working in mvc i have used your suggestion but page is loading slow i will discuss that part by tomorrow and that is last task of this image issue..
comment on: http://stackoverflow.com/a/25378720
type: AnswerComment
score: 0
type: Comment

jax-rs
tags question: http://stackoverflow.com/q/25145657
tags question: http://stackoverflow.com/q/25229880
tags question: http://stackoverflow.com/q/25130475
tags question: http://stackoverflow.com/q/25204794
tags question: http://stackoverflow.com/q/25155017
tags question: http://stackoverflow.com/q/25225901
tags question: http://stackoverflow.com/q/25164116
tags question: http://stackoverflow.com/q/25145216
tags question: http://stackoverflow.com/q/25110794
tags question: http://stackoverflow.com/q/25196427
tags question: http://stackoverflow.com/q/25185115
tags question: http://stackoverflow.com/q/25092244
tags question: http://stackoverflow.com/q/25172318
tags question: http://stackoverflow.com/q/25088242
type: Tag
tags question: http://stackoverflow.com/q/25138729
tags question: http://stackoverflow.com/q/25090181
tags question: http://stackoverflow.com/q/25162856
tags question: http://stackoverflow.com/q/25075296
tag name: jax-rs
tags question: http://stackoverflow.com/q/25178834

http://stackoverflow.com/comment/39211629
type: QuestionComment
comment on: http://stackoverflow.com/q/25179863
has text: Can you just subclass the loader and override the methods?
score: 0
type: Comment

http://stackoverflow.com/comment/39255367
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25205894
has text: are the elements unique, do you have to retreive by index, is the collection legnth known - basic stuff
type: Comment

http://stackoverflow.com/a/55232425
has comment: http://stackoverflow.com/comment/139666565
has comment: http://stackoverflow.com/comment/138001953
has comment: http://stackoverflow.com/comment/137508148
has comment: http://stackoverflow.com/comment/139637864
has body: Method to convert a List<List> to List : listOfLists.stream().flatMap(List::stream).collect(Collectors.toList()); See this example: public class Example { public static void main(String[] args) { List<List<String>> listOfLists = Collections.singletonList(Arrays.asList("a", "b", "v")); List<String> list = listOfLists.stream().flatMap(List::stream).collect(Collectors.toList()); System.out.println("listOfLists => " + listOfLists); System.out.println("list => " + list); } } It prints: listOfLists => a, b, c list => [a, b, c] In Python this can be done using List Comprehension. list_of_lists = [['Roopa','Roopi','Tabu', 'Soudipta'],[180.0, 1231, 2112, 3112], [130], [158.2], [220.2]] flatten = [val for sublist in list_of_lists for val in sublist] print(flatten) ['Roopa', 'Roopi', 'Tabu', 'Soudipta', 180.0, 1231, 2112, 3112, 130, 158.2, 220.2]
type: Answer
score: 69
answers question: http://stackoverflow.com/q/25147094
has comment: http://stackoverflow.com/comment/123115287
downvote count: 1
has comment: http://stackoverflow.com/comment/137201152
upvote count: 70

http://stackoverflow.com/comment/39033782
has text: It sounds like you're creating a timed cache. May I suggest ehcache? (Cache eviction is tricky.)
score: 0
comment on: http://stackoverflow.com/q/25086574
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39007309
has text: Or a Swing `Timer` or a `SwingWorker`...but which is right for the context of the OP?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25072695
type: AnswerComment

http://stackoverflow.com/q/25131719
type: Question
tagged with: java
has title: How to prevent restrict access to a web application to authorized devices only?
has comment: http://stackoverflow.com/comment/39117472
has comment: http://stackoverflow.com/comment/39117519
has answer: http://stackoverflow.com/a/25131886
has body: I have developed an MVC web app. Right now, the client using this app in office area. The client has requested that no one should use this app on any device except the office's PC/tablets. Now problem is, it's a web app, so how can I put restrictions that nobody can use this app from the outside of the office or with devices other with than office's PC/Tablets?
answer count: 1
tagged with: jsp
tagged with: javascript
linked to: http://stackoverflow.com/q/1238963
score: 0
type: UnansweredQuestion

http://stackoverflow.com/a/25195149
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25195028
answers question: http://stackoverflow.com/q/25195028
type: Answer
has body: document.getAllElements() works, and produces the same results as document.select("*")
downvote count: 0
score: 1

http://stackoverflow.com/q/25216758
score: -1
has comment: http://stackoverflow.com/comment/39276000
has answer: http://stackoverflow.com/a/25217209
has comment: http://stackoverflow.com/comment/39276074
has comment: http://stackoverflow.com/comment/39278510
favorite count: 0
has comment: http://stackoverflow.com/comment/39276075
type: UnansweredQuestion
has title: check number in array
has comment: http://stackoverflow.com/comment/39275991
has answer: http://stackoverflow.com/a/25216821
has comment: http://stackoverflow.com/comment/39276032
tagged with: performance
has body: Fast way to check integer in the array. Array has not continuous integer in it, instead it has spatial numbers e.g. [1,4,11, 120,2,3]. In time efficient way, how do one check 3 in [212,31219,1,12,4]? Result is false
tagged with: java
has comment: http://stackoverflow.com/comment/39276408
downvote count: 1
type: Question
answer count: 2
upvote count: 0

http://stackoverflow.com/q/25088742
answer count: 0
tagged with: powermock
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/49392960
tagged with: playframework-2.0
has title: Play framework - How to write unit test using mockito for promise/response map function?
tagged with: java
type: Question
tagged with: mockito
upvote count: 6
has body: I am trying to write unit test using mockito + powermock for the following portion of code. WS.WSRequestHolder holder = F.Promise&lt;Result&gt; resultPromise = holder.get().map( new Function&lt;WS.Response, Result&gt;(){ @Override public Result apply(WS.Response response){ return processResponse(response, ctx, watch); } }); I am wondering how can I set expectations and provide mock for holder.get and map function.
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/25151693
has body: Well, sadly I do not even know how to describe this error lol :( I want to display an image which I have stored it's path in the database. And my code works perfectly for the first time it accesses into the database. However, my code retrieves null for the second time it goes to the database and so on. I stared at my code for couple hours but couldnt find the bug lol :( getimage.jsp &lt;form action="getimage" method="get"&gt; &lt;input type="text"&gt; &lt;input type="submit" name="getimage"&gt; &lt;/form&gt; &lt;c:forEach var="image" items="${image_path}"&gt; &lt;img src="${image}"/&gt; &lt;/c:forEach&gt; servlet: HttpSession session = request.getSession(); session.removeAttribute("image_path"); List&lt;String&gt; list_image_path = new ArrayList&lt;String&gt;(); ImagePath img = ImageDao.getInstance().getPath(8); list_image_path.add(img.getImagePath()); session.setAttribute("image_path", list_image_path); System.out.println(img); request.getRequestDispatcher("getimage.jsp").forward(request, response); ImageDao.java private ImageDao() { try { conn = MyDatabase.getConnection(); } catch (SQLException e) { System.out.println( e.getClass() + " - Can not connect to the databse"); e.printStackTrace(); } } public static ImageDao getInstance() { if(instance == null) { synchronized( UsersDao.class) { if( instance == null ){ instance = new ImageDao(); } } } return instance; } public static ImagePath getPath( long id) { ImagePath path = new ImagePath(); String sql = "SELECT * FROM item_image WHERE id=?"; try { System.out.println(id + ": " + conn); PreparedStatement pstmt = conn.prepareStatement( sql ); pstmt.setLong(1, id); ResultSet rs = pstmt.executeQuery(); // Fail right here if( rs.next() ) { System.out.println( rs.getLong("id") + ": " + rs.getString("path") + " " + id); path.setId( rs.getLong( "id" )); path.setImagePath( rs.getString("path")); } pstmt.close(); rs.close(); conn.close(); return path; } catch( SQLException e ) { System.out.println("Cant get it"); } finally { i…
tagged with: jsp
tagged with: postgresql
has comment: http://stackoverflow.com/comment/39154981
has title: null data for second access
answer count: 1
linked to: http://stackoverflow.com/q/10202768
has answer: http://stackoverflow.com/a/25151813
score: 0
has comment: http://stackoverflow.com/comment/39154828
has comment: http://stackoverflow.com/comment/39155022
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39155245
accepted answer: http://stackoverflow.com/a/25151813
type: Question

http://stackoverflow.com/comment/39200029
has text: i used private `String expiredDate;` `public void setexpiredDate(String expiredDate) `{ this.expiredDate = expiredDate; }` `public String getexpiredDate()` `{ return expiredDate;` }`
comment on: http://stackoverflow.com/a/25175870
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25224362
has comment: http://stackoverflow.com/comment/39289710
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39352410
has body: Shouldn't you do: password = self.pass and then md.update(password) ?
score: 1
has comment: http://stackoverflow.com/comment/39299719
has comment: http://stackoverflow.com/comment/39301406
answers question: http://stackoverflow.com/q/25221120

http://stackoverflow.com/q/25105305
upvote count: 2
tagged with: encryption
has title: NullPointerException for my implementation of Cipher
tagged with: cryptography
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25105306
tagged with: java
has body: I'm trying to implement Cipher, using the protected constructor of that class: protected Cipher(CipherSpi cipherSpi, Provider provider, String transformation) but it fails with a NullPointerException without any message within that constructor. I've supplied all arguments, even my own CipherSpi, so why does it throw this exception?
type: Question
has comment: http://stackoverflow.com/comment/39083104
has comment: http://stackoverflow.com/comment/39084837
accepted answer: http://stackoverflow.com/a/25105306
has comment: http://stackoverflow.com/comment/39081309
tagged with: security
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39084447
favorite count: 0

http://stackoverflow.com/a/25210588
answers question: http://stackoverflow.com/q/25192135
type: Answer
has body: As for the children resizing with it's parent, that one is pretty easy with GridBagLayout. The important parts to remember in the GridBagConstraints are the fill, weightx and weighty. You can just do something like this in your frame -- it will put a scrollpane with a JTable in it that will resize with the frame: JScrollPane jScrollPane1 = new JScrollPane(); JTable jTable1 = new JTable(); GridBagConstraints gBC = new GridBagConstraints(); getContentPane().setLayout(new GridBagLayout()); jScrollPane1.setViewPortView(jTable1); gBC.fill = GridBagConstraints.BOTH; gBC.weightx = 1.0; gBC.weighty = 1.0; getContentPane().add(jScrollPane1, gBC);
score: 0

http://stackoverflow.com/comment/39126524
score: 1
comment on: http://stackoverflow.com/q/25129137
has text: It was a good idea to check it out as normal Java application. Strangely the problem was with entity.setChunked(true); Without that line it is working fine. I do not quite understand why.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25218184
has comment: http://stackoverflow.com/comment/39538938
type: UnansweredQuestion
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/39295982
score: 1
tagged with: java
has body: I've been thinking on some fast and brilliant pixel - perfect collision detection between a circle and any sprite. I need to get 2 points of collision to be able to calculate a normal vector out of them later. I managed to come up with some solution but the more scaling is done in my game, the more inaccurate and unprecise this collision is...It seems as if the code I posted below, was good and correct becouse I have been checking it already a few times and spent a few days reading it again and again... I also checked visually that the collision masks and areas of collision are calculated perfectly fine in the code below so the problem definitely doesn't lay there but in this method. So I guess that the problem here is the loss of data in floating point arithmetic unless somebody finds a flaw in this method? If however the problem is really with the float loss of data, what other solution would you recommend to find 2 points of collision between circle and any other sprite in pixel perfect? I really liked my solution becouse it was relatively fast int xOffset1 = (int)colRectLeft; // left boundary of the collision area for the first sprite int xOffset2 = (int)colCircleLeft; // left boundary of the collision area for the circle sprite int yOffset1 = (int)colRectBottom; // bottom boundary of the collision area for the first sprite int yOffset2 = (int)colCircleBottom; // bottom boundary of the collision area for the circle sprite int width = (int)(colCircleRight - colCircleLeft); //width of the collision area - same for both sprites int height = (int)(colCircleTop - colCircleBottom); // height of the collision area same for both sprites // Pixel-perfect COLLISION DETECTION between circle and a sprite // my custom vector classes - nothing special Math2D.Vector_2 colRightPoint = new Math2D.Vector_2(-1, -1); // The right point of collision lying on the circle's circumference Math2D.Vector_2 colLeftPoint = new Math2D.Vector_2(-1, -1); // the left point of collision lying on…
tagged with: collision-detection
type: Question
has comment: http://stackoverflow.com/comment/39439904
has answer: http://stackoverflow.com/a/25251791
has comment: http://stackoverflow.com/comment/39439943
has title: A fast collision detection between a circle and a sprite in pixel perfect
answer count: 2
has comment: http://stackoverflow.com/comment/39288117
has comment: http://stackoverflow.com/comment/39294166
has answer: http://stackoverflow.com/a/25304760
downvote count: 0
favorite count: 0
tagged with: geometry
has comment: http://stackoverflow.com/comment/39286661

http://stackoverflow.com/comment/39017250
score: 0
has text: it should accept connections, as I have been told by the buddy that manages the server... maybe it's on my side that something is missing, like adding some certificates to my Java trust store? I have only added the .cert file...
type: Comment
comment on: http://stackoverflow.com/a/25077228
type: AnswerComment

http://stackoverflow.com/q/25154660
tagged with: java
upvote count: 1
has title: java Matcher returns the whole match
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25154692
accepted answer: http://stackoverflow.com/a/25154692
has body: I have a regex to get quizid from a string like completed"&lt;a target="_blank" href="/Quiz/Details/290"&gt; . this is my code String regex = "href=\"[^\"]+Quiz+[^\"\\d]+(\\d+)\""; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(sourceString); String quizid = matcher.group(); The regex is suppos to return 290 from my string completed"&lt;a target="_blank" href="/Quiz/Details/290"&gt; but what i get is href="/Quiz/Details/290. i think my regex is correct but i have no idea why the whole text is returned
tagged with: regex
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/25180697
tagged with: oracle-database
answer count: 1
tagged with: junit
has title: Setting timezone for individual tests on Eclipse
favorite count: 0
linked to: http://stackoverflow.com/q/23885579
has answer: http://stackoverflow.com/a/25193116
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
has body: I am writing tests for my Hibernate DAO implementations as I explained here and they run well when I execute them with Maven or on Eclipse with Run as -&gt; Maven test. The application uses Oracle so I had to define the TimeZone, and I did it adding Duser.timezone to the pom file as is described here. The problem is when I want to execute only one test method, because each method has its own running configuration on Eclipse, and it is disappointing to add the timezone to the VM arguments of each configuration. I have tried adding System.setProperty("user.timezone", "UTC") and also TimeZone.setDefault(new SimpleTimeZone(...)) to the @beforeClass method but it doesn't work. It shows the error ORA-01882: timezone region not found. I think that the cause is that @ContextConfiguration connects to the database before the @beforeClass method. I have found a workaround that is adding it as a default argument to the VM. I have done it at Windows -&gt; Preferences -&gt; Installed JREs. Do you know a better way of doing it?
type: Question
tagged with: testing
accepted answer: http://stackoverflow.com/a/25193116
linked to: http://stackoverflow.com/q/23466218
downvote count: 0

http://stackoverflow.com/comment/39250504
type: QuestionComment
has text: I simplified the data and removed some fields - from there is the error. I fiexed it.
comment on: http://stackoverflow.com/q/25203429
score: 0
type: Comment

http://stackoverflow.com/comment/39123771
type: Comment
comment on: http://stackoverflow.com/a/25135100
has text: thank's and sorry for my bad english but the problem:Error creating bean with name 'utenteDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.mauro.soclib.dao.UtenteDAO.sessionFactory; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.hibernate.SessionFactory] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations
type: AnswerComment
score: 0

http://stackoverflow.com/q/25126624
has body: Our Struts Action class should redirect output to a new tab depending on a form value -- not always. The standard suggestion is to add &lt;input type="button" onclick=openNewWindow('validate.do?param=myParam');" JS: openNewWindow: function(url) { window.open(url, "_blank"); } But this won't work for us. We should not automatically open a new tab in every case; it depends on a certain form value, which we have to check on the server-side in the Action class. Any thoughts on how to approach this?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25126802
accepted answer: http://stackoverflow.com/a/25126802
has title: Redirect Struts Action Result to a New Tab based on Form Value
type: Question
answer count: 1
tagged with: jsp
tagged with: javascript
tagged with: struts
score: 0

http://stackoverflow.com/comment/39077620
has text: @SuzanCioc Take a closer look at the [Interrupts](http://docs.oracle.com/javase/tutorial/essential/concurrency/interrupt.html) section of the [Concurrency trail](http://docs.oracle.com/javase/tutorial/essential/concurrency/index.html) for information...
type: Comment
comment on: http://stackoverflow.com/a/25110004
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39014289
comment on: http://stackoverflow.com/q/25076329
type: QuestionComment
has text: @Orion I'm sure I've seen this year somewhere, but I don't remember if it was SimpleDateFormat or some other date related classes.
score: 0
type: Comment

http://stackoverflow.com/comment/39057871
type: AnswerComment
comment on: http://stackoverflow.com/a/25099731
type: Comment
has text: Just tried that, but it doesn't make any differenc - same error :/
score: 0

http://stackoverflow.com/a/25174841
upvote count: 3
has body: I would take a look at Executors, which would allow you to pool a series of tasks and have them executed within one or more threads automatically... For example... ExecutorService service = Executors.newFixedThreadPool(7); for (int h = 0; h &lt; convimagefolder.size(); h++) { /* CMYK conversion for jpg and tiff and also .psd conversion*/ destpathfinalconvs = new File(tempdir + "/" + convimagefolder.get(h)); service.submit(new ProcessTask( "CMYK to RGB jpg done for " + convimagefolder.get(h), new String[]{ "mogrify", "-colorspace", "RGB", destpathfinalconvs.toString() + "\\" + "*.jpg"} )); service.submit(new ProcessTask( "CMYK to RGB jpg done for " + convimagefolder.get(h), new String[]{ "mogrify", "-colorspace", "RGB", destpathfinalconvs.toString() + "\\" + "*.jpg"} )); service.submit(new ProcessTask( "cmyk tif to rgb done " + convimagefolder.get(h), new String[]{ "mogrify", "-colorspace", "RGB", destpathfinalconvs.toString() + "\\" + "*.tif"} )); service.submit(new ProcessTask( "psd to jpg done" + convimagefolder.get(h), new String[]{ "mogrify", "-format", "jpg", destpathfinalconvs.toString() + "\\" + "*.psd[0]"} )); service.submit(new ProcessTask( ".tif to jpg done successfully" + convimagefolder.get(h), new String[]{ "mogrify", "-format", "jpg", destpathfinalconvs.toString() + "\\" + "*.tif" } )); service.submit(new ProcessTask( ".pdf to jpg done successfully" + convimagefolder.get(h), new String[]{ "mogrify", "-format", "jpg", destpathfinalconvs.toString() + "\\" + "*.pdf" } )); service.submit(new ProcessTask( "image conversion done successfully" + convimagefolder.get(h), new String[]{ "mogrify", "-strip", "-quality", "50%", destpathfinalconvs.toString() + "\\" + "*.jpg"} )); } And the actually Callable task... public class ProcessTask implements Callable&lt;Integer&gt; { private String cmds[]; private String name; public ProcessTask(String name, String[] cmds) { this.cmds = cmds; this.name = name; } @Override public Integer call() throws Exception { System.out.…
score: 3
has comment: http://stackoverflow.com/comment/39199446
has comment: http://stackoverflow.com/comment/39199533
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25174673

nio
tags question: http://stackoverflow.com/q/25154768
tags question: http://stackoverflow.com/q/25100955
tags question: http://stackoverflow.com/q/25149502
tags question: http://stackoverflow.com/q/25142251
tags question: http://stackoverflow.com/q/25224604
tags question: http://stackoverflow.com/q/25198142
tag name: nio
tags question: http://stackoverflow.com/q/25225684
type: Tag
tags question: http://stackoverflow.com/q/25195128
tags question: http://stackoverflow.com/q/25094866
tags question: http://stackoverflow.com/q/25125798
tags question: http://stackoverflow.com/q/25099593
tags question: http://stackoverflow.com/q/25166314
tags question: http://stackoverflow.com/q/25167149
tags question: http://stackoverflow.com/q/25110538
tags question: http://stackoverflow.com/q/25169328

http://stackoverflow.com/a/25153178
type: Answer
has comment: http://stackoverflow.com/comment/39158207
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39158163
has body: How are you retrieving the token or doing Authorization? If you are using GoogleAuthUtil or GoogleAccountCredential API's, the persistance of token is automatically managed by API's themselves. You should not be required to do it manually. See this question on which one to use: Access to Google API - GoogleAccountCredential.usingOAuth2 vs GoogleAuthUtil.getToken()
accepted answer of: http://stackoverflow.com/q/25153075
upvote count: 2
answers question: http://stackoverflow.com/q/25153075
type: AcceptedAnswer

http://stackoverflow.com/q/25164502
upvote count: 2
tagged with: jaxb2
has answer: http://stackoverflow.com/a/25168321
has comment: http://stackoverflow.com/comment/39178560
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39178369
favorite count: 0
has comment: http://stackoverflow.com/comment/39196890
has comment: http://stackoverflow.com/comment/39190887
has comment: http://stackoverflow.com/comment/39243097
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: UnansweredQuestion
tagged with: java
has body: I want to write a XML file, I have the entity class which contains mapped objects. I added annotations.Now i have a button in JSF page which generate the XML file, but in the output file i found just the main class without the other mapped class which I've a the annotations. this is my mainClass: package esprit.olap.domain; @XmlRootElement(name="Schema") @XmlType(propOrder = { "parameters", "cubes", "dimensions", "catalogBase" }) @Entity public class SchemaBase implements Serializable{ @Id @GeneratedValue(strategy=GenerationType.AUTO) private int id_schema; private String name_schema; private String description_schema; private String measuresCaption_schema; private String defaultRole_schema; @ManyToOne(fetch=FetchType.LAZY) private CatalogBase catalogBase; @OneToMany (cascade={CascadeType.MERGE,CascadeType.ALL}) private List&lt;CubeBase&gt;cubes ; @OneToMany (cascade={CascadeType.MERGE,CascadeType.ALL}) private List&lt;ParameterBase&gt;parameters; @ManyToMany private List&lt;DimensionBase&gt; dimensions; public List&lt;ParameterBase&gt; getParameters() { return parameters; } @XmlElement(name="Parameter") public void setParameters(List&lt;ParameterBase&gt; parameters) { this.parameters = parameters; } public List&lt;DimensionBase&gt; getDimensions() { return dimensions; } @XmlElement(name="Dimension") public void setDimensions(List&lt;DimensionBase&gt; dimensions) { this.dimensions = dimensions; } public List&lt;CubeBase&gt; getCubes() { return cubes; } @XmlElement(name="Cube") public void setCubes(List&lt;CubeBase&gt; cubes) { this.cubes = cubes; } public CatalogBase getCatalogBase() { return catalogBase; } public void setCatalogBase(CatalogBase catalogBase) { this.catalogBase = catalogBase; } public int getId_schema() { return id_schema; } @XmlTransient public void setId_schema(int id_schema) { this.id_schema = id_schema; } public String getName_schema() { return name_schema; } @XmlAttribute(name="name") public void setName_schema(String name_schema) { this.name_sc…
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/39184539
has comment: http://stackoverflow.com/comment/39183155
has title: JAXB unable to marshal type "java.lang.Class"

http://stackoverflow.com/a/25117158
downvote count: 0
has comment: http://stackoverflow.com/comment/39094586
has comment: http://stackoverflow.com/comment/39090352
has comment: http://stackoverflow.com/comment/39091483
has comment: http://stackoverflow.com/comment/39090499
type: Answer
has comment: http://stackoverflow.com/comment/39093812
has body: Move the statement writer.close(); out of the inner try catch block so that you're not closing the OutputStream after writing the first entry to the file. The same applys to the InputStream inStream.close();
upvote count: 5
answers question: http://stackoverflow.com/q/25117115
score: 5
has comment: http://stackoverflow.com/comment/39093407
has comment: http://stackoverflow.com/comment/39095300
has comment: http://stackoverflow.com/comment/39090433
has comment: http://stackoverflow.com/comment/39091217

http://stackoverflow.com/comment/125830790
type: Comment
type: QuestionComment
score: 0
has text: Does this answer your question? [Can I use compareTo to sort integer and double values?](https://stackoverflow.com/questions/14178539/can-i-use-compareto-to-sort-integer-and-double-values)
comment on: http://stackoverflow.com/q/25145789

http://stackoverflow.com/comment/39049591
comment on: http://stackoverflow.com/q/25093985
score: 0
has text: public void setSelectedCell(int row, int column) { setCellSelectionEnabled(true); setRowSelectionInterval(row, row); setColumnSelectionInterval(column, column); }
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25224578
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25224601
type: UnansweredQuestion
has title: Reload a browser in java
tagged with: java
tagged with: reload
type: Question
has body: Hi guys I create a browser with this code and now I have to reload the browser (the browser is in my "java window") final Browser browser = new Browser(shlFreeViews, SWT.NONE); browser.setUrl(urls); browser.setBounds(10, 366, 888, 214);
tagged with: browser

http://stackoverflow.com/q/25099446
answer count: 1
tagged with: unicode
score: 0
has title: Decode unicode character representation from scraped JavaScript text using Java/Scala
tagged with: scala
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39131327
tagged with: java
has body: I'm using a web crawler (written in Scala) to get some content from various websites and I have to decode a unicode notation from a JavaScript snippet Capitali%20d%u2019Europa must be decoded as Capitali d’Europa But I cannot find a right tool to do it.
type: Question
has answer: http://stackoverflow.com/a/25099896
accepted answer: http://stackoverflow.com/a/25099896

http://stackoverflow.com/a/25183742
type: Answer
answers question: http://stackoverflow.com/q/25161448
accepted answer of: http://stackoverflow.com/q/25161448
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: I rectified my problem . I forgot to add a namespace. here is a snippet on How to set namespace in GAE DataStore. // Set the namepace temporarily to "abc" String oldNamespace = NamespaceManager.get(); NamespaceManager.set("abc"); try { ... perform operation using current namespace ... } finally { NamespaceManager.set(oldNamespace); }

http://stackoverflow.com/q/25185578
has comment: http://stackoverflow.com/comment/39361333
upvote count: 4
favorite count: 0
tagged with: spring
has title: Spring Security 3.2, CSRF and multipart requests
has answer: http://stackoverflow.com/a/25269365
accepted answer: http://stackoverflow.com/a/25269365
type: AnsweredQuestion
has body: This question is in relation to the question at this url Spring Security 3.2 CSRF support for multipart requests I tried this exact same setup as well as the gist but I cannot get this to work unless I have the _csrf token in the url. I had it in the form body as a hidden field and had the filter specified before the security filter but with no joy and it failed every time with the debug log message of an invalid csrf token Any help on this would be greatly appreciated Cheers Damien
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39301935
answer count: 1
score: 4
tagged with: spring-security
linked to: http://stackoverflow.com/q/21397939

http://stackoverflow.com/comment/39238863
comment on: http://stackoverflow.com/q/25195954
score: 0
type: QuestionComment
type: Comment
has text: and set text as nextMileage.setText(result+"");

http://stackoverflow.com/q/25118283
score: 0
answer count: 2
has body: I am on an assignment to work with Jython. I tried to install PyDev plugin to my eclipse ( Kepler service release 2 on Linux 64 bit machine )manually (dev machine doesnot have internet connection). But when I do manually by downloading .zip file and adding it as following: Help-> Install new software ->Add -> Archieve: but I am getting an error. No repository found at file:/home/lhananth/eclipse/dropins/PyDev%203.6.0.zip!. No repository found at file:/home/lhananth/eclipse/dropins/PyDev%203.6.0.zip!. I tried to manually add the unziped folders to dropin folder of eclipse but its not working as well- Python is not appearing as a selection in the Eclipse, Window, Preferences. Can some body help me out ? (I tried all the replies for similar posts available in stack overflow)
type: UnansweredQuestion
tagged with: python
tagged with: plugins
has answer: http://stackoverflow.com/a/25133261
tagged with: java
has title: Adding PyDev eclipse pulgin manually
type: Question
tagged with: eclipse
has answer: http://stackoverflow.com/a/25118341

http://stackoverflow.com/comment/39164807
comment on: http://stackoverflow.com/q/25157262
score: 0
type: Comment
type: QuestionComment
has text: Hi Peter, it won't make any difference - i read about that 'hint' to dispose the graphics in another SOF-article , but it won't make any difference, have a try on your own...

http://stackoverflow.com/comment/50985492
score: 0
comment on: http://stackoverflow.com/a/25164775
type: Comment
has text: It worked with version Kepler Service Release 2 in my pc.
type: AnswerComment

http://stackoverflow.com/q/25176514
tagged with: jdbc
duplicate of: http://stackoverflow.com/q/9428573
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39200889
upvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39233415
tagged with: thread-safety
has title: ThreadSafety in servlets
tagged with: servlets
answer count: 2
has body: There are many questions on thread safety of servlets, but I want to ask about the other classes that servlet uses. In a normal application the servlet classes uses other normal classes also (my appl do) like in MVC. So my question is should I declare all the functions in my model classes as synchronized Suppose I have 2 servlets and the use classes Dog and Cat. Both classes have some static and non static functions and static and non static variables. these methods uses database connection to display contents, and I got nullpointerexception for this code try { Connection con = DriverManager.getConnection(url, user, pass); Statement stmt = con.createStatement(); select = "SELECT * FROM table"; java.sql.ResultSet result = stmt.executeQuery(select); while(result.next()) { do something } } catch (SQLException e) { e.printStackTrace(); } finally { if (con != null) try { con.close(); } catch (Exception e) { e.printStackTrace(); } } and to my surprise i get the exception in line try { con.close(); } : nullPointerException To my understanding since I have already checked that if (con != null) so con should not be null. So, Should all the functions be synchronized Should all the functions using static variables be synchronized Should only the static functions be synchronized using Should only the static functions using static variables be synchronized
downvote count: 0
has comment: http://stackoverflow.com/comment/39201645
has answer: http://stackoverflow.com/a/25176773
favorite count: 0
tagged with: synchronized
possible better answer: http://stackoverflow.com/a/25176792
linked to: http://stackoverflow.com/q/9428573
has answer: http://stackoverflow.com/a/25176792
accepted answer: http://stackoverflow.com/a/25176773

http://stackoverflow.com/q/25112652
linked to: http://stackoverflow.com/q/25178329
tagged with: android-recyclerview
tagged with: java
linked to: http://stackoverflow.com/q/4274519
type: Question
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/39238702
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/39239005
tagged with: android
has body: Hi am try to create on demo there i want to fixed first row from RecyclerView, i have creted one list from that but i do't know how to fixed first row. Mylist.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="match_parent" tools:context="com.hmkcode.android.recyclerview.MainActivity" &gt; &lt;android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" /&gt; &lt;/RelativeLayout&gt; MainActivity.java import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView); ItemData itemsData[] = { new ItemData("Help", R.drawable.help), new ItemData("Delete", R.drawable.content_discard), new ItemData("Cloud", R.drawable.collections_cloud), new ItemData("Favorite", R.drawable.rating_favorite), new ItemData("Like", R.drawable.rating_good), new ItemData("Rating", R.drawable.rating_important), new ItemData("Help", R.drawable.help), new ItemData("Delete", R.drawable.content_discard), new ItemData("Cloud", R.drawable.collections_cloud), new ItemData("Favorite", R.drawable.rating_favorite), new ItemData("Like", R.drawable.rating_good), new ItemData("Rating", R.drawable.rating_important), new ItemData("Help", R.drawable.help), new ItemData("Delete", R.drawable.content_discard), new ItemData("Cloud", R.drawable.collections_cloud), new ItemD…
has title: How to fixed first row in RecyclerView Android?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39245906

http://stackoverflow.com/comment/39326282
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25200737
has text: Actually it would reduce readability as then the libraries' failure messages would be unable to indicate which line the error occurred on. :)
score: 0

http://stackoverflow.com/comment/39175747
type: Comment
type: QuestionComment
score: 0
has text: Don't know if this convention has a name: But what about enforcing to call the `super`-method in every method you override? This ensures proper extensions from the extending class, instead of enforcing it in the base class.
comment on: http://stackoverflow.com/q/25149595

http://stackoverflow.com/comment/39133474
type: QuestionComment
comment on: http://stackoverflow.com/q/25140355
has text: Project Structure -> Project -> Project language level, but are you sure you can use Java 1.7 on Android?
type: Comment
score: 0

http://stackoverflow.com/q/25200599
answer count: 2
tagged with: tomcat
tagged with: maven
has answer: http://stackoverflow.com/a/25290583
type: AnsweredQuestion
has title: Tomcat after undeploy/deploy a war makes NoClassDefFoundError: org.apache.xml.serializer.TreeWalker
tagged with: java
accepted answer: http://stackoverflow.com/a/25290583
has body: After deploying the same war which was perfectly OK before the deploy. I got this exception: java.lang.NoClassDefFoundError: org/apache/xml/serializer/utils/DOM2Helper at org.apache.xml.serializer.TreeWalker.&lt;init&gt;(TreeWalker.java:121) It is the part of serializer-2.7.1.jar and managed by maven. It seems somehow the undeploy/deploy proccess screw the libs. Any idea how to get rid of this exception? Now the workaround just to restart the server after every deploy, but it is not nice. Maybe i should add the lib to tomcat lib, or new JRE/JDK can do the job? Update: tomcat/lib: annotations-api.jar catalina-storeconfig.jar ecj-P20140317-1600.jar jasper.jar tomcat-api.jar tomcat-i18n-es.jar tomcat-jdbc.jar tomcat-util-scan.jar websocket-api.jar catalina-ant.jar catalina-tribes.jar el-api.jar jsp-api.jar tomcat-coyote.jar tomcat-i18n-fr.jar tomcat-jni.jar tomcat-util.jar catalina-ha.jar catalina.jar jasper-el.jar servlet-api.jar tomcat-dbcp.jar tomcat-i18n-ja.jar tomcat-spdy.jar tomcat-websocket.jar Anyone has experience with this problem?
type: Question
possible better answer: http://stackoverflow.com/a/25200911
has answer: http://stackoverflow.com/a/25200911
score: 0

http://stackoverflow.com/comment/39215831
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25184930
has text: Your are looking for a "loop". Search for "java loop" and think of your condition "until"
type: Comment

http://stackoverflow.com/comment/79137870
score: 0
comment on: http://stackoverflow.com/q/25126505
type: Comment
type: QuestionComment
has text: What did you end up doing ?

http://stackoverflow.com/comment/39230392
type: Comment
has text: Thanks, but this match still includes the file type.
comment on: http://stackoverflow.com/a/25192431
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39128795
type: AnswerComment
score: 0
type: Comment
has text: It's working now, I did : `select * from compte_utilisateur where nom=? or id_utilisateur=?` and I added `pst.setString(1, textField1.getText()); pst.setString(2, textField1.getText()); pst.setString(3, textField1.getText());` Thank u for ur help
comment on: http://stackoverflow.com/a/25137775

http://stackoverflow.com/q/25224172
accepted answer: http://stackoverflow.com/a/25224205
score: 1
tagged with: java
has body: I do not understand why Java don't want to delete the file! I basically want to lock a file to avoid that my jar-file can start more than one time. Then after the action I want to delete the lock-file, but this seems for some reason not to be possible. Here is the code: package footballQuestioner; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridBagLayout; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.io.RandomAccessFile; import java.nio.channels.FileLock; import java.nio.file.Files; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import javax.imageio.ImageIO; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; public class attempter { public static void main(String[] args) throws FileNotFoundException, IOException { Ausgabe ausGabe=new Ausgabe(); } class Ausgabe { public Ausgabe() { tryToStart(); } public boolean tryToStart(){ File file1=new File("C:\\Users\\laudatio\\Downloads\\erzFeind.txt"); RandomAccessFile in=null; FileLock fileLock=null; file1.setWritable(true); try { file1.createNewFile(); in = new RandomAccessFile(file1, "rw"); fileLock = in.getChannel().tryLock(); if(fileLock == null) return false; } catch (Exception e) { e.printStackTrace(); } file1.delete(); return true; } }
type: Question
tagged with: locking
has answer: http://stackoverflow.com/a/25224205
has comment: http://stackoverflow.com/comment/39289445
answer count: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39289432
favorite count: 0
has comment: http://stackoverflow.com/comment/39289467
downvote count: 0
has title: Why I do not can delete the file?
has comment: http://stackoverflow.com/comment/39295556
type: AnsweredQuestion

http://stackoverflow.com/a/25132769
answers question: http://stackoverflow.com/q/25132623
score: 2
has body: Split your line on "," and add put the key and value to the map: public static void main(String[] args) throws IOException{ BufferedReader fl=new BufferedReader(new FileReader("T:/temp/Fileip.txt")); Map&lt;String, String&gt;map=new HashMap&lt;String, String&gt;(); List&lt;String&gt;str=new ArrayList&lt;String&gt;(); String ln=null; while((ln=fl.readLine())!=null){ String[] temp = ln.split(","); map.put(temp[0], temp[1]); } fl.close(); }
upvote count: 2
has comment: http://stackoverflow.com/comment/54898981
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39048316
score: 0
type: Comment
has text: @immibis No, when I tried from the shell, on successful copy it returns me the next line on the shell and the file got copied successfully.
type: QuestionComment
comment on: http://stackoverflow.com/q/25094261

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/25226937
tags question: http://stackoverflow.com/q/25090915
tags question: http://stackoverflow.com/q/25168084
tags question: http://stackoverflow.com/q/25200430
tags question: http://stackoverflow.com/q/25103426
tags question: http://stackoverflow.com/q/25122587
tags question: http://stackoverflow.com/q/25190672
tags question: http://stackoverflow.com/q/25134774
tags question: http://stackoverflow.com/q/25157738
tags question: http://stackoverflow.com/q/25194496
tags question: http://stackoverflow.com/q/25123849
tags question: http://stackoverflow.com/q/25221952
tags question: http://stackoverflow.com/q/25133807
tags question: http://stackoverflow.com/q/25134168
tags question: http://stackoverflow.com/q/25161073
tags question: http://stackoverflow.com/q/25087449
type: Tag
tags question: http://stackoverflow.com/q/25078885
tags question: http://stackoverflow.com/q/25078861
tags question: http://stackoverflow.com/q/25076077
tags question: http://stackoverflow.com/q/25076913
tags question: http://stackoverflow.com/q/25098705
tags question: http://stackoverflow.com/q/25151097
tags question: http://stackoverflow.com/q/25217734
tags question: http://stackoverflow.com/q/25178989
tags question: http://stackoverflow.com/q/25166287
tags question: http://stackoverflow.com/q/25091814
tags question: http://stackoverflow.com/q/25132115
tags question: http://stackoverflow.com/q/25148020
tags question: http://stackoverflow.com/q/25217687
tags question: http://stackoverflow.com/q/25184234
tags question: http://stackoverflow.com/q/25118619
tags question: http://stackoverflow.com/q/25189269
tags question: http://stackoverflow.com/q/25087457
tags question: http://stackoverflow.com/q/25202581
tags question: http://stackoverflow.com/q/25117383
tags question: http://stackoverflow.com/q/25152498
tags question: http://stackoverflow.com/q/25116129
tags question: http://stackoverflow.com/q/25118742
tags question: http://stackoverflow.com/q/25208105
tags question: http://stackoverflow.com/q/25187212
tags question: http://stackoverflow.com/q/25106425
tag name: html
tags question: http://stackoverflow.com/q/25127556
tags question: http://stackoverflow.com/q/25223984
tags question: http://stackoverflow.com/q/25102083
tags question: http://stackoverflow.com/q/25202545
tags question: http://stackoverflow.com/q/25195397
tags question: http://stackoverflow.com/q/25080554
tags question: http://stackoverflow.com/q/25074613
tags question: http://stackoverflow.com/q/25162041
tags question: http://stackoverflow.com/q/25147141
tags question: http://stackoverflow.com/q/25073461
tags question: http://stackoverflow.com/q/25228911

http://stackoverflow.com/comment/39168479
type: QuestionComment
has text: See http://stackoverflow.com/a/1234762/545127
comment on: http://stackoverflow.com/q/25159221
score: 0
type: Comment

http://stackoverflow.com/a/25214173
answers question: http://stackoverflow.com/q/25214137
type: Answer
upvote count: 6
score: 6
has body: You can simply do: \\\"category_keyword\\\" \\ => You are escaping the slash \ \" => You are escaping the quote " public class Class{ public static void main(String[] a){ System.out.println(" \\\"Ferrari\\\" "); } }
accepted answer of: http://stackoverflow.com/q/25214137
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25070774
tagged with: cplex
has comment: http://stackoverflow.com/comment/41115412
tagged with: java
has comment: http://stackoverflow.com/comment/39004107
answer count: 0
has comment: http://stackoverflow.com/comment/39033179
type: UnansweredQuestion
has body: I have tried modelling the expression Sum_j (1-(Sum_i z[i][j])) * c[i][j], where z[i][j] are my boolean variables of the obj function. I tried this by modelling as an expression every column of the array and then an expression for 1-sum of collumns and so forth. Something like sum(prod(sum(1,negative(sum_j)),c[ij])). But didn't make it. I would like a little help. Thanks [edit]My objective function would be "Sum_i Sum_j c[ij]*z[ij] + Sum_j (1-(Sum_i z[i][j])) * uc[j]" , where z(ij) are the decision variables and the others are known. My problem is that i am trying to decompose the expression into smaller subexpressions. So afterwards i want to somehow merge them. IloNumExpr[] colexpr = new IloLinearNumExpr[commuters]; IloNumExpr[] colexpr2 = new IloLinearNumExpr[commuters]; IloNumExpr[] colprod = new IloLinearNumExpr[commuters]; IloNumExpr[] firstpart = new IloLinearNumExpr[commuters]; IloNumExpr[] finalobj = new IloLinearNumExpr[commuters]; IloNumExpr[] obj = new IloLinearNumExpr[commuters]; //1st part of objective for(int i=0; i&lt;2; i++){ for(int j=0; j&lt;4;j++){ firstpart[j] = cplex.prod(dr[i][j], z[i][j]); } } //2nd part of objective for(int j=0;j&lt;4;j++){ for (int i=0;i&lt;2;i++){ cplex.sum(colexpr[j],1); } colexpr2[j] = cplex.sum(1,cplex.negative(colexpr[j])); } for(int j=0;j&lt;4;j++){ colprod[j] = cplex.prod(colexpr2[j],costs[j]); } //trying to merge 1st and 2nd part of objective function for(int j=0;j&lt;4;j++){ finalobj[j]= cplex.sum(firstpart[j],colprod[j]); } for(int j=0; j&lt;4;j++){ //obj[j].addTerm(1.0,finalobj[j]); cplex.addMaximize(finalobj[j]); } The part that confuses me more is how to pass in an expression the sum of the columns of arrays, and how to merge two expressions and pass it to cplex.addMaximize. Many times i get a compiler error ArrayStoreException because of IloNumVar and IlolinearNumVar.
has title: cplex java api modelling 1-sum_j 2d array
type: Question
score: 0

http://stackoverflow.com/a/59842532
has body: First, this is not the way to set your taskDescription. To set your taskDescription you need to use this method: ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("label"); this.setTaskDescription(taskDescription); This is a simple constructor of TaskDescription, for more constructors, check: https://developer.android.com/reference/android/app/ActivityManager.TaskDescription You can set more description variables there. Secondly, am.getRunningTasks(2).get(0).description this was depricated a while ago, however, some vendors even didn't allow it to be used before that. To check your description if it is set to your value, for example, you can run adb shell dumpsys activity activities However, if you really want to check it in runtime, it is available after API 21: final ActivityManager am = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE); List&lt;ActivityManager.AppTask&gt; appTasks = am.getAppTasks(); for(ActivityManager.AppTask task : appTasks) { Log.d("TaskDesc", "taskDesc: " + task.getTaskInfo().taskDescription); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25199404

http://stackoverflow.com/q/25225684
has body: I am trying to implement a simple nio server which accepts connection on the 8070 and instantiates a new thread for each of the clients. It basically echoes back the input text read to the client by changing its case.I am able to connect to the server but my expected functionality of the server echoing back is not working. Below is the source code for it. So can someone help me troubleshoot the problems with it? public class NewIOServer { public static void main(String[] args) throws IOException { ServerSocketChannel ssc = ServerSocketChannel.open(); ssc.socket().bind(new InetSocketAddress("localhost", 8070)); ExecutorService pool = Executors.newFixedThreadPool(1000); while(true) { SocketChannel s = ssc.accept(); pool.submit(new Util(s)); } } } public class Util implements Runnable { SocketChannel sc; public Util(SocketChannel sc) { this.sc = sc; } @Override public void run() { try { process(); } catch (IOException e) { e.printStackTrace(); } } private void process() throws IOException { System.out.println("Connection from:" + this.sc); ByteBuffer buf = ByteBuffer.allocateDirect(1024); while(sc.read(buf) != -1) { buf.flip(); for(int i=0; i&lt;buf.limit(); i++) { buf.put(i, (byte)transmogrify((int)buf.get(i))); } } sc.write(buf); buf.clear(); } public static int transmogrify(int data) { if(Character.isLetter(data)) { return data ^ ' '; } return data; } } PS: I have tried implementing the same functionality with blocking io using serversocket and socket which works fine.
type: Question
accepted answer: http://stackoverflow.com/a/25226377
score: -2
tagged with: echo-server
has title: Java NIO server in blocking mode not working
tagged with: nio
has comment: http://stackoverflow.com/comment/39299146
answer count: 2
has comment: http://stackoverflow.com/comment/39296324
upvote count: 0
has answer: http://stackoverflow.com/a/25227476
favorite count: 0
possible better answer: http://stackoverflow.com/a/25227476
has answer: http://stackoverflow.com/a/25226377
type: AnsweredQuestion
tagged with: java
downvote count: 2
tagged with: multithreading

http://stackoverflow.com/a/25089478
has comment: http://stackoverflow.com/comment/39056808
type: Answer
has comment: http://stackoverflow.com/comment/39102028
has comment: http://stackoverflow.com/comment/39103327
has body: In your getitem case 1 needs to be listed before the default
answers question: http://stackoverflow.com/q/25088725
score: 0

http://stackoverflow.com/a/25154826
has comment: http://stackoverflow.com/comment/39160352
has body: The call to driver.quit() closes the browser and end the Selenium driver itself, that's why you get the exception the next time you want to access the driver. We used JUnit for our Selenium tests and used the @beforeClass and @afterClass parts to setup and shutdown Selenium. So every test class used it's own browser session, and all tests within that class shared the same one. @beforeClass was also the part where we opend the page and logged in and did an initial login-successful-validation assertion.
score: 0
answers question: http://stackoverflow.com/q/25154230
has comment: http://stackoverflow.com/comment/39162969
type: Answer

line
tags question: http://stackoverflow.com/q/25194375
tag name: line
type: Tag

http://stackoverflow.com/comment/39111908
comment on: http://stackoverflow.com/q/25128155
score: 0
type: Comment
type: QuestionComment
has text: You should really have two separate `List` objects for this, then only instantiate the one that meets `Some Condition`. Don't forget to do a null check before continuing.

http://stackoverflow.com/q/25183968
type: AnsweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/39213838
type: Question
has body: how to use camera using swing in java with the ubuntu OS please give me some examples and guidelines to use camera through the java. public static void main(String[] args) { CamDemo t = new CamDemo(); t.getCam(); } public void getCam() { try { /* Grab the default web cam */ MediaLocator ml = new MediaLocator("vfw://0"); DataSource ds = Manager.createDataSource(ml); requestFormatResolution(ds); Player p = Manager.createRealizedPlayer(ds); p.start(); Thread.currentThread().sleep(1000); JFrame jfrm = new JFrame("Testing Webcam"); jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); if (p.getVisualComponent() != null) jfrm.getContentPane().add(p.getVisualComponent()); if (p.getControlPanelComponent() != null) jfrm.getContentPane().add(p.getControlPanelComponent(), BorderLayout.SOUTH); jfrm.pack(); jfrm.setLocationRelativeTo(null); jfrm.setVisible(true); jfrm.setSize(320, 240); } catch (Exception e) { e.printStackTrace(); } } public boolean requestFormatResolution(DataSource ds) { if (ds instanceof CaptureDevice) { FormatControl[] fcs = ((CaptureDevice) ds).getFormatControls(); for (FormatControl fc : fcs) { Format[] formats = ((FormatControl) fc).getSupportedFormats(); for (Format format : formats) { if ((format instanceof VideoFormat) &amp;&amp; (((VideoFormat) format).getSize().getHeight() &lt;= 240) &amp;&amp; (((VideoFormat) format).getSize().getWidth() &lt;= 320)) { ((FormatControl) fc).setFormat(format); return true; } } } } return false; } } Stacktrace: javax.media.NoDataSourceException: Cannot find a DataSource for: vfw://0 at javax.media.Manager.createDataSource(Manager.java:1037) at com.convoy.gpack.pack.CamDemo.getCam(CamDemo.java:32) at com.convoy.gpack.pack.CamDemo.main(CamDemo.java:16)
has title: Using the camera of the laptop with swing in java
score: -5
has comment: http://stackoverflow.com/comment/39214387
tagged with: camera
tagged with: java
has comment: http://stackoverflow.com/comment/39213995
has comment: http://stackoverflow.com/comment/39214299
answer count: 2
has comment: http://stackoverflow.com/comment/39215150
upvote count: 1
has answer: http://stackoverflow.com/a/25184095
has comment: http://stackoverflow.com/comment/39213929
accepted answer: http://stackoverflow.com/a/25184159
downvote count: 6
favorite count: 0
linked to: http://stackoverflow.com/q/11487251
has comment: http://stackoverflow.com/comment/39213765
possible better answer: http://stackoverflow.com/a/25184095
has answer: http://stackoverflow.com/a/25184159
has comment: http://stackoverflow.com/comment/39215166

http://stackoverflow.com/comment/39293858
has text: @Samboni: I think it's a good idea to *always* specify the encoding - even if you deliberately use the platform default encoding, it makes your code really clear if you do that explicitly. But personally I'd almost always just use UTF-8 explicitly. I very rarely see a benefit in using the platform default.
type: Comment
comment on: http://stackoverflow.com/a/25226190
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39273140
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25215052
type: Comment
has text: i think this android:descendantFocusability="beforeDescendants" or ScrollView s = (ScrollView) findViewById(R.id.scrollProfile).requestFocus(); should work weather you have edit text or not

http://stackoverflow.com/comment/39130334
type: AnswerComment
comment on: http://stackoverflow.com/a/25138125
score: 0
type: Comment
has text: Ultimately, what happens *inside* the class is a matter of programmer self-discipline. This sounds rather like "change for the sake of it". The benefit is ... small at best. And very much a matter of opinion.

http://stackoverflow.com/comment/39203901
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25178352
has text: "Unfortunately, Wallpaper has stopped" that is what it says
score: 0

http://stackoverflow.com/a/25110535
score: -1
downvote count: 1
has body: Yes you can have whatever name for the getter and setter methods you want. In fact they don't have to even seem related to your variable. I would not suggest that because that is not a good programing practice. Try it and you will see.
has comment: http://stackoverflow.com/comment/39081775
upvote count: 0
answers question: http://stackoverflow.com/q/25110520
type: Answer

http://stackoverflow.com/comment/39235349
score: 0
type: Comment
type: QuestionComment
has text: @DjaildoQuaresma Im gonna assume that too, and I believe everyone does, without you posting your current code
comment on: http://stackoverflow.com/q/25195108

http://stackoverflow.com/comment/39207128
type: QuestionComment
has text: Why do we need a screenshot of the script, can't you just include it in the question?
type: Comment
comment on: http://stackoverflow.com/q/25180306
score: 0

http://stackoverflow.com/a/25105344
type: Answer
downvote count: 0
score: 1
has body: You need a new object for each span, or else it will be moved and end up on the last span. while (matcher.find()) { ForegroundColorSpan hash_color = ForegroundColorSpan(cxt.getResources().getColor(R.color.light_blue)); spannable.setSpan( hash_color, matcher.start(), matcher.end(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE ); } Same for the other loops.
answers question: http://stackoverflow.com/q/25103572
accepted answer of: http://stackoverflow.com/q/25103572
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/39099928
type: QuestionComment
type: Comment
has text: did that too..still same error
score: 0
comment on: http://stackoverflow.com/q/25104867

http://stackoverflow.com/comment/39292522
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25225780
has text: While true, this doesn't explain why they insist on an array, where a single String would also work.

http://stackoverflow.com/comment/39205913
has text: Did you try session.createFilter method? You can get transaction's list ordered by id desc and than set max results to 1 using [setMaxResults(int)](http://docs.oracle.com/javaee/6/api/javax/persistence/Query.html#setMaxResults(int))
type: Comment
comment on: http://stackoverflow.com/q/25178898
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39070524
comment on: http://stackoverflow.com/q/25105816
has text: @BasilBourque thnx for you comment but i have already checked them
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/57834636
type: AnswerComment
type: Comment
score: 3
has text: I think this should be the accepted answer. `th:class` replaces/rewrite your class attribute. `th:classappend` is what you want.
comment on: http://stackoverflow.com/a/26977255

http://stackoverflow.com/q/25140342
has comment: http://stackoverflow.com/comment/39137042
has body: I am experiencing a few problems with the swing borders after upgrading from Java 1.7 to Java 1.8: On all my buttons, I need a solid background-color and a solid border, so I defined that via UIManager. On Java 1.7 and previous versions everything looks good, but on Java 1.8 the border is all messed up. Also the RadioButton looks very strange and jaggy. CheckBoxes also seem to have a problem. For demonstration I created a short sample with a few components: import java.awt.Color; import java.awt.FlowLayout; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.JToggleButton; import javax.swing.UIManager; public class CompDemo extends JFrame { public CompDemo() { setLayout(new FlowLayout()); add(new JButton("button")); add(new JTextField("txt")); add(new JComboBox&lt;String&gt;()); add(new JRadioButton("radio")); add(new JToggleButton("toggle")); add(new JCheckBox("check")); pack(); setVisible(true); } public static void main(String[] args) { UIManager.put("Button.background", Color.LIGHT_GRAY); UIManager.put("Button.border", BorderFactory.createCompoundBorder(BorderFactory .createLineBorder(Color.RED), BorderFactory.createLineBorder(Color.CYAN))); new CompDemo(); } } Here you can see the output with different JDK versions (scaled up to 200 percent without anti aliasing): The first one is Java 7u60 and displays everything correct. On the second picture I circled the differences. The third one is with Java 8u11 and as you can see the borders are quite messed up (and the dropdown arrow looks strange as well). I used a cyan LineBorder inside a red LineBorder so you can see the problem more clearly. My OS is Windows 8 x64, if it matters. Can anyone tell me why this looks so different on Java 8? Did I miss something or did they really mess up the borders in Java 1.8? Do I have to file a bug report…
answer count: 1
tagged with: user-interface
linked to: http://stackoverflow.com/q/22737535
upvote count: 11
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39134371
has title: Java 1.8 borders rendered incorrectly
tagged with: swing
score: 11
tagged with: java
tagged with: look-and-feel
has comment: http://stackoverflow.com/comment/39134454
has comment: http://stackoverflow.com/comment/39136106
type: Question
has answer: http://stackoverflow.com/a/25157607
downvote count: 0

http://stackoverflow.com/comment/39092547
comment on: http://stackoverflow.com/q/25116597
has text: no red, you should not
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39284152
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25221176
type: QuestionComment
has text: On what line does it crash, what is the error message?

http://stackoverflow.com/q/25172980
has title: JSch Compare local file to remote file
has body: I need to compare a local file to a remote file for differences. Currently, I have it checking for modified time and size difference, however, this would not cover differences withing the file. Current code: for (String dm : remoteMods) { Long remoteTime = (long) sftpChannel.stat(pack + "/" + dm).getMTime() * 1000; Long localTime = new File(minecraftInst + dm).lastModified(); Long remoteSize = sftpChannel.stat(pack + "/" + dm).getSize(); Long localSize = new File(minecraftInst + dm).length(); if (remoteTime.longValue() != localTime.longValue() || remoteSize.longValue() != localSize.longValue()) { System.out.println("Downloading: " + minecraftInst + dm); sftpChannel.get(pack + "/" + dm, minecraftInst + dm); new File(minecraftInst + dm).setLastModified(remoteTime); } } This works great for zip files, however, it doesn't work well with text files.
has comment: http://stackoverflow.com/comment/39194778
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39214159
has comment: http://stackoverflow.com/comment/39194634
has comment: http://stackoverflow.com/comment/39194459
has comment: http://stackoverflow.com/comment/39194480
has comment: http://stackoverflow.com/comment/39194788
has comment: http://stackoverflow.com/comment/39194869
downvote count: 0
tagged with: jsch
favorite count: 0

http://stackoverflow.com/a/25135028
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/64559550
downvote count: 1
upvote count: 0
answers question: http://stackoverflow.com/q/25134178
has body: In javascript, you can use function "eval" to do it.But in Java,there is no function like that.So you use ScriptEngine to do it in java. ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine se = manager.getEngineByName("js"); String str = "4/5"; Double result =(Double) se.eval(str); System.out.println(result);

http://stackoverflow.com/q/25115313
score: 0
has body: I am trying to use Anchor for setting the alignment of my components. Here is my code: public void intiConOpt() { /*********************************** connection options ****************************************/ conOptGBC.insets = new Insets(5, 5, 5, 5); conOptGBC.weightx = 1.0; conOptGBC.weighty = 1.0; conOptGBC.anchor = GridBagConstraints.NORTHWEST; conOpt = new JPanel(); conOpt.setLayout(new GridBagLayout()); //////////////////////////////////////////cycle time//////////////////////////////////////////// readPeriodLabel = new JLabel("Node read cycle time:"); conOptGBC.gridx = 0; conOptGBC.gridy = 0; conOpt.add(readPeriodLabel, conOptGBC); readPeriodNumberModel = new SpinnerNumberModel(); readPeriodSpinner = new JSpinner(readPeriodNumberModel); JSpinner.NumberEditor readPeriodEditor = new JSpinner.NumberEditor(readPeriodSpinner,"###"); readPeriodSpinner.setEditor(readPeriodEditor); readPeriodNumberModel.setValue(TopologyMain.settings.getSettingsList().get("nodeReadingCycleTime")); readPeriodSpinner.setPreferredSize(new Dimension(40, 20)); conOptGBC.gridx = 1; conOptGBC.gridy = 0; conOpt.add(readPeriodSpinner, conOptGBC); readPeriodLabel2 = new JLabel(" (4-180 sec) "); conOptGBC.gridx = 2; conOptGBC.gridy = 0; conOpt.add(readPeriodLabel2, conOptGBC); ///////////////////////////////////////////time out//////////////////////////////////////////// cliTimeoutLabel = new JLabel("CLI response timeout:"); conOptGBC.gridx = 0; conOptGBC.gridy = 1; conOpt.add(cliTimeoutLabel, conOptGBC); cliTimeoutNumberModel = new SpinnerNumberModel(); cliTimeoutSpinner = new JSpinner(cliTimeoutNumberModel); JSpinner.NumberEditor cliTimeoutEditor = new JSpinner.NumberEditor(cliTimeoutSpinner,"###"); cliTimeoutSpinner.setEditor(cliTimeoutEditor); cliTimeoutNumberModel.setValue(TopologyMain.settings.getSettingsList().get("cliTimeout") /10); cliTimeoutSpinner.setPreferredSize(new Dimension(40, 20)); conOptGBC.gridx = 1; conOptGBC.gridy = 1; conOpt.add(cliTimeoutSpinner, conOptGBC); cliTimeout…
has title: GridBagLayout anchor
answer count: 1
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/39089613
has answer: http://stackoverflow.com/a/25116699
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39089217
has comment: http://stackoverflow.com/comment/39088535
tagged with: java
tagged with: swing
type: Question
tagged with: gridbaglayout
has comment: http://stackoverflow.com/comment/39089321
tagged with: jpanel
accepted answer: http://stackoverflow.com/a/25116699

http://stackoverflow.com/comment/39180632
comment on: http://stackoverflow.com/q/25158936
has text: Can't you use a not Exists subquery instead where you pass in the aum.id.pin,aum.id.planNBR,aum.id.subPlanNBR values to use within the subquery. Something like where not exists (PAP FROM " + "ParticipantAdvicePortfolioDO PAP, EnrollmentDO edo WHERE PAP.userID = edo.userID AND edo.status ='E' AND edo.startDT < :endDate " + " AND (edo.endDT > :endDate OR edo.endDT IS NULL) and aum.id.pin =PAP.pin and aum.id.planNBR = edo.planNBR and aum.id.subPlanNBR = edo.subPlanNBR)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39039365
score: 0
has text: Thank you @MatthewGalbraith! I'll try your suggestion. Btw, does cron job can also be used in a jsp?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25088872

http://stackoverflow.com/comment/39248850
score: 0
has text: The bad request error is gone. Now, I get "sent string is: null" when i run this.
comment on: http://stackoverflow.com/q/25202211
type: Comment
type: QuestionComment

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/25128634
tags question: http://stackoverflow.com/q/25151470
tag name: google-oauth

http://stackoverflow.com/comment/39046770
comment on: http://stackoverflow.com/q/25093627
score: 0
type: Comment
has text: @PeterLawrey he stated that the output for this example should be `8.9`
type: QuestionComment

http://stackoverflow.com/a/25189941
has comment: http://stackoverflow.com/comment/39225578
has comment: http://stackoverflow.com/comment/39225870
upvote count: 1
has body: If you still want to have text, use the what I mentioned above: shell.setBackground(SWT.INHERIT_FORCE);. This makes it so that the background of your label will match the background color. However, you can also do a simpler option. If you want to "hide" text, yet need to keep it for later and display it when you want to, you can set the text of a particular label to be null. I often use this when I need text to disappear. The only thing is, is you need to store the text into an array (list) - or whatever you want (i.e. a database or someting similar) so you can save the text for later. You don't even need to use SWT.INHERIT_FORCE.This is a full example that might help: package test; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; /** * * @author Dylan */ public class Test { /** * @param args the command line arguments */ public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); shell.setText("Stackoverflow Test"); shell.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); // shell.setBackgroundMode(SWT.INHERIT_FORCE); Button button = new Button(shell, SWT.PUSH); button.setText("Button that's fun to click - but there is no text :D"); Label label = new Label(shell, SWT.NONE); label.setText("Horray, you entered text to stdin!!"); ArrayList&lt;String&gt; labelText = new ArrayList&lt;&gt;(); labelText.add(label.getText()); label.setText(""); shell.pack(); shell.open(); Boolean flag = false; while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); if (!flag) { try(BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) { System.out.println("Please enter some text"); char[] cbuf = new char[40]; String text = reader.readLine(); if (text.length()&gt; 0) { flag =…
has comment: http://stackoverflow.com/comment/39227158
downvote count: 0
has comment: http://stackoverflow.com/comment/39225763
score: 1
has comment: http://stackoverflow.com/comment/39225936
type: Answer
has comment: http://stackoverflow.com/comment/39228332
answers question: http://stackoverflow.com/q/25188687

http://stackoverflow.com/comment/39113155
score: 1
type: Comment
type: QuestionComment
has text: Thanks for the suggestions. I managed to get it to work after deleting both ~/.sbt and ~/.ivy2 in my home directory. Deleting just ~/.ivy2 caused the java.lang.NoClassDefFoundError.
comment on: http://stackoverflow.com/q/25126238

http://stackoverflow.com/comment/39270813
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25151939
has text: @Forager, yes I looked at the image -- Actually that _is_ the question. How can I determine the Image attributes for the specific ImageView so that I can load the image such that it will be clipped, scrolled or resized depending on the use-case. I can do resize, but clipping doesn't seem to behave. Also the when it not clipped it can and does *vanish* -- so we need to know if the image has _vanished_ and take corrective action!

http://stackoverflow.com/comment/39214168
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25174957
has text: Now I get a different error: Exception in thread "main" org.hibernate.MappingException: Repeated column in mapping for entity: ClusterMember column: cluster_id (should be mapped with insert="false" update="false")

http://stackoverflow.com/q/25074167
has answer: http://stackoverflow.com/a/25075817
score: 7
tagged with: java
tagged with: hibernate
answer count: 2
has title: createSQLQuery in hibernate uses Prepared Statement?
tagged with: sql
downvote count: 0
has comment: http://stackoverflow.com/comment/39009953
favorite count: 0
tagged with: sql-server
has answer: http://stackoverflow.com/a/25104891
has comment: http://stackoverflow.com/comment/39009961
has comment: http://stackoverflow.com/comment/39009900
type: AnsweredQuestion
has body: I'm using createSQLQuery with setString (No hard coded value) in Hibernate. I want to know that is Hibernate uses PreparedStatement for createSQLQuery? Concern: I want to preserve the execution plan created by this query in cache so next time same query fired on database, It would use same execution plan. FYI: I'm using MSSQL Server 2008 /* This is just example I'm not using same query */ Query nativeSQLQuery = session.createSQLQuery("select Firstname from user_master where user_name = :param"); nativeSQLQuery.setString("param", "vicky.thakor"); I couldn't find stackoverflow link or even in google so please provide me link if any.
linked to: http://stackoverflow.com/q/7455717
upvote count: 7
possible better answer: http://stackoverflow.com/a/25075817
accepted answer: http://stackoverflow.com/a/25104891
type: Question

http://stackoverflow.com/a/25160828
has body: How about creating your beans and ask Spring Boot to inject values into it? Something like @Bean @ConfigurationProperties("ds.client1") public DataSource dataSourceClient1() { DataSourceBuilder.create().build(); } @Bean @ConfigurationProperties("ds.client2") public DataSource dataSourceClient2() { DataSourceBuilder.create().build(); } Then, any setting in the ds.client1 namespace belongs to the first data source (i.e. ds.client1.password is the data source password for that DataSource). But maybe you don't know how much data sources you'll have? This is getting more complicated, especially if you need to inject those dynamic data sources in other objects. If you only need to lookup them by name, you could register them yourself as singletons. Here is an example that works @ConfigurationProperties(prefix = "ds") public class DataSourceSettings implements BeanFactoryAware { private List&lt;String&gt; clients = new ArrayList&lt;&gt;(); private BeanFactory beanFactory; public List&lt;String&gt; getClients() { return clients; } public void setClients(List&lt;String&gt; clients) { this.clients = clients; } @Override public void setBeanFactory(BeanFactory beanFactory) { this.beanFactory = beanFactory; } @PostConstruct public void configure() { Map&lt;String, String&gt; clientDataSources = new HashMap&lt;String, String&gt;(); for (String client : clients) { // extract client name String[] parts = client.split("\\|"); String clientName = parts[0]; String url = parts[1]; // client to datasource mapping String dsName = url.substring(url.lastIndexOf("/") + 1); if (clientName.contains(",")) { // multiple clients with same datasource String[] clientList = clientName.split(","); for (String c : clientList) { clientDataSources.put(c, url); } } else { clientDataSources.put(clientName, url); } } Assert.state(beanFactory instanceof ConfigurableBeanFactory, "wrong bean factory type"); ConfigurableBeanFactory configurableBeanFactory = (ConfigurableBeanFactory) beanFactory; for (Map.Entr…
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25160221
downvote count: 1
has comment: http://stackoverflow.com/comment/39194949
accepted answer of: http://stackoverflow.com/q/25160221
upvote count: 26
type: Answer
score: 25
has comment: http://stackoverflow.com/comment/39208042
has comment: http://stackoverflow.com/comment/39177636
has comment: http://stackoverflow.com/comment/112195646
has comment: http://stackoverflow.com/comment/39180768
has comment: http://stackoverflow.com/comment/39176545

http://stackoverflow.com/comment/39036290
comment on: http://stackoverflow.com/a/25087472
type: AnswerComment
has text: I know that making the inner class static would work. Your second idea is exactly my current workaround and seems to work pretty well. However, the other answer has exactly what I was looking for.
score: 0
type: Comment

http://stackoverflow.com/comment/68715384
score: 7
comment on: http://stackoverflow.com/a/25442101
type: AnswerComment
type: Comment
has text: Ctrl + Space is enough nowadays

http://stackoverflow.com/comment/39111042
type: Comment
comment on: http://stackoverflow.com/q/25095487
type: QuestionComment
has text: Well, principle is very simple - save your state to persistent storage (any database) as a history and then restore it by request (for example using some session id). I suggest you to read these articles: [CQRS](http://martinfowler.com/bliki/CQRS.html), [EventSourcing](http://martinfowler.com/eaaDev/EventSourcing.html).
score: 0

http://stackoverflow.com/comment/39113741
type: Comment
comment on: http://stackoverflow.com/q/25129557
score: 3
type: QuestionComment
has text: @hexafraction clone of ArrayList returns a shallow copy, so cloning the outer ArrayList doesn't meet the OP's requirements. You could clone each of the inner ArrayLists, though, since they contain an immutable objects (Integers).

http://stackoverflow.com/comment/39266054
score: 0
type: Comment
has text: Again, tracking to the specific appserver will be difficult if not impossible, and killing an appserver agent isn't without it's own dangers - which can include crashing the db. The suggested course of action I've posted in this answer is the only safe way to cleanly stop the appserver agent from doing it's work, and accomplish what you're after.
type: AnswerComment
comment on: http://stackoverflow.com/a/25209379

http://stackoverflow.com/comment/39240340
type: Comment
comment on: http://stackoverflow.com/a/25197114
score: 0
type: AnswerComment
has text: Missed the getQueryMethod. Just added.

http://stackoverflow.com/comment/39061044
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25100965
has text: Yeah, sorry about that. Try [this question instead, it is similar to yours.](http://stackoverflow.com/questions/25099124/java-inter-object-communication/25099568)

http://stackoverflow.com/comment/39110907
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25126953
has text: [This](http://stackoverflow.com/questions/18505406/java-tcp-can-only-retrieve-image-once/18509880#18509880) might only be partially relevant, but demonstrates an idea for writing an image, via a socket, using ImageIO and reading it again, via another socket, via ImageIO

http://stackoverflow.com/comment/39079692
type: QuestionComment
comment on: http://stackoverflow.com/q/25111320
score: 0
has text: It depends where it is declared. If it's method-local, which is what you seem to be asking about, it goes into the same stack slot every time around the loop. Your question appears to assume that language implementors are utterly incompetent and that you're the first person who's ever thought of this issue. They aren't, and you're not.
type: Comment

http://stackoverflow.com/a/25150310
accepted answer of: http://stackoverflow.com/q/25150270
answers question: http://stackoverflow.com/q/25150270
type: Answer
score: 3
downvote count: 0
has body: The run method annotated with @Transactional must be invoked on a bean that is registered within the IOC container. To make this class a bean you can register it within your XML configuration or simply annotate the class with the @Component annotation and setup component scanning within your XML configuration. Then inject the bean from the container and call the run method. Simply put, the run method needs to invoked from a bean injected from the IOC container.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39152398
upvote count: 3

http://stackoverflow.com/q/25076867
upvote count: 2
has comment: http://stackoverflow.com/comment/39014871
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/39014938
has comment: http://stackoverflow.com/comment/39014926
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/39014802
favorite count: 0
tagged with: while-loop
type: AnsweredQuestion
tagged with: java
type: Question
has body: I'm trying to implement a infinite while loop into my word frequency java code. The goal of this code was to create a program using main method java to analysis a piece text which has been entered from a user. They do this by entering the text into a scanner which is then analysed by the program. import java.util.Scanner; public class WordFreq { public static void main (String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter text: "); String s; s = input.nextLine(); System.out.println("" + s); String[] strings = s.split(" "); int[] counts = new int[6]; for(String str : strings) if(str.length() &lt; counts.length) counts[str.length()] += 1; for(int i = 1; i &lt; counts.length; i++) System.out.println(i + " letter words: " + counts[i]); input.close();} } The user then can re enter a piece of text to be analysed over and over again. I have this piece of code, which has a infinite while already in, but when I try to merge the two I keep getting errors. import java.util.Scanner; public class WhileLoop { public static void main(String args[]) { Scanner scan = new Scanner(System.in); String line=""; while((line=scan.nextLine())!=null) { String tokens [] = line.split(" "); for(int i=0;i&amp;lt;tokens.length;i++) { System.out.println(tokens[i]); } } } I'm not the Best at java and I'm not expecting anyone to just hand me code, but if someone could give me a hint in what I should do or just point me the right direction it would be greatly appreciated.
has title: Creating a Infinite While Loop Errors in Java
has comment: http://stackoverflow.com/comment/39015396
has answer: http://stackoverflow.com/a/25077157
accepted answer: http://stackoverflow.com/a/25077157
has comment: http://stackoverflow.com/comment/39014842

http://stackoverflow.com/comment/39061409
has text: *I want to know the span for ...* not clear what are you asking?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25101653
type: Comment

http://stackoverflow.com/comment/61064227
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25079415
has text: @JackZhang The problem is not in the Gradle script, but in the fact that `loader.path` is not something that is used by Spring Boot to alter the path where properties are read. Check out [this](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html) for all the details

http://stackoverflow.com/comment/39879870
has text: According to bug reports the delay may depend on the number of libs used by the project. Ours has around 300 jars of different sizes. The question is why the initilization cannot take place in the background before I start to debug, and if its results could be cached...
comment on: http://stackoverflow.com/q/25075617
type: Comment
type: QuestionComment
score: 1

ondraw
type: Tag
tag name: ondraw
tags question: http://stackoverflow.com/q/25097212

http://stackoverflow.com/a/25215160
score: 1
has comment: http://stackoverflow.com/comment/39272943
answers question: http://stackoverflow.com/q/25215145
downvote count: 0
type: Answer
has body: If I understand your question correctly: yes the java.util.concurrent primitives establish the same happens-after semantic than synchronized. See "Memory Consitency Properties" in the Package description.
upvote count: 1

http://stackoverflow.com/a/25230263
type: Answer
has body: As the other answers have stated, this behavior is because both possible results of a ternary expression must have the same type. Therefore, all you have to do to make your ternary version work the same way as convert1() is to cast the int to an Object: static Object convert2(double d) { return ((d % 1) == 0) ? ((Object) (int) (d)) : d; }
answers question: http://stackoverflow.com/q/25230171
accepted answer of: http://stackoverflow.com/q/25230171
has comment: http://stackoverflow.com/comment/39307474
upvote count: 18
has comment: http://stackoverflow.com/comment/39312526
type: AcceptedAnswer
downvote count: 0
score: 18

http://stackoverflow.com/comment/40070926
type: AnswerComment
type: Comment
has text: Thank you very much, but it should not be the problem because I'm using SetPropertiesRule and at the end it says: "Note that this problem does *not* occur when using the SetPropertiesRule. This rule does all its work when the matching start tag is encountered (because it only requires the attributes which are all present on the start tag) and so does not experience the "reverse call" order that applies to the "end" method of Rules." :(.
score: 0
comment on: http://stackoverflow.com/a/25607720

relative-path
type: Tag
tag name: relative-path
tags question: http://stackoverflow.com/q/25123115

http://stackoverflow.com/q/25220465
has comment: http://stackoverflow.com/comment/39283266
has answer: http://stackoverflow.com/a/25221236
tagged with: jpanel
score: -1
tagged with: jtable
has body: Im trying to learn Java and using the GUI as an upgrade to the "booring" C\C++ I had two panels, one of them with an input form, and one of them with a table which suppose to show the things I load from the input form. But no idea why, the table expands and has a border line, moreover, it has a fixed size and whenever I expand the window, the table stays the same. The "mainFrame" (the file that calls the c'tor) just initiate the table and add it to the layout so im sure its not happening there... I've added the JTable class code and a picture showing whats happening The link if it shows too small : http://oi62.tinypic.com/ok4hs5.jpg And the code : import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; public class TableOutput extends JPanel { private static final long serialVersionUID = 1L; private JTable jt; public TableOutput() { String[] columns = {"Product ID" , "Date" , "Name" , "Address" , "Status"}; String[][] data = {}; jt = new JTable(data,columns); jt.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); JScrollPane jsp = new JScrollPane(jt, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); add(jsp); }
has comment: http://stackoverflow.com/comment/39283356
upvote count: 0
answer count: 1
tagged with: layout-manager
favorite count: 0
accepted answer: http://stackoverflow.com/a/25221236
has title: JTable inside a JPanel sets its own border and fix size
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39283305
tagged with: java
tagged with: swing
downvote count: 1
type: Question

http://stackoverflow.com/comment/119315243
type: Comment
comment on: http://stackoverflow.com/a/63832572
score: 0
type: AnswerComment
has text: Technically, A.Sum() run For loop internally.

http://stackoverflow.com/q/25185293
has body: My understanding of "best practices" when using an automatic mapping tool like ModelMapper is to have unit tests for any source->destination map that occurs in your code, to be sure the mapping is doing what you expect. Is there any code coverage/static analysis tools that would assist in determining that for every invocation of ModelMapper#map source/destination pair, there exists a unit test that invokes ModelMapper#map with the same source/destination types?
has comment: http://stackoverflow.com/comment/39217143
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/39217651
score: 0
has comment: http://stackoverflow.com/comment/39217484
has title: Verify test(s) exist for any source/destination mapped types
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39217302
tagged with: modelmapper
has comment: http://stackoverflow.com/comment/39216557
answer count: 0
tagged with: java

http://stackoverflow.com/a/25201356
has comment: http://stackoverflow.com/comment/39246511
has comment: http://stackoverflow.com/comment/39246844
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39246721
has comment: http://stackoverflow.com/comment/39246545
has comment: http://stackoverflow.com/comment/39246607
upvote count: 1
has body: short is an integral type, so it can only contain whole numbers. The only two choices for 0.37885 in a short are 0 or 1, both of which (it seems to me) lose quite a bit of precision. So the answer is: If you're okay with losing all fractional values, either use a cast, Float#shortValue, or Math.round(float) (and cast the resulting int to short). Example: Live Copy float f1 = 0.37885f; short s1 = (short)Math.round(f1); System.out.println("s1 = " + s1); float f2 = 27.67885f; short s2 = (short)Math.round(f2); System.out.println("s2 = " + s2); Output: s1 = 0 s2 = 28 In a comment you said: I have this sine wave which generates values like the one mentioned above, but I want them as shorts. Ah, now, we can do something with that. Presumably the values you're getting are all between 0 and 1. You can store them as shorts by multiplying. Since the range of a short is -32,768 to 37,767, a convenient number to multiply them by might be 10000: short s = Math.round(floatValue * 10000); The number we'd get for your example would be 3789. Example: Live Copy float floatValue = 0.37885f; short s = (short)Math.round((double)floatValue * 10000); System.out.println("s = " + s); That isn't the same value, of course, it's the value multipled by ten thousand, so anywhere you're going to use it, you'd have to allow for that.
has comment: http://stackoverflow.com/comment/39246582
answers question: http://stackoverflow.com/q/25201304
type: Answer

http://stackoverflow.com/a/25189132
has comment: http://stackoverflow.com/comment/39249015
type: Answer
has comment: http://stackoverflow.com/comment/39228238
has body: I think that what is happening here is that exceptions thrown in the start() method are caught by the code that invokes that method. So anything thrown in the start() method is not handled by your exception handler (it's not an uncaught exception). However, exceptions thrown after the start() method has completed are handled by your exception handler. Note, however, that the exceptions will be handled in the thread in which they are thrown. So your code will work as long as those exceptions are thrown on the FX Application Thread, but will not work for exceptions that are thrown in a background thread (because you can't create and show a dialog in a background thread). To cover all eventualities: If it's possible for an exception or error to be thrown in the start() method, place that code in a try - catch block and handle in the usual way. Set the default uncaught exception handler to invoke the code to show the dialog using Platform.runLater(). This will handle exceptions thrown outside the FX Application Thread. Set an uncaught exception handler on the FX Application Thread to invoke the code to show the dialog directly. Example (errors are thrown in the start() method with 50% probability): import java.io.IOException; import java.util.Random; import javafx.application.Application; import javafx.application.Platform; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.HBox; import javafx.scene.layout.StackPane; import javafx.stage.Stage; import org.controlsfx.dialog.Dialogs; import org.controlsfx.dialog.DialogStyle; public class UncaughtExceptionHandlerExample extends Application { @Override public void start(Stage primaryStage) { Thread.setDefaultUncaughtExceptionHandler((t, e) -&gt; Platform.runLater(() -&gt; showErrorDialog(t, e))); Thread.currentThread().setUncaughtExceptionHandler(this::showErrorDialog); try { Button button = new Button("Create error"); button.setOnAction(event -&gt; { throw new Error("Boom!"); }); Butto…
has comment: http://stackoverflow.com/comment/39235081
has comment: http://stackoverflow.com/comment/39234867
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/25145956
downvote count: 0

http://stackoverflow.com/a/25163167
has body: One sample for your ECC's requirement. FYI. String base = "(?:\\s*(?:(?:id=([0-9]+))|(?:key=([a-zA-Z0-9]+))|(?:signature=([a-fA-F0-9]+))),?)"; String patternStr ="ECC " + base + "+$"; String str = "ECC Signature=60955d3260415e69c0a305c42083415b, Key=cbrzfta369qwyrm9t5b8y8kf, Id=123"; Pattern pattern = Pattern.compile(patternStr, Pattern.CASE_INSENSITIVE); Matcher m = pattern.matcher(str); while (m.find()) { System.out.println(m.group(0)); System.out.println(m.group(1)); System.out.println(m.group(2)); System.out.println(m.group(3)); } The output is : ECC Signature=60955d3260415e69c0a305c42083415b, Key=cbrzfta369qwyrm9t5b8y8kf, Id=123 123 cbrzfta369qwyrm9t5b8y8kf 60955d3260415e69c0a305c42083415b if the input string is: String str = "ECC Id=123, Key=cbrzfta369qwyrm9t5b8y8kf, Signature=60955d3260415e69c0a305c42083415b"; The output is : ECC Id=123, Key=cbrzfta369qwyrm9t5b8y8kf, Signature=60955d3260415e69c0a305c42083415b 123 cbrzfta369qwyrm9t5b8y8kf 60955d3260415e69c0a305c42083415b
has comment: http://stackoverflow.com/comment/39189588
answers question: http://stackoverflow.com/q/25149428
score: 0
type: Answer

http://stackoverflow.com/comment/39266429
type: QuestionComment
type: Comment
has text: I mean that if you try to use a reference variable (pointer) to reference a static field or method, *javac* will take the class of the reference variable and use that to find the field/method (in fact ignoring the actual reference value).
score: 0
comment on: http://stackoverflow.com/q/25211497

http://stackoverflow.com/comment/50335944
type: AnswerComment
score: 0
type: Comment
has text: @saneryee Update - actually JDK 1.7 is available only starting from 8.5+, not 8.0 as I wrote. Sorry.
comment on: http://stackoverflow.com/a/25223414

http://stackoverflow.com/comment/39221197
has text: And you may be new to SO but we don't downvote post because we don't understand them. Only when they're factually wrong or doesn't answer the question, which is not my case. This is not Reddit.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25185967
type: Comment

http://stackoverflow.com/comment/39170514
type: QuestionComment
has text: To clarify : do they need to appear three times in succeding order?
comment on: http://stackoverflow.com/q/25160594
score: 0
type: Comment

http://stackoverflow.com/a/25914699
score: 1
answers question: http://stackoverflow.com/q/25161837
has body: The deadlock is caused by a snychronized block together with a manual transaction lock. I missed to remove the synchronized statement from a test I performed before. Though the synchronized statement did not target the locked node the exception was raised. It seems that the two locking mechanisms are incompatible. This led to the strange error message that was not very helpful - to me.
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/25113543
has comment: http://stackoverflow.com/comment/39084235
upvote count: 1
favorite count: 0
tagged with: equals
has answer: http://stackoverflow.com/a/25114890
accepted answer: http://stackoverflow.com/a/25116336
answer count: 4
has comment: http://stackoverflow.com/comment/39083473
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25114276
tagged with: hashcode
tagged with: java
has answer: http://stackoverflow.com/a/25116336
downvote count: 1
has body: I have one class having two variables named as x and y. In this class I have overrided the equals and hashCode methods to compare two object of this class. But our requirement is to compare two object of this class sometimes on the basis of x and sometimes on the basis of y. Is it possible dynamically in Java? Edit: I have one more class named as B, in this class there is two method m1 and m2 and I want to compare the above class object in such a way that when we call from m1 (for sorting) the above objects will be compared on the basis of x (means compare object by compare x variable) and when we call from m2 (for sorting) then we compare according to y.
type: Question
has title: Can we change behavior of equals method dynamically?
has comment: http://stackoverflow.com/comment/39084991
score: 0
has comment: http://stackoverflow.com/comment/39083462
has answer: http://stackoverflow.com/a/25117739
has answer: http://stackoverflow.com/a/25114276

http://stackoverflow.com/comment/39218428
comment on: http://stackoverflow.com/a/25185831
has text: I found the java build path Valentin, but It shows all the project jar files. I did change the path to JDk in the preferences->java->installed jre->jdk...But its not helping
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/comment/39230929
comment on: http://stackoverflow.com/a/25192530
score: 0
type: AnswerComment
has text: @Celeritas I've always seen it as `public final void doTests()`.
type: Comment

http://stackoverflow.com/q/25098589
answer count: 1
downvote count: 0
has body: I am using jodatime's Duration class to add a duration like 02:10 to a DateTime like 2014-08-02T11:34 using withDurationAdded(duration, 1). I created duration using Duration.parse("02:10"). I get an IllegalFormatException for the "02:10". I don't see a formatSpecifier argument; how do I properly create this duration? The jodatime quickstart guide didnt provide an example of parse: http://joda-time.sourceforge.net/key_duration.html
favorite count: 0
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25098679
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25098679
type: Question
has title: Duration.parse example
tagged with: jodatime

http://stackoverflow.com/comment/86543731
type: Comment
comment on: http://stackoverflow.com/a/25087561
score: 0
type: AnswerComment
has text: This is not the way to go, because it only works for a really small output. If the output is relatively big (maybe above 1kB?), your main thread will certainly get stuck.

http://stackoverflow.com/comment/39279235
score: 0
has text: I get stuck at checking if the value is lower, becouse it's a time. and the biggest problem is (when the value is lower) to split it there.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25218512

http://stackoverflow.com/comment/39302609
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25225137
has text: I added "response.getWriter().println("Intercepted In ServletFilter");" in the filter as first line, and I can see it in the 3rd URL, which was intercepted, but all other 3 went straight to the login screen without showing this message.
score: 0

http://stackoverflow.com/a/25093589
upvote count: 6
has body: I think your questions revolve around the reduce function here, which is a function of 2 arguments returning 1, whereas in a Reducer, you implement a function of many-to-many. This API is simpler if less general. Here you provide an associative operation that can reduce any 2 values down to 1 (e.g. two integers sum to one). This is used to reduce all values for each key to 1. It's not necessary to provide an N-to-1 function since it can be accomplished with a 2-to-1 function. Here, you can't emit multiple values for one key. The result are (key, reduced value) from each (key, bunch of values). The Mapper and Reducer in classic Hadoop MapReduce were actually both quite similar (just that one takes a collection of values rather than single value per key) and let you implement a lot of patterns. In a way that's good, in a way that was wasteful and complex. You can still reproduce what Mappers and Reducers do, but the method in Spark is mapPartitions, possibly paired with groupByKey. These are the most general operations you might consider, and I'm not saying you should emulate MapReduce this way in Spark. In fact it's unlikely to be efficient. But it is possible.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25091091
answers question: http://stackoverflow.com/q/25091091
score: 6
type: Answer

http://stackoverflow.com/comment/39204500
comment on: http://stackoverflow.com/q/25178469
score: 0
type: QuestionComment
type: Comment
has text: i google for tutorials, but every examples just simple property : value cases.

http://stackoverflow.com/q/25082433
answer count: 1
has comment: http://stackoverflow.com/comment/39025508
favorite count: 0
tagged with: get
tagged with: static
has title: Static and get set method problems
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/39025672
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25082882
score: -4
tagged with: set
has body: Okay, it might sounds silly, but I really don't know what is going on here. So firstly, System.out.print("\nPlease enter your name :"); Member.setName(scChar.nextLine()); System.out.print("\nPlease enter your age :"); Member.setAge(scInt.nextInt()); System.out.print("\nPlease enter your I/C number :"); Member.setIcNo(scChar.nextLine()); System.out.print("\nPlease enter your phone number :"); Member.setPhoneNo(scChar.nextLine()); System.out.print("\nPlease enter your address :"); Member.setAddress(scChar.nextLine()); When I run using Jcreator LE, it says that my setName is not a static so I have to change to static and now every of my variables is static. private static String name; private static int age; private static String icNo; private static String phoneNo; private static String address; private static java.util.Date date; private static java.util.Date expiryDate; private static int trialClass = 0; private static double joiningFees = 80.00; private static char memberType; So, may I know what is my problem ? Or is there any code you need to know, let me know and I'll edit my post then. And 1 more is that I have to use String n instead of this.name = name to be able to work. // Set method public static void setName(String n) { name = n; } public static void setAge(int a) { age = a; } public static void setIcNo(String ic) { icNo = ic; } public static void setPhoneNo(String phone) { phoneNo = phone; } public static void setAddress(String a) { address = a; } public static void setDate(java.util.Date d) { date = d; } public static void setExpiryDate(java.util.Date expDate) { expiryDate = expDate; } public static void setTrialClass(int tc) { trialClass = tc; } public static void setMemberType(char mt) { memberType = mt; } // Get method public static String getName() { return name; } public static int getAge() { return age; } public static String getIcNo() { return icNo; } public static String getPhoneNo() { return phoneNo; } public static String getAddress() { return…
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39025434

http://stackoverflow.com/comment/39120055
comment on: http://stackoverflow.com/a/25117072
score: 0
type: Comment
has text: Glad to here. If it is OK for you, so just accept an answer to close the question.
type: AnswerComment

http://stackoverflow.com/comment/39276875
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25217171
has text: What is a Set and how does it work?

http://stackoverflow.com/a/25091271
upvote count: 4
has comment: http://stackoverflow.com/comment/39042326
has body: For that you need to have some kind of relation between two different classes Employee and Student. It can be done if you have used inheritance. Or you need to use copy constructor. Else you cannot just simply assign it. Edited If there is no relation, try using copy constructor. For example: Student aStudent = new Student(anEmployee); And in Student class, define constructor as: Student(Employee anEmployee){ this.name = anEmployee.getName(); // and other variables should be initialized } And of course you will need getter method in Employee class. In for loop you need to do this which will create each student with corresponding student object that you will need to add in the list. for(Student aStudent:students){ //and do it here.. }
type: Answer
answers question: http://stackoverflow.com/q/25091253
has comment: http://stackoverflow.com/comment/39042274
downvote count: 1
score: 3

http://stackoverflow.com/comment/39148179
type: AnswerComment
has text: It sounds like loadOrder() is overkill if all you are trying to do is read some values from the various repository items associated with an order.
comment on: http://stackoverflow.com/a/25122672
score: 0
type: Comment

http://stackoverflow.com/comment/39121413
has text: You are right, if this is not done, then uninstall process will not be successful.
comment on: http://stackoverflow.com/a/25132465
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25154535
has comment: http://stackoverflow.com/comment/39177588
has comment: http://stackoverflow.com/comment/39179075
has comment: http://stackoverflow.com/comment/39178153
score: 82
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39177629
has comment: http://stackoverflow.com/comment/39389144
type: Answer
accepted answer of: http://stackoverflow.com/q/25154495
has comment: http://stackoverflow.com/comment/39195283
downvote count: 0
has comment: http://stackoverflow.com/comment/39178030
answers question: http://stackoverflow.com/q/25154495
upvote count: 82
has comment: http://stackoverflow.com/comment/39491955
has body: The final } of the method is unreachable - you only get a compilation error if it's possible to get to the end of the method without returning a value. This is more useful for cases where the end of the method is unreachable due to an exception, e.g. private String find(int minLength) { for (String string : strings) { if (string.length() &gt;= minLength) { return string; } } throw new SomeExceptionIndicatingTheProblem(&quot;...&quot;); } The rule for this is in the JLS section 8.4.7: If a method is declared to have a return type (§8.4.5), then a compile-time error occurs if the body of the method can complete normally (§14.1). Your method can't complete normally, hence there's no error. Importantly, it's not just that it can't complete normally, but the specification recognizes that it can't complete normally. From JLS 14.21: A while statement can complete normally iff at least one of the following is true: The while statement is reachable and the condition expression is not a constant expression (§15.28) with value true. There is a reachable break statement that exits the while statement. In your case, the condition expression is a constant with value true, and there aren't any break statements (reachable or otherwise) so the while statement can't complete normally.

http://stackoverflow.com/comment/39159421
type: Comment
type: QuestionComment
has text: add a bit more of your date chooser code cause that is the interesting bit
comment on: http://stackoverflow.com/q/25154246
score: 0

http://stackoverflow.com/a/25091275
answers question: http://stackoverflow.com/q/25090486
score: 1
has comment: http://stackoverflow.com/comment/39070953
downvote count: 0
has comment: http://stackoverflow.com/comment/39067556
type: Answer
has body: It could be the case that you need to have "cascade = {CascadeType.MERGE, CascadeType.PERSIST}" on the ManyToOne annotation. The default behavior does not cascade anything to the associated objects. /** * (Optional) The operations that must be cascaded to * the target of the association. * * &lt;p&gt; By default no operations are cascaded. */ CascadeType[] cascade() default {}; Eg. @ManyToOne(optional = true, cascade = {CascadeType.MERGE, CascadeType.PERSIST}, fetch = EAGER) UPDATE: In case you are using spring managed transaction manager and have the liberty to use annotation driven transaction demarcation, you can try the spring @Transactional annotation instead of manually starting transaction and committing/flushing. I have following setup: &lt;bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager"&gt; &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&gt; &lt;/bean&gt; &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt; &lt;bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory"&gt; &lt;property name="persistenceUnitName" value="persistenceUnit"/&gt; &lt;property name="dataSource" ref="local-dataSource"/&gt; &lt;property name="packagesToScan" value="X"/&gt; &lt;property name="persistenceXmlLocation" value="classpath:persistence.xml"/&gt; &lt;/bean&gt; DAO class: @Repository public class EventRepository { @PersistenceContext EntityManager entityManager; @Transactional public void persist(Event event) { entityManager.persist(event); } }
upvote count: 1
has comment: http://stackoverflow.com/comment/39072330
has comment: http://stackoverflow.com/comment/39074867

http://stackoverflow.com/comment/39048078
comment on: http://stackoverflow.com/q/25094386
has text: currently i have String, Integer, Long, Double, Boolean
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25228771
score: 1
accepted answer of: http://stackoverflow.com/q/25228415
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39298827
answers question: http://stackoverflow.com/q/25228415
has body: The string is a multiline string, but the dot does not match newline characters. Use &lt;string name="message_verification_regex"&gt;^[\\s\\S]*?Your Verification Code is \\d{4}[\\s\\S]*$&lt;/string&gt; The expression [\s\S] matches any whitespace character and any non-whitespace character which means really any character. I must add that I don't know if escaping a backslash with an additional backslash is really necessary where the string with this regular expression is used. Therefore try also: &lt;string name="message_verification_regex"&gt;^[\s\S]*?Your Verification Code is \d{4}[\s\S]*$&lt;/string&gt;

http://stackoverflow.com/q/25205405
has comment: http://stackoverflow.com/comment/39255654
has comment: http://stackoverflow.com/comment/39255543
answer count: 1
has comment: http://stackoverflow.com/comment/39254362
upvote count: 3
has comment: http://stackoverflow.com/comment/39254295
has comment: http://stackoverflow.com/comment/39255416
favorite count: 0
has comment: http://stackoverflow.com/comment/47475872
has title: Escaping a json string inside a properties file
tagged with: properties
accepted answer: http://stackoverflow.com/a/25206151
linked to: http://stackoverflow.com/q/4449639
type: AnsweredQuestion
score: 3
downvote count: 0
has body: I use typical properties file in a java environment. I want one of the properties to be a json array: #Country list in json by language countries = [{"Name":"America"},{"Name":"Germany"},...] This gives a number format exception in java when trying to read the string mapped to countries. I tried a bunch of escaping sequences, but none seem to work: countries = [{\"Name\":\"America\"},{\"Name\":\"Germany\"},...] countries = [{\\"Name\\":\\"America\\"},{\\"Name\\":\\"Germany\\"},...] countries = [{''Name'':''America''},{''Name'':''Germany''},...] I'm wondering why a number formatexception is thrown, considering this is a string? Also, what is wrong with a json string that makes the file flip? Is it the [, {, " or : character(s)? EDIT: Her's the actual json in my properties file: countries_json = [{"Name":"Afghanistan","Code":"AF","TelephoneCode":"+93"},{"Name":"Belgium","Code":"BE","TelephoneCode":"+32"}] Here's the code in my jsp page which gets this value: &lt;input type="hidden" id="countryListJSON" value='&lt;s:text name="countries_json"/&gt;'/&gt; And here's the exception that happens on the java backend when the jsp is being rendered: SEVERE: Servlet.service() for servlet jsp threw exception java.lang.NumberFormatException: For input string: ""Name":"Afghanistan"" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.text.MessageFormat.makeFormat(Unknown Source) at java.text.MessageFormat.applyPattern(Unknown Source) at java.text.MessageFormat.&lt;init&gt;(Unknown Source) at com.opensymphony.xwork2.util.LocalizedTextUtil.buildMessageFormat(LocalizedTextUtil.java:704) at com.opensymphony.xwork2.util.LocalizedTextUtil.getDefaultMessage(LocalizedTextUtil.java:663) at com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:534) at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:259) at com.opensymphony.xw…
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25206151
has comment: http://stackoverflow.com/comment/47482091
has comment: http://stackoverflow.com/comment/39254408
has comment: http://stackoverflow.com/comment/39255440
type: Question
has comment: http://stackoverflow.com/comment/47481863
has comment: http://stackoverflow.com/comment/39254424

http://stackoverflow.com/comment/39293797
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25133802
has text: how do you install: `In NetBeans IDE select File, then Open Project, navigate to tut-install` ... `The required projects, including the archetypes, will be built.` but...where is `tut-install`? I cannot find it.
score: 0

http://stackoverflow.com/comment/39002301
type: QuestionComment
score: 2
has text: Shouldn't it be `-XX:+HeapDumpOnOutOfMemoryError` ?
comment on: http://stackoverflow.com/q/25069743
type: Comment

http://stackoverflow.com/q/25115872
has body: I have controller which adds Computer assigned to User by admin. User can have several assigned Computers and it is implemented through Spring MVC Multiple Selection. But I’ve little issue with displaying of info after updating. It shows as many users in List of users as many computers were assigned. I think problem not in JSP and debuggers shows nothing so I’ll very appreciate your help. Here is my AdminUserUpdateController.java @Controller public class AdminUserUpdateController { @InitBinder("userForm") private void initBinder(WebDataBinder binder) { binder.setValidator(updateValidator); binder.registerCustomEditor(Set.class, "computers", new CustomCollectionEditor(Set.class) { @Override protected Object convertElement(Object element) { String pcName = null; if (element instanceof String && !((String) element).equals("")) { try { pcName = (String) element; Set<Computer> computerSet = new LinkedHashSet<>(); computerSet.add(computerService.getComputerByName(pcName)); new UserForm().setComputers(computerSet); } catch (NumberFormatException e) { logger.info("Error in element"); logger.info("Element was " + ((String) element)); } } return pcName != null ? computerService.getComputerByName(pcName) : null; } }); } ............... @RequestMapping(value = "/adminEdit/{userId}", method = RequestMethod.GET) public String updateView(@PathVariable("userId") Integer userId, UserForm userForm, ModelMap model) { userForm.setUser(userService.getUserById(userId)); model.addAttribute("userForm", userForm); model.addAttribute("computers", computerService.getAllComputers()); return "adminUserUpdate"; } @RequestMapping(value = "adminEdit.do/{userId}", method = RequestMethod.POST) public ModelAndView updateUserProcess(@ModelAttribute(value = "userForm") UserForm userForm, @PathVariable("userId") Integer userId, BindingResult result, Model model) { User user = userService.getUserById(userId); model.addAttribute("computers", computerService.getAllComputers()); model.addAttribute("userForm…
has comment: http://stackoverflow.com/comment/39089690
has comment: http://stackoverflow.com/comment/39087880
upvote count: 1
has comment: http://stackoverflow.com/comment/39087828
has comment: http://stackoverflow.com/comment/39095302
tagged with: jsp
has comment: http://stackoverflow.com/comment/39087814
favorite count: 0
has comment: http://stackoverflow.com/comment/39089192
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/39089187
has comment: http://stackoverflow.com/comment/39096020
tagged with: spring-mvc
answer count: 0
downvote count: 0
score: 1
tagged with: java
has title: JSP or Spring MVC controller display same info several times
type: Question

http://stackoverflow.com/q/25160160
score: -1
answer count: 1
downvote count: 1
has body: I am currently working on a Java project, below are my attempts at coding so far: import java.util.*; import java.io.*; import javax.swing.*; import java.awt.*; import java.util.ArrayList; import java.util.List; import java.util.Iterator; import java.util.HashMap; import java.util.TreeMap; import java.util.Collection; import java.util.Map; /** * * This class models a zoo. It allows a single animal to be added to the zoo, a * batch of animals to be "imported" by reading data from a text file and for all * the animals to be listed in a terminal window. It also ensures that all animals * in the zoo have a unique identifier. * public class MyZoo { // zoo identifier private String zooId; // a number used in generating a unique identifier for the next animal to be added to the zoo private int nextAnimalIdNumber; // zstorage for the Animal objects private TreeMap<String, Animal> animals; /** * Create an "empty" zoo. * * @param zooId an identifier for the zoo, at least three characters long. */ public MyZoo(String zooId) { this.zooId = zooId.trim().substring(0,3).toUpperCase(); nextAnimalIdNumber = 0; animals = new TreeMap<String, Animal>(); } /** * Returns a unique identifier, for an Animal object, based on the * zoo identifier and the field nextAnimalIdNumber which is incremented * ready for next time the method is called. * * @return a unique identifier. */ public String allocateId() { // increment nextAnimalIdNumber and then construct a six digit string from it nextAnimalIdNumber++; String s = Integer.toString(nextAnimalIdNumber); while ( s.length()<6 ) s = "0" + s; return zooId + "_" + s; } /** * Adds an animal to the zoo. * * @param animal the Animal object to be added. */ public void addAnimal(Animal animal) { animals.put(animal.getName(), animal); } /** * Reads Animal data from a text file and adds them to the zoo. The * format of the data is specified in the MyZoo coursework assignment. * * @param animal the Animal object to be added. */ public void readDataFromFil…
has comment: http://stackoverflow.com/comment/39170256
favorite count: 0
has comment: http://stackoverflow.com/comment/39169657
type: UnansweredQuestion
has title: Java Iterate Over Collection ,not working as expected
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39169683
type: Question
has answer: http://stackoverflow.com/a/25160192

http://stackoverflow.com/q/25078929
type: Question
score: 5
tagged with: spring
tagged with: java
accepted answer: http://stackoverflow.com/a/25079542
answer count: 1
upvote count: 5
has comment: http://stackoverflow.com/comment/39019692
has title: Spring-Batch proxy class cannot be cast to Class?
has body: I have a spring-batch @Job defined. But when running it (inside tomcat), I'm getting a ClassCastException due to com.sun.proxy.$Proxy. Why could this be the case? What might be wrong in the following excerpt? @Service public class JobService { @Autowired private JobLauncher launcher; public void run() { Job job = jobRegistry.getJob("jobname"); launcher.run(job, params); //line 59 } } @Configuration @EnableBatchProcessing(modular = true) public class JobConfig { @Bean @JobScope public MultiResourceItemReader&lt;T&gt; reader(@Value("#{jobParameters['filename']}") Resource csv) throws Exception { MultiResourceItemReader&lt;T&gt; itemReader = new MultiResourceItemReader&lt;&gt;(); //... return itemReader; } @Bean public JobScope jobScope() { return new JobScope(); } } Result: java.lang.ClassCastException: com.sun.proxy.$Proxy135 cannot be cast to org.springframework.batch.item.file.MultiResourceItemReader at org.springframework.batch.item.file.MultiResourceItemReader$$FastClassBySpringCGLIB$$ad846cb.invoke(&lt;generated&gt;) ~[spring-core-4.0.6.RELEASE.jar:3.0.1.RELEASE] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.0.6.RELEASE.jar:4.0.6.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708) ~[spring-aop-4.0.6.RELEASE.jar:4.0.6.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.0.6.RELEASE.jar:4.0.6.RELEASE] at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133) ~[spring-aop-4.0.6.RELEASE.jar:4.0.6.RELEASE] at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121) ~[spring-aop-4.0.6.RELEASE.jar:4.0.6.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.0.6.RELEASE.jar:4.0.…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39019653
downvote count: 0
has answer: http://stackoverflow.com/a/25079542
favorite count: 0
tagged with: spring-batch

http://stackoverflow.com/comment/39149435
has text: how do you create multiple `AContainer`s
comment on: http://stackoverflow.com/q/25148716
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39171521
score: 0
has text: I mean that the software will not Go away to sleep so I can continue working on it without having to wait until the time is over count
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25161036

http://stackoverflow.com/comment/39241630
has text: If the `StyledDocument` happens to be HTML, the width of the document can be suggested by the CSS used. See [this answer](http://stackoverflow.com/a/14011645/418556) for how to do it with an HTML formatted `JLabel`.
comment on: http://stackoverflow.com/q/25198280
score: 0
type: Comment
type: QuestionComment

runtime-error
tags question: http://stackoverflow.com/q/25087490
tag name: runtime-error
tags question: http://stackoverflow.com/q/25191624
tags question: http://stackoverflow.com/q/25215444
type: Tag

http://stackoverflow.com/a/25086632
has comment: http://stackoverflow.com/comment/39034752
answers question: http://stackoverflow.com/q/25086515
has body: It means the serialVersionUID of your writer and reader don't match. This is because the code for this class on the writer and reader are different. It means that the serialVersionUID of the read needs to be hardcoded to match the writer. Try setting private static final long serialVersionUID = -6785768889157546991L; This will only work if you haven't changed the types of any field, or removed any.
accepted answer of: http://stackoverflow.com/q/25086515
type: Answer
has comment: http://stackoverflow.com/comment/39033920
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39034049
has comment: http://stackoverflow.com/comment/39034391
upvote count: 2
has comment: http://stackoverflow.com/comment/39034466
type: AcceptedAnswer

http://stackoverflow.com/comment/39234640
type: Comment
comment on: http://stackoverflow.com/a/25194467
has text: Instead of doing that, just add the Label last and the Separator first (as children to the AnchorPane).
score: 0
type: AnswerComment

http://stackoverflow.com/q/25111861
tagged with: java
has body: I really don't like using box2d with Libgdx, so I set up a map from Tiled to have a rectangle for every cell in the layer. I have a player set up that should fall if it is not touching one of the rectangle, but it slowly falls through the map. for(int i = 0; i &lt; g.getBounds().size; i++) { Intersector.intersectRectangles(bounds, g.getBounds().get(i), intersection); if((bounds.overlaps(g.getBounds().get(i))) &amp;&amp; intersection.y &gt; g.getBounds().get(i).y) { vel.y = 0; if (MyInput.isPressed(MyInput.SPACE)) { vel.y = 5; } } else { vel.y-=.0005f; } } The for loop goes through all the rectangles to check if the player is touching the top.
type: Question
type: AnsweredQuestion
tagged with: libgdx
has title: Libgdx Entity Gravity
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25158581
possible better answer: http://stackoverflow.com/a/25113455
has answer: http://stackoverflow.com/a/25113455
accepted answer: http://stackoverflow.com/a/25158581
has comment: http://stackoverflow.com/comment/39085693

http://stackoverflow.com/a/25190111
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25190047
downvote count: 0
has body: I'd use NumberFormat.parse() -- get an instance of NumberFormat to match your locale, create a string indicating the format expected, then parse the input with it.

http://stackoverflow.com/a/25126633
upvote count: 6
answers question: http://stackoverflow.com/q/25126218
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25126218
type: Answer
score: 6
downvote count: 0
has body: It is not either/or choice. AbstractAnnotationConfigDispatcherServletInitializer implements WebApplicationInitializer, but already provides some functionality so you have to add very little. I suggest you start with AbstractAnnotationConfigDispatcherServletInitializer and see if it works for you, you can always switch to WebApplicationInitializer later.

http://stackoverflow.com/comment/39267626
comment on: http://stackoverflow.com/q/25212343
has text: Is there any Definition of onSearchRequested(); ? please post it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25084664
tagged with: resources
type: Question
has body: my problem is that when i build a jar with intellij 13.1.1 and include images to the jar, the path to the images are broken. i get a nullpointerexception. when i add the resource folder outside the jar and link the path as you can see in the code example it works. But my aim is to include the resources folder to the jar file, so that i only have one file. i run ubuntu. my project structure: res -&gt; images -&gt; button.gif src -&gt; programm -&gt; mainclass.java code image = Toolkit.getDefaultToolkit().createImage("res/images/animation.gif"); this.setContentPane(new JLabel(new ImageIcon( image)));
has title: Build jar with images inside in Intellij Idea13.1.1
tagged with: intellij-idea
tagged with: jar
has answer: http://stackoverflow.com/a/25089313
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/39049151
type: QuestionComment
has text: Could you add a part of the code containing the `import statement` and an associated `method`?
comment on: http://stackoverflow.com/q/25090873
score: 0
type: Comment

http://stackoverflow.com/q/25101314
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39060862
has body: I don't know why this is taking me so long to figure out, but I have an ArrayList of HashMaps that I want to loop through. The looping through part is easy and I know how to do it, but I only want to display items when they meet certain conditions. Here is an example of the contents inside my HashMap&lt;String, String&gt;: post_type="Facebook" post_type="Facebook" post_type="Twitter" Here is the code I tried to loop through the above contents. When it prints, it only prints one line instead of two. for (int i=0; i &lt; newArray.size(); i++) { String postType = newArray.get(i).get("type"); if (postType.equals("Facebook")){ System.out.println("HELLO"); // i want this to print twice, but it only prints once, even though there are two elements of type Facebook in the HashMap } }
has comment: http://stackoverflow.com/comment/39060906
score: -1
accepted answer: http://stackoverflow.com/a/25101448
tagged with: java
answer count: 2
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/39060856
has title: Looping through an array and displaying items when they meet certain conditions
has comment: http://stackoverflow.com/comment/39060975
has comment: http://stackoverflow.com/comment/39060877
has answer: http://stackoverflow.com/a/25101448
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39060833
has comment: http://stackoverflow.com/comment/39061001
has comment: http://stackoverflow.com/comment/39060888
possible better answer: http://stackoverflow.com/a/25101348
has comment: http://stackoverflow.com/comment/39060887
has comment: http://stackoverflow.com/comment/39060845
has answer: http://stackoverflow.com/a/25101348

http://stackoverflow.com/comment/39123517
type: QuestionComment
comment on: http://stackoverflow.com/q/25134706
has text: `Is this behavior expected?` Well, did you expect it?
score: 0
type: Comment

http://stackoverflow.com/comment/39250300
has text: If you're not using Gradle to compile your project inside IntelliJ, then IntelliJ needs to know where all your libraries are, that's what the classpath is. It contains all the required libraries for your project.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25201794
score: 0

http://stackoverflow.com/q/25119957
upvote count: 1
has title: How to get the different types of errors from a Persistence Exception in JPA?
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25119999
tagged with: jpa
tagged with: eclipselink
tagged with: sqlite
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25119999
favorite count: 0
tagged with: exception
has body: How can i discriminate the error that caused the exception? I want to make different things based on the type of error i get. Something like this: try { entityManager.getTransaction().begin(); entityManager.persist(entity); entityManager.getTransaction().commit(); } catch (PersistenceException exception) { if(DUPLICATE_RECORD) //do something about it else if(SOME_VALUE_IS_NULL) //do something about it else if(SOME_VALUE_IS_OUT_OF_RANGE) //do something about it ... }

http://stackoverflow.com/q/25215145
has comment: http://stackoverflow.com/comment/39272852
score: -1
type: Question
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39272851
has answer: http://stackoverflow.com/a/25215160
tagged with: synchronization
has title: Does The new java synchronization mechanism preserve the code optimization by JVM.
has body: as we know that synchronization method or synchronization blocks preserve the java code and JVM does not optimize the code . is the this true for the new java synchronization mechanism.
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39275924
tagged with: java
has comment: http://stackoverflow.com/comment/39273275
downvote count: 3

http://stackoverflow.com/comment/39054284
type: QuestionComment
has text: Actually now that I think about it, using BreakIterator also has the same problem with names. Do you think there is anyway to fix that?
comment on: http://stackoverflow.com/q/25097687
score: 0
type: Comment

http://stackoverflow.com/comment/39187909
has text: Yeah you guys have a great point there which I just realized. :S this work was dated a few years back.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25169363

http://stackoverflow.com/q/25172479
has comment: http://stackoverflow.com/comment/39194790
has comment: http://stackoverflow.com/comment/39195437
has answer: http://stackoverflow.com/a/25177406
accepted answer: http://stackoverflow.com/a/25177406
tagged with: solr
type: AnsweredQuestion
tagged with: java
has body: I have about 30GB in memory on server. However, due to large data volume, the indexing takes about 28GB. Is there any way to configure the solr so the indexing of data can be store in hard disk, not in memory? Or if I can assign certain amount of data in memory while the rest in disk?
type: Question
score: 0
has title: solr indexing is stored in memory or disk
answer count: 1

http://stackoverflow.com/q/25162131
has comment: http://stackoverflow.com/comment/39181156
score: 4
has answer: http://stackoverflow.com/a/27070342
accepted answer: http://stackoverflow.com/a/25163624
answer count: 2
has title: Spring security fail in load balanced (AWS Beanstalk) environment?
has comment: http://stackoverflow.com/comment/39175061
tagged with: amazon-web-services
has comment: http://stackoverflow.com/comment/39175161
tagged with: spring-security
tagged with: amazon-elastic-beanstalk
favorite count: 0
has answer: http://stackoverflow.com/a/25163624
tagged with: spring
upvote count: 4
has comment: http://stackoverflow.com/comment/39174558
type: AnsweredQuestion
has body: I am working on an existing code that's working just fine in an existing environment. The application has a login form that takes user to a landing page after they login. My problem: When I moved the application to AWS Beanstalk (with 2 instances), successful login brings the user back to the login page The application is Spring-based (MVC, Security), with the following configuration for security: &lt;security:http use-expressions="true"&gt; &lt;security:intercept-url pattern="/" access="permitAll" /&gt; &lt;security:intercept-url pattern="/index.html" access="permitAll" /&gt; &lt;security:intercept-url pattern="/login.html" access="permitAll" /&gt; ... bunch of other pages .... &lt;security:intercept-url pattern="/secure/**" access="isAuthenticated()" /&gt; &lt;security:form-login login-page="/login.html" default-target-url="/secure/landing.html" authentication-failure-url="/login.html?login_error=1" /&gt; &lt;security:logout logout-url="/logout.html" logout-success-url="/login.html" /&gt; &lt;/security:http&gt; The application is working fine in a single node environment, example log trace when user logs in: 1: [http-bio-8080-exec-1 DEBUG DefaultRedirectStrategy - sendRedirect - Redirecting to '/myapp/secure/landing.html' 2: [http-bio-8080-exec-1] DEBUG HttpSessionSecurityContextRepository - saveContext - SecurityContext stored to HttpSession: 'org.springframework.security.core.context.SecurityContextImpl@86073c69: /* some details */ Granted Authorities: ROLE_USER' 3: [http-bio-8080-exec-1] DEBUG SecurityContextPersistenceFilter - doFilter - SecurityContextHolder now cleared, as request processing completed 4: [http-bio-8080-exec-1] DEBUG AntPathRequestMatcher - matches - Checking match of request : '/secure/landing.html'; against '/resources/**' When this application (we took the exact same war file) into AWS Beanstalk environment, configured with 2 instances, this is what happen: 1: [http-bio-8080-exec-7] DEBUG DefaultRedirectStrategy - sendRedirect - Redirectin…
downvote count: 0
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/27070342

http://stackoverflow.com/a/30129339
downvote count: 0
has comment: http://stackoverflow.com/comment/85900382
answers question: http://stackoverflow.com/q/25201430
score: 40
has comment: http://stackoverflow.com/comment/65866501
has body: On a Mac, I got the following error attempting to use '!' mvn groupId:artifactId:goal -P!profile-1 -bash: !profile: event not found Doing the following works with the '-': mvn groupId:artifactId:goal -P-profile1 Alternatively you can do: mvn groupId:artifactId:goal -P\!profile1
type: Answer
upvote count: 40

http://stackoverflow.com/a/25199148
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25199030
has body: What you are looking for is a ReadWriteLock . Where multiple threads can read at the same time. A write is blocked until the reading threads finish. And reads are blocked until the writing thread finishes.
upvote count: 5
accepted answer of: http://stackoverflow.com/q/25199030
score: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/39052356
comment on: http://stackoverflow.com/q/25096608
type: Comment
type: QuestionComment
has text: http://docs.oracle.com/javase/tutorial/essential/exceptions/handling.html
score: 0

javaplot
type: Tag
tags question: http://stackoverflow.com/q/25211853
tag name: javaplot

http://stackoverflow.com/comment/39213564
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25183557
type: AnswerComment
has text: There was something that I forgot to write in the question, which makes this solution unviable to me. There is default post-construction functionality in Index, which is inherited in both RootIndex as well as AbstractSubIndex. Composition will execute this functionality at least twice in all the cases you mentioned. Sorry that I didn't mention this part earlier; Updating now.

eclipse
tags question: http://stackoverflow.com/q/25192988
tags question: http://stackoverflow.com/q/25132734
tags question: http://stackoverflow.com/q/25152316
tags question: http://stackoverflow.com/q/25114994
tag name: eclipse
tags question: http://stackoverflow.com/q/25115288
tags question: http://stackoverflow.com/q/25214665
tags question: http://stackoverflow.com/q/25142760
tags question: http://stackoverflow.com/q/25168922
tags question: http://stackoverflow.com/q/25217179
tags question: http://stackoverflow.com/q/25217354
tags question: http://stackoverflow.com/q/25141087
tags question: http://stackoverflow.com/q/25084552
tags question: http://stackoverflow.com/q/25158234
tags question: http://stackoverflow.com/q/25199459
tags question: http://stackoverflow.com/q/25092426
tags question: http://stackoverflow.com/q/25130781
tags question: http://stackoverflow.com/q/25176781
tags question: http://stackoverflow.com/q/25199447
tags question: http://stackoverflow.com/q/25087250
tags question: http://stackoverflow.com/q/25189384
tags question: http://stackoverflow.com/q/25173108
tags question: http://stackoverflow.com/q/25129916
tags question: http://stackoverflow.com/q/25211003
tags question: http://stackoverflow.com/q/25107351
tags question: http://stackoverflow.com/q/25136412
tags question: http://stackoverflow.com/q/25160060
tags question: http://stackoverflow.com/q/25138623
tags question: http://stackoverflow.com/q/25105927
tags question: http://stackoverflow.com/q/25075842
tags question: http://stackoverflow.com/q/25128854
tags question: http://stackoverflow.com/q/25184185
tags question: http://stackoverflow.com/q/25144912
tags question: http://stackoverflow.com/q/25108234
tags question: http://stackoverflow.com/q/25116554
tags question: http://stackoverflow.com/q/25185890
tags question: http://stackoverflow.com/q/25107427
tags question: http://stackoverflow.com/q/25071872
tags question: http://stackoverflow.com/q/25123854
tags question: http://stackoverflow.com/q/25221207
tags question: http://stackoverflow.com/q/25105907
tags question: http://stackoverflow.com/q/25109980
tags question: http://stackoverflow.com/q/25145162
tags question: http://stackoverflow.com/q/25142059
tags question: http://stackoverflow.com/q/25098314
tags question: http://stackoverflow.com/q/25161661
tags question: http://stackoverflow.com/q/25197935
tags question: http://stackoverflow.com/q/25073728
tags question: http://stackoverflow.com/q/25117765
tags question: http://stackoverflow.com/q/25188014
tags question: http://stackoverflow.com/q/25110662
tags question: http://stackoverflow.com/q/25222811
tags question: http://stackoverflow.com/q/25102708
tags question: http://stackoverflow.com/q/25175348
tags question: http://stackoverflow.com/q/25073258
tags question: http://stackoverflow.com/q/25216029
tags question: http://stackoverflow.com/q/25160556
tags question: http://stackoverflow.com/q/25223188
tags question: http://stackoverflow.com/q/25090542
tags question: http://stackoverflow.com/q/25172453
tags question: http://stackoverflow.com/q/25122633
tags question: http://stackoverflow.com/q/25167149
tags question: http://stackoverflow.com/q/25223254
tags question: http://stackoverflow.com/q/25101059
tags question: http://stackoverflow.com/q/25095405
tags question: http://stackoverflow.com/q/25178763
tags question: http://stackoverflow.com/q/25087833
tags question: http://stackoverflow.com/q/25178089
tags question: http://stackoverflow.com/q/25091251
tags question: http://stackoverflow.com/q/25150370
tags question: http://stackoverflow.com/q/25186124
tags question: http://stackoverflow.com/q/25198494
tags question: http://stackoverflow.com/q/25076659
tags question: http://stackoverflow.com/q/25091732
tags question: http://stackoverflow.com/q/25135880
tags question: http://stackoverflow.com/q/25093815
tags question: http://stackoverflow.com/q/25102627
tags question: http://stackoverflow.com/q/25123245
tags question: http://stackoverflow.com/q/25095631
tags question: http://stackoverflow.com/q/25185428

embeddable
type: Tag
tags question: http://stackoverflow.com/q/25163514
tag name: embeddable

http://stackoverflow.com/comment/39259786
type: Comment
score: 0
has text: Just as another point. You're pointing to CDI API 1.2, but using a CDI 1.0 implementation. If you want it to work for CDI 1.2, using Weld Servlet 2.2.3.Final.
type: QuestionComment
comment on: http://stackoverflow.com/q/25205536

http://stackoverflow.com/q/25175794
has answer: http://stackoverflow.com/a/25482179
has body: We are usingApache Felix (version 4.4.1)as an embedded OSGi framework. The main application that is providing the framework is usingLog4j2 (version 2.0.1)as logging framework. There are dependencies on log4j-api and log4j-core. Of course when the main application is started also Log4j2 will be loaded and configured. All log messages triggered in the main part are correctly written to the configured appenders. Now the point. All bundles that are loaded should be able using the same configuration and for that the same LoggingContext as the main application. What I was trying to do is providing all Log4j2 packages (from log4j2-api and log4j-core) by putting them into the framework configuration asorg.osgi.framework.system.packages.extra. But when the bundles are loaded the log4j2 packages do not appear in the list of wiring packages as other provided packages do and when a bundle class tries to access Log4j2 classes an exception will be thrown. All bundles are configured the same way and having Log4j2 dependencies on log4j2-api and log4j2-core with scope provided. When I'm looking into the MANIFEST.MF the used Log4j2 packages are within theImport-Packagespart So my questions are. Why exporting of Log4j2 packages this way does not work? How do I have to configure my environment so I can use same LoggingContext in my bundles and main application? Here is my configuration part of the OSGi framework from the java code: Map<String, String> temp = new HashMap<String, String>(); // setting parameter that the felix cache is new initialized on each // start of the application temp.put(org.osgi.framework.Constants.FRAMEWORK_STORAGE_CLEAN, "onFirstInit"); // setting the packages that are provided by the main system and can // be used by the osgi bundles temp.put(org.osgi.framework.Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, // have to export these explicitly as the automatic export does // not work for this internal java packages + "com.sun.org.apache.xerces.internal.dom," + "com.s…
has comment: http://stackoverflow.com/comment/48530826
tagged with: osgi
answer count: 3
has comment: http://stackoverflow.com/comment/71375952
favorite count: 0
tagged with: apache-felix
linked to: http://stackoverflow.com/q/30045873
has title: Using Log4j2 from an embedded OSGi framework
accepted answer: http://stackoverflow.com/a/25482179
tagged with: log4j2
tagged with: logging
has answer: http://stackoverflow.com/a/27828741
type: AnsweredQuestion
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/32497685
possible better answer: http://stackoverflow.com/a/27828741
type: Question
score: 5
downvote count: 0

http://stackoverflow.com/a/25158313
score: 0
has body: When you compare two values, say a and b. There are only 3 possibility. a equals to b a less than b a greater than b So then you use compateTo() you need to check above cases only. Then 0 means there are equals. -1 mean a less than b and 1 means a greater than b If a and b are objects then reference value consider.
answers question: http://stackoverflow.com/q/25158221
has comment: http://stackoverflow.com/comment/39166342
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/39166322
has comment: http://stackoverflow.com/comment/39166460

http://stackoverflow.com/q/25147094
has answer: http://stackoverflow.com/a/55232425
favorite count: 0
upvote count: 867
has answer: http://stackoverflow.com/a/57201626
has answer: http://stackoverflow.com/a/47822203
has body: If I have a List&lt;List&lt;Object&gt;&gt;, how can I turn that into a List&lt;Object&gt; that contains all the objects in the same iteration order by using the features of Java 8?
has answer: http://stackoverflow.com/a/72576904
tagged with: java-8
has answer: http://stackoverflow.com/a/40409364
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/36242324
possible better answer: http://stackoverflow.com/a/50301326
answer count: 12
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/67219716
tagged with: collections
has answer: http://stackoverflow.com/a/57384469
accepted answer: http://stackoverflow.com/a/25147125
type: Question
score: 867
has answer: http://stackoverflow.com/a/25147125
has answer: http://stackoverflow.com/a/50301326
has answer: http://stackoverflow.com/a/51032633
has title: How can I turn a List of Lists into a List in Java 8?
has answer: http://stackoverflow.com/a/65867623

http://stackoverflow.com/q/25124876
has comment: http://stackoverflow.com/comment/39111781
downvote count: 1
tagged with: button
has comment: http://stackoverflow.com/comment/39105632
tagged with: initialization
favorite count: 0
linked to: http://stackoverflow.com/q/3018683
has answer: http://stackoverflow.com/a/25129033
has comment: http://stackoverflow.com/comment/39111799
tagged with: javafx-2
type: AnsweredQuestion
tagged with: fxml
upvote count: 0
possible better answer: http://stackoverflow.com/a/25129033
tagged with: java
has title: How to set button text in JavaFX?
has body: I'm trying to set the button text using this code: public void initialize(URL location, ResourceBundle resources) { // TODO Auto-generated method stub //checking to see whether these buttons were loaded from the FXML file assert fx_btnStart != null : "fx:id=\"fx_btnStart\" was not injected: Check your FXML file 'FX-Timer.fxml'."; assert fx_btnStop != null : "fx:id=\"fx_btnStop\" INJECTION ERROR"; assert fx_btnHourUp != null : "fx:id=\"fx_btnHourUp\" INJECTION ERROR"; assert fx_btnHourDown != null : "fx:id=\"fx_btnHourDown\" INJECTION ERROR"; assert fx_btnMinuteUp != null : "fx:id=\"fx_btnMinuteUp\" INJECTION ERROR"; assert fx_btnMinuteDown != null : "fx:id=\"fx_btnMinuteDown\" INJECTION ERROR"; //ending of initialization of FXML elements //set words for buttons yo. fx_btnHourUp.setText("HELLO"); } Here's my FXML: &lt;children&gt; &lt;Button mnemonicParsing="false" prefHeight="53.0" prefWidth="92.0" text="Hup" textAlignment="CENTER" alignment="CENTER" id="fx_btnHourUp"/&gt; &lt;Button mnemonicParsing="false" prefHeight="37.0" prefWidth="92.0" text="Hdown" GridPane.columnIndex="1" textAlignment="CENTER" alignment="CENTER" id="fx_btnHourDown" /&gt; &lt;Button mnemonicParsing="false" prefHeight="44.0" prefWidth="92.0" text="Mup" GridPane.columnIndex="2" textAlignment="CENTER" alignment="CENTER" id="fx_btnMinuteUp" /&gt; &lt;Button mnemonicParsing="false" prefHeight="39.0" prefWidth="122.0" text="Mdown" GridPane.columnIndex="3" textAlignment="CENTER" alignment="CENTER" id="fx_btnMinuteDown" /&gt; &lt;/children&gt; But it won't work I don't really get why, does anyone else know how to set button text using JavaFX? >.>; I feel like JavaFX isn't as straightforward as Swing...but anyways, anyone know what I'm doing wrong? Also, does anyone know any resources to learn FXML I like FXML more than coding it in Java but there doesn't seem to be much on it, am I like the only guy in the world who prefers FXML over JavaFX GUI coding?
type: Question
linked to: http://stackoverflow.com/q/14187963
has answer: http://stackoverflow.com/a/25129673
score: -1
accepted answer: http://stackoverflow.com/a/25129673
answer count: 2

http://stackoverflow.com/q/25154212
has comment: http://stackoverflow.com/comment/39160292
has comment: http://stackoverflow.com/comment/39159792
has comment: http://stackoverflow.com/comment/39159566
upvote count: 3
has title: org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
answer count: 1
has comment: http://stackoverflow.com/comment/42770724
favorite count: 0
has comment: http://stackoverflow.com/comment/39159846
has comment: http://stackoverflow.com/comment/39159623
has comment: http://stackoverflow.com/comment/39160194
has answer: http://stackoverflow.com/a/25155784
accepted answer: http://stackoverflow.com/a/25155784
has comment: http://stackoverflow.com/comment/39159193
tagged with: spring
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/39160454
downvote count: 0
has body: i am importing data from file ,its get the data suceessfully .my flow to call the ruleimplservice from the main class ,where i get the value from file.bt when i call jdbclogdatarepository to save the data ,it shows the following error.the data isreached successfully in impl bt not in jdbc class. ERRORS java.lang.NullPointerException at com.heavymeddlellc.heavymeddle.metrics.service.RuleServiceImpl.insertlogcontent(RuleServiceImpl.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at $Proxy6.insertlogcontent(Unknown Source) at com.heavymeddlellc.heavymeddle.utils.readingdata.main(readingdata.java:97) Java code is as below: package com.heavymeddlellc.heavymeddle.utils; import java.io.BufferedReader; import java.io.FileReader; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.core.io.Clas…
tagged with: java
type: Question

http://stackoverflow.com/comment/39070456
type: QuestionComment
has text: @Sree14 sorry about streing gender which u said I have to declare before onCreat I have problem with this case because I have to get the value of gender from `gender = genderchoosed.getText().toString();` and then use it in my function.is there any way which can I solve this problem.
type: Comment
comment on: http://stackoverflow.com/q/25102156
score: 0

http://stackoverflow.com/comment/39148543
comment on: http://stackoverflow.com/q/25147732
has text: @SoloSpirit: yes it really works, and yes you can use GridBagLayout, but use it correctly. Read the tutorials on it before using it. Please check out edits to answer below.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/25107884
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25107690
has body: I doubt that it's possible, because multiple selectors could be valid for your element -- eg, the trivial Selector.select("*",rootElement) would match it. It sounds like you don't want to use the same element-extraction code (that you initially used) for all subsequent documents? If you're intent on using selectors, then perhaps try different ones until you find one that you're happy with (from either a readability or a performance perspective).

http://stackoverflow.com/a/25133662
type: Answer
has body: You Can Try This: String[] singleBinaryArray = binary.toString().split("\\s"); String finalResult = ""; for (String string : singleBinaryArray) { Character c = (char) Integer.parseInt(string, 2); finalResult += c.toString(); } System.out.println("String " + finalResult);
has comment: http://stackoverflow.com/comment/39129282
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25131922
answers question: http://stackoverflow.com/q/25131922
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25211648
has answer: http://stackoverflow.com/a/25211860
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: mapreduce
type: Question
tagged with: hadoop
has title: Hadoop Mapper filling with MapOutputBuffer objects, is there a better way to skip bad keys?
downvote count: 0
accepted answer: http://stackoverflow.com/a/25211860
answer count: 1
favorite count: 0
has body: I'm working on a mapreduce project where I cannot guarantee beforehand that my mapper will always be given a usable keyvalue pair. I tried surrounding the relevant code with a try catch block like so public void map(LongWritable Key, Text values, Context context) throws IOException, InterruptedException { try { //Attempt process context.write(HKey, HValue); } } catch (Exception e) { //was given invalid value, drop it and move on context.nextKeyValue(); e.printStackTrace(); } } Memory profiling this on a large dataset reveals that MapOutputBuffers are taking up most of my memory, giving me an eventual out of memory error. Is there a better way to structure my Mapper so I dont have this issue? I'd rather not have to allocate extra memory as a stopgap.
linked to: http://stackoverflow.com/q/8464048

http://stackoverflow.com/a/25212487
has comment: http://stackoverflow.com/comment/39268159
has comment: http://stackoverflow.com/comment/39268006
has comment: http://stackoverflow.com/comment/39267911
has comment: http://stackoverflow.com/comment/39268246
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25212343
score: 0
accepted answer of: http://stackoverflow.com/q/25212343
type: Answer
has comment: http://stackoverflow.com/comment/39268237
has body: You need to implement your search activity. public class SearchableActivity extends ListActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("SEARCH", "HERE"); handleIntent(getIntent()); } public void onNewIntent(Intent intent) { setIntent(intent); handleIntent(intent); } public void onListItemClick(ListView l, View v, int position, long id) { // call the appropriate detail activity } private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); doSearch(query); } } private void doSearch(String queryStr) { Toast.makeText(getApplicationContext(), queryStr, Toast.LENGTH_LONG).show(); } } And specify the meta-data in your AndroidManifest.xml &lt;meta-data android:name="android.app.default_searchable" android:value=".SearchableActivity" /&gt; &lt;activity android:name=".SearchableActivity" android:label="@string/app_name" android:launchMode="singleTop" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.SEARCH" /&gt; &lt;/intent-filter&gt; &lt;meta-data android:name="android.app.searchable" android:resource="@xml/searchable" /&gt; &lt;/activity&gt;

http://stackoverflow.com/comment/39166753
type: Comment
comment on: http://stackoverflow.com/q/25158100
type: QuestionComment
has text: I edited your question to make it clearer. However I can't really understand what you want to achieve here. Put the EAR along with the sources? Deploy *Parent* to some remote repository?
score: 0

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/25191624
tags question: http://stackoverflow.com/q/25107351
tags question: http://stackoverflow.com/q/25177600
type: Tag
tags question: http://stackoverflow.com/q/25134882

http://stackoverflow.com/comment/39185777
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25166750
has text: The `rendered` property is easy to understand. If the condition is true, the component is rendered. Build your menu with all the possibility in your jsff and then condition all nodes with `rendered` property. When the page is loaded, the server will render only the components where rendered is true. You don't add components, you just render them or not.

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/25225272
tag name: osx-mavericks

http://stackoverflow.com/comment/39205277
comment on: http://stackoverflow.com/a/25179218
has text: Just gave this a try and JBoss returned a "Could not find resource for relative : /rest/functions/getWord/test of full path: http://xx.xx.xx.xx:8080/vimbaserver-1.0/rest/functions/getWord/test" error.
score: 2
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25077668
score: 7
tagged with: java
tagged with: hibernate
tagged with: jboss
type: Question
has body: we have recently migrated to JBoss 7.1.1 from JBoss 6 and therefore switched from hibernate 3.6.6 to hibernate 4.0.1 and encountered an issue when storing blob data to the database. Persisting a blob of ~80MB took less than 10s with hibernate 3, but with hibernate 4 it takes more than 1 minute to persist it. I have tried several versions of hibernate 4 - 4.0.x,4.1.x,4.2.x and the behaviour is the same. Environment: jboss 7.1.1, hibernate 4.0.1, ojdbc6, Oracle DB 11.2.0.3.0 - > 1 min jboss 6.1.0, hibernate 3.6.6, ojdbc6, Oracle DB 11.2.0.3.0 - ~ 10 sec I also turned on logging to TRACE level to see where the time is being consumed and found the following: 17:33:58,203 TRACE [org.hibernate.engine.spi.ActionQueue] Adding an EntityInsertAction for [x.x.datastore.persistence.LobDataOutEntity] object 17:33:58,204 TRACE [org.hibernate.engine.spi.ActionQueue] Adding insert with no non-nullable, transient entities: [EntityInsertAction[x.x.datastore.persistence.LobDataOutEntity#2972533]] 17:33:58,205 TRACE [org.hibernate.engine.spi.ActionQueue] Adding resolved non-early insert action. 17:33:58,206 TRACE [org.hibernate.action.internal.UnresolvedEntityInsertActions] No unresolved entity inserts that depended on x.x.datastore.persistence.LobDataOutEntity#2972533 **17:33:58,206 TRACE [org.hibernate.action.internal.UnresolvedEntityInsertActions] No entity insert actions have non-nullable, transient entity dependencies. 17:34:21,162 TRACE [org.hibernate.event.internal.AbstractFlushingEventListener] Flushing session** 17:34:21,163 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] Processing flush-time cascades 17:34:21,163 TRACE [org.hibernate.engine.internal.Cascade] Processing cascade ACTION_PERSIST_ON_FLUSH for: x.x.datastore.persistence.LobDataOutEntity 17:34:21,164 TRACE [org.hibernate.engine.internal.Cascade] Done processing cascade ACTION_PERSIST_ON_FLUSH for: x.x.datastore.persistence.LobDataOutEntity 17:34:21,189 TRACE [org.hibernate.persister.entity.Ab…
tagged with: jpa
has answer: http://stackoverflow.com/a/25105142
favorite count: 0
linked to: http://stackoverflow.com/q/9253323
upvote count: 7
answer count: 1
has comment: http://stackoverflow.com/comment/39017809
has comment: http://stackoverflow.com/comment/39018599
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39026767
has title: Hibernate 4 takes more than 1 minute to persist 80MB blob
downvote count: 0

http://stackoverflow.com/q/25107605
answer count: 2
possible better answer: http://stackoverflow.com/a/76423678
has answer: http://stackoverflow.com/a/25321327
has answer: http://stackoverflow.com/a/76423678
score: 35
upvote count: 35
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25321327
has title: Amazon SQS Java SDK - cannot receive message attributes
type: AnsweredQuestion
tagged with: java
has body: After posting a message with an attribute to SQS with the following code before sending it (and checking in SQS console to see if everything is posted correctly)... messageRequest.addMessageAttributesEntry( "attributeTest", new MessageAttributeValue() .withDataType("String") .withStringValue("attributeTest 123")); I cannot retrieve any of the message attributes in the message. All I see, as a result, is "0 attributes.". Reinspecting the message in Amazon SQS console, the message - and the attribute - are still there. // Message was previously checked in SQS console and contains // an attribute named "attributeTest" AmazonSQS sqs = ... List&lt;Message&gt; messages = sqs.receiveMessage(receiveMessageRequest).getMessages(); for (Message : messages) { Map&lt;String, MessageAttributeValue&gt; attributes = message.getMessageAttributes(); System.out.println("" + attributes.size() + " attributes."); } I am using Amazon SQS SDK v1.8 in Java 1.7 with Play Framework 2.2.3. At first I thought it could be the SQS version but tried upgrading to 1.8.7 with no avail. The official documentation found here does not provide any sourcecode to read the attributes at all. Nor github searches, stack overflow. I've been trying for a few hours without any success. Thanks for any help!
type: Question
tagged with: amazon-sqs

http://stackoverflow.com/a/25081206
has comment: http://stackoverflow.com/comment/39028332
has comment: http://stackoverflow.com/comment/39090968
has body: Change criteria.createAlias("Project", "Prj") to criteria.createAlias("project", "Prj"). The property for which you are trying to create an alias is project, so should go as the first argument of createAlias. Project is the class name.
has comment: http://stackoverflow.com/comment/39090395
has comment: http://stackoverflow.com/comment/39091230
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25081029
accepted answer of: http://stackoverflow.com/q/25081029
has comment: http://stackoverflow.com/comment/39024110
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25228183
score: 4
has comment: http://stackoverflow.com/comment/39297168
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39297082
answers question: http://stackoverflow.com/q/25228029
has comment: http://stackoverflow.com/comment/39297162
accepted answer of: http://stackoverflow.com/q/25228029
has comment: http://stackoverflow.com/comment/39296976
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/39297044
has comment: http://stackoverflow.com/comment/39297107
has body: Why are you synchronizing on 'this'? You are actually syncing on 4 different mutexes (the 'this' refers to the actual instance of the Producer or the Consumer). Try using synchronized(queue)
has comment: http://stackoverflow.com/comment/39297074

http://stackoverflow.com/q/25095829
has title: Eclipse gradle refresh from cmd
tagged with: eclipse
tagged with: gradle
upvote count: 2
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25097172
tagged with: cmd
tagged with: command
score: 2
type: UnansweredQuestion
has body: I wondered if there is a cmd command for refreshing an eclipse gradle project? Normally you would right-click -&gt; gradle -&gt; refresh -&gt; refresh all. I am looking for something like gradlew project:refresh eclipse, to be able to update projects using a .bat file. Cheers :)
type: Question
has answer: http://stackoverflow.com/a/25095913
tagged with: java

http://stackoverflow.com/q/25210181
has comment: http://stackoverflow.com/comment/39263638
has answer: http://stackoverflow.com/a/25210771
tagged with: sharepoint
has comment: http://stackoverflow.com/comment/39263729
accepted answer: http://stackoverflow.com/a/25210771
upvote count: 0
answer count: 1
tagged with: javascript
has body: I want to get access to download files from SharePoint 2007 (different Libraries) using javascript or java. So i want to code application which will allow to download files from SharePoint 2007. I have a full access to SharePoint. Can i do it? If i can, reference me please to some libraries or tools to do it. I have not experience with SharePoint at all. Actually i want to code application which can give access to all information which contains in SharePoint: files, lists and etc. Update: I did not ask you to find library or something. I ask you: "Can i do it?". Is there technically possibility. Because i did not find some thing useful after googling and have no experience with SharePoint.
favorite count: 0
has comment: http://stackoverflow.com/comment/39264049
has title: Access to files in Sharepoint 2007 using javascript from external site
has comment: http://stackoverflow.com/comment/39263860
type: AnsweredQuestion
tagged with: sharepoint-2007
downvote count: 2
tagged with: file
has comment: http://stackoverflow.com/comment/39264381
type: Question
score: -2
tagged with: java

http://stackoverflow.com/a/25101095
has comment: http://stackoverflow.com/comment/39080308
type: AcceptedAnswer
downvote count: 0
has body: I'm going to attempt to answer the question(s) I think you're asking, plus offer some (possibly redundant) advice on StackOverflow questions -- this doesn't look like your first time here, exactly, but I can see that you're new. The reason posts don't necessarily tell you what to import is that, if you don't know already, a simple google search for "java Classname", substituting the class you want, will tell you. In this case, PrintWriter is in the java.io package, so the import is java.io.PrintWriter. As was pointed out in the comments, you probably don't want to close the PrintWriter you've instantiated until after you are out of the loop. As the code stands, I would expect it to crash the second time through the loop on the first statement that attempts to write to the file. To ask good StackOverflow questions, try to keep in mind that we don't know what you're trying to do, we don't know what you've tried, and we don't know what your question is until/unless you tell us. SO lurkers don't tend to write programs for people, especially people who have not shown us what they've tried (and that they HAVE tried); this helps further define the question, and tells us what not to try or suggest ourselves. When you have a little program like this, post the whole thing and tell us it is the whole thing. If you have a compiler error, paste the entire compiler error into your question and say what you want to know about it. If you have a runtime stacktrace, paste the entire stacktrace into your question and say what you want to know about it. If the program is simply not doing what you expect, tell us (1) what it is doing, and (2) what you expect. Often in the course of this, after you've done it for a while, you will find your own answer to your question before you've posted it; it is one way SO helps, by guiding us to focus on the problem in a way that questions can be answered. Good luck.
answers question: http://stackoverflow.com/q/25100852
type: Answer
accepted answer of: http://stackoverflow.com/q/25100852
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39080333

http://stackoverflow.com/q/25122481
type: Question
has title: Json String Hashmap parse using QuickJson
answer count: 1
has answer: http://stackoverflow.com/a/25122808
score: 0
tagged with: parsing
has comment: http://stackoverflow.com/comment/39100545
type: UnansweredQuestion
has body: I am using Quick Json to parse a json String in the format to retrieve the title of all songs {"response": {"status": {"version": "4.2", "code": 0, "message": "Success"}, "songs": [{"artist_id": "ARJHCSL123E29C21E8", "id": "SOENBWC13E58ECFBDD", "artist_name": "Bruno Mars", "title": "Grenade (En Vivo @ SXM)"}, {"artist_id": "ARJHCSL123E29C21E8", "id": "SOHQYKB130516E0C3B", "artist_name": "Bruno Mars", "title": "Bruno Mars - Just The Way You Are (Lee Wright Remix)"}, {"artist_id": "ARJHCSL123E29C21E8", "id": "SOFGCTK13DBAFD643B", "artist_name": "Bruno Mars", "title": "Young, Wild &amp; Free (Originally Performed By Snoop Dogg, Wiz Khalifa) [Karaoke Version]"}, {"artist_id": "ARJHCSL123E29C21E8", "id": "SOJGNLU12C0DD05554", "artist_name": "Bruno Mars", "title": "GRENADE (Clean)/(CONTENT!)"}, {"artist_id": "ARJHCSL123E29C21E8", "id": "SOQJPOT13E58EA39D4", "artist_name": "Bruno Mars", "title": "Just The Way You Are (En Vivo @ SXM)"}, {"artist_id": "ARJHCSL123E29C21E8", "id": "SOBXSGM1468D0E25AD", "artist_name": "Bruno Mars", "title": "Locked Out Of Heaven - Manhattan's XOYO Mix"}, {"artist_id": "ARJHCSL123E29C21E8", "id": "SOIVCUQ13D3EE80CED", "artist_name": "Bruno Mars", "title": "Nothing On You"}, {"artist_id": "ARJHCSL123E29C21E8", "id": "SOKLXMU12AF72A8FE6", "artist_name": "Bruno Mars", "title": "Count On Me (EP Version)"}, {"artist_id": "ARJHCSL123E29C21E8", "id": "SOXHAGE1340BBA40EC", "artist_name": "Bruno Mars", "title": "Just The Way You Are (Carl Louis &amp; Martin Danielle Classic Mix)"}, {"artist_id": "ARJHCSL123E29C21E8", "id": "SOMYEUN141E947704E", "artist_name": "Bruno Mars", "title": "Grenade (Michael Meds Mix)"}, {"artist_id": "ARJHCSL123E29C21E8", "id": "SOTSIBX136C2EE52F3", "artist_name": "Bruno Mars", "title": "DJ T Finguz Cadillac MIX"}, {"artist_id": "ARJHCSL123E29C21E8", "id": "SOVSSEW1312FDFC23C", "artist_name": "Bruno Mars", "title": "The Lazy Song (Official Remix)"}, {"artist_id": "ARJHCSL123E29C21E8", "id": "SOTUEIS135A61E6B89", "artist_name": "…
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/39095851
type: Comment
type: QuestionComment
has text: @Noor Then please post your solution as an answer.
comment on: http://stackoverflow.com/q/25116232
score: 1

http://stackoverflow.com/comment/39266748
has text: @tawheed I think I still prefer the approach I suggested. It keeps things DRY in every methods and gives you the flexibility of handling exceptions in other processes if you want. This approach is still fine however.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25210384

http://stackoverflow.com/a/25216191
score: 0
has comment: http://stackoverflow.com/comment/39278390
type: Answer
has comment: http://stackoverflow.com/comment/39295729
has comment: http://stackoverflow.com/comment/39302809
has body: Yes it looks like hibernate is caching your query and returning cached results. Please give us a overview of your code to suggest better. Below listed are two ways of controlling the caching behaviour of queries:- 1) At the main named query level:- @NamedQuery( name = "myNamedQuery" query = "SELECT u FROM USER WHERE u.items is EMPTY" hints = {@QueryHint(name = "org.hibernate.cacheMode", value = "IGNORE")} ) 2) At individual query level :- Query q = session.createQuery("from User") .setCacheMode(CacheMode.IGNORE);
answers question: http://stackoverflow.com/q/25214765

http://stackoverflow.com/q/25083295
tagged with: java
has comment: http://stackoverflow.com/comment/39027143
has comment: http://stackoverflow.com/comment/39027961
has comment: http://stackoverflow.com/comment/39027561
linked to: http://stackoverflow.com/q/16835974
has comment: http://stackoverflow.com/comment/39028545
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/27171103
upvote count: 12
has comment: http://stackoverflow.com/comment/39028293
has comment: http://stackoverflow.com/comment/44889900
has comment: http://stackoverflow.com/comment/39027139
has answer: http://stackoverflow.com/a/27171103
tagged with: hibernate
tagged with: hibernate-session
has answer: http://stackoverflow.com/a/59141198
has title: Spring @Async: null hibernate session on LAZY collection
score: 11
has body: I'm using an @Async annotation on a service layer method. Everything works fine when I EAGERLY load @OneToMany collection fields, but when I try to access LAZY loaded element I found that Hibernate SessionImplementor object session is null. That obviously give me an exception: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: .... Here is my collection field: @OneToMany(mappedBy="abc", fetch=FetchType.LAZY, cascade=CascadeType.REMOVE) @OrderBy(value="xsd asc") @JsonIgnore private Set<Item> items = new HashSet<Item>(); How can I bind hibernate session in order to LAZELY load my object inside @Async context? EDIT Here is my trancactionManager / entityManager configuration <tx:annotation-driven transaction-manager="transactionManager" /> ${hibernate.dialect} org.hibernate.cfg.ImprovedNamingStrategy true ${hibernate.hbm2ddl.auto} false UTF-8 3 50 20 _H AUDIT_REVISION ACTION_TYPE org.hibernate.envers.strategy.ValidityAuditStrategy AUDIT_REVISION_END True AUDIT_REVISION_END_TS <jpa:repositories base-package="it.repository" entity-manager-factory-ref="emf" transaction-manager-ref="transactionManager"/> <jpa:auditing auditor-aware-ref="auditorAwareBean" />
has answer: http://stackoverflow.com/a/25083478
favorite count: 0
has answer: http://stackoverflow.com/a/25083413
tagged with: spring
accepted answer: http://stackoverflow.com/a/25083413
answer count: 4
has comment: http://stackoverflow.com/comment/39027627
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39028326

http://stackoverflow.com/comment/40561488
comment on: http://stackoverflow.com/a/25083505
score: 3
type: AnswerComment
has text: spring reference seems a bit complicated to understand for first timers. good explanation. simple..
type: Comment

http://stackoverflow.com/comment/39291325
type: Comment
type: QuestionComment
has text: Try using a .png or .gif image file instead of an .ico file.
comment on: http://stackoverflow.com/q/25224792
score: 0

http://stackoverflow.com/q/25084552
has comment: http://stackoverflow.com/comment/39036531
answer count: 1
downvote count: 1
favorite count: 0
has body: I have a created a login test for my website using the TestNG framework in Java in Eclipse and want to execute my tests through an XML file by running it through the command prompt. The name of the website I want to test is named My Website. The root folder of my project is Test My Website and the file system of my folder is illustrated in the following screenshot: I have followed the instructions as given over here and have arranged my project's file system accordingly. PS: A bin folder also exists in my project's root which is used by the Java compiler to store the .class files but is not displayed in the Eclipse's Package Explorer. The source code of the TestClass1.java is, package testngsample; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.testng.annotations.AfterClass; public class TestClass1 { protected static WebDriver driver; protected static String result; @BeforeClass public void setup() { driver = new ChromeDriver(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.manage().window().maximize(); } @Test void loginTest() { try { driver.get("https://test.rockon.me"); driver.findElement(By.id("btnLogin")).click(); driver.findElement(By.id("txtUserName")).sendKeys("max_marchisio"); driver.findElement(By.id("txtPassword")).sendKeys("Rockon123"); driver.findElement(By.id("GoArrow")).click(); Thread.sleep(15000); result = driver.getTitle(); Assert.assertEquals(result, "Home | RockON"); } catch (InterruptedException e) { e.printStackTrace(); } } @AfterClass public void teardown() { driver.close(); driver.quit(); } } The source code of the TestNG.xml file is, &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;suite name="My sample Suite"&gt; &lt;test name="Search test"&gt; &lt;classes&gt; &lt;class name="TestClass1" /&gt; &…
tagged with: http://stackoverflow.com/tag/xml
tagged with: testng
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: selenium
has title: TestNG XML File Not Getting Executed
tagged with: eclipse
type: Question
score: -1
has answer: http://stackoverflow.com/a/25094601
accepted answer: http://stackoverflow.com/a/25094601

http://stackoverflow.com/comment/39126078
type: Comment
has text: Do you have any other constructor in class **Circle** ? If not, then you cannot from within the constructor call itself by *this(a,b,c,)* On a more basic level, your constructor does not define the type of its parameters.
type: QuestionComment
comment on: http://stackoverflow.com/q/25136042
score: 0

http://stackoverflow.com/comment/39106553
comment on: http://stackoverflow.com/a/25124517
type: AnswerComment
score: 0
type: Comment
has text: I need to stop cursor in there when conditions has occurred , that when I call process method, starts reading where stoped!

http://stackoverflow.com/q/25090983
has title: Can't get SIM900 GPRS server to stream data with TCP clients
has body: I am working on a project where I need to set a SIM900 module attached to a Raspberry PI to work on server mode and receive requests from remote clients. Everything works well as far as setting up the server and receiving client connections. These are established but no data is going through. The server can't receive data nor send it to the clients. I am in Argentina and I am using a SIM card from the carrier Claro and an APN that provides a public IP. In order to talk to the GPRS module I am using PI4J and code as follows. package pi4j; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import com.pi4j.io.serial.Serial; import com.pi4j.io.serial.SerialDataEvent; import com.pi4j.io.serial.SerialDataListener; import com.pi4j.io.serial.SerialFactory; public class SerialExample { static String post; static final Serial serial = SerialFactory.createInstance(); static List&lt;InputHandler&gt; handlers = new ArrayList&lt;InputHandler&gt;(); public static void main(String args[]) throws InterruptedException, IOException { serial.addListener(new SerialDataListener() { String input = ""; public void dataReceived(final SerialDataEvent event) { System.out.print(event.getData()); input += event.getData(); for (int i = 0; i &lt; handlers.size(); i++) { InputHandler handler = handlers.get(i); synchronized (handler) { String output = handler.handle(input); if (!input.equals(output)) { input = output; handler.notify(); } } if (handler.pop) { handlers.remove(handler); i++; } } } }); serial.open(Serial.DEFAULT_COM_PORT, 115200); new Thread() { public void run() { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = null; try { while((line = br.readLine()) != null) { line = line.replace("ctrl+z", "" + (char) 0x1a); if(line.endsWith("" + (char) 0x1a)) serial.write(line); else serial.writeln(line…
downvote count: 0
tagged with: at-command
tagged with: sim900
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: sockets
score: 2
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39061251
type: Question
tagged with: raspberry-pi

http://stackoverflow.com/a/25077786
has comment: http://stackoverflow.com/comment/103324352
has body: In case you want to create new array filled with results generated by Supplier you can use Object[] array = Stream.generate(supplier) .limit(arraySize) .toArray(); // will generate new *Object[]* array For different types than Object[] you can use toArray(IntFunction<YourType[]> generator); like toArray(YourType[]::new) (credits to @Holger). String[] array = Stream.generate(supplier) .limit(10) .toArray(String[]::new); //now *String[]* array will be returned Streams also allow us to work with most "popular" primitive types which are int long and double. For instance we can use IntStream#toArray to create int[] holding elements from IntStream. To "fill" IntStream with elements from supplier we can use IntStream.generate(intSupplier) like int[] array = IntStream.generate(()->1) .limit(5) .toArray(); //returns `new Int[]{1,1,1,1,1} In case when you want to fill already existing array with data from Supplier see answer posted by Stuart Marks based on Arrays.setAll(array, supplier) which aside from handling arrays of objects also supports some arrays of primitive types: double[] int[] and long[] . Other alternative is to use creative solution from @Hogler's comment: Arrays.asList(array).replaceAll(x -> supplier.get()); //you can even overwrite a range using `subList` just be aware that Arrays.asList is designed to work with arrays of reference type (non-primitive ones), so it will not handle "properly" arrays like int[] as explained by Jon Skeet in answer: https://stackoverflow.com/a/1467940.
upvote count: 36
has comment: http://stackoverflow.com/comment/39016677
score: 36
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25077203
type: Answer
answers question: http://stackoverflow.com/q/25077203
has comment: http://stackoverflow.com/comment/39016740
has comment: http://stackoverflow.com/comment/39016826
has comment: http://stackoverflow.com/comment/39019224

http://stackoverflow.com/q/25185642
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25186480
accepted answer: http://stackoverflow.com/a/25186480
has title: Spring MVC building a lazy-init bean not called, property ref bean issue?
score: 0
answer count: 1
has body: I have been looking into everything I know about Spring and on the forums a lot but I can't figure out this issue. I have an xml of lazy-init beans. I understand how the lazy-init works, as every other bean is only resolved when called. One bean however, will always be created, regardless of it actually being called. If I comment out a single property line of the bean, the bean does not get created, obviously meaning that property must be getting called somewhere, but it just isn't. &lt;property name="discriminator" value="${review.queue.discriminator}"/&gt; That is the line that calls itself automatically so my handful of questions are: Does setting a value in the property cause it to automatically be called? What else would I be able to do to make sure that this line will not get called? Thank you for any help!
tagged with: spring

http://stackoverflow.com/comment/39245692
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25200245
score: 0
has text: You could use simple and fast merge algorithm (complexity O(1) for space and O(n) for time) if the lists coming from each datasource are ordered by ID. Are they ordered?

http://stackoverflow.com/q/25124282
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: bukkit
has body: So basically I am creating a magic wand plugin for bukkit. I was wondering how you can set a players model. For example, if I right click it will turn me into a chicken. I have no idea on how to do this.
type: Question
has answer: http://stackoverflow.com/a/25124739
has title: How would you setModel() to the player entity for a Minecraft bukkit plugin
tagged with: minecraft
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25124739
upvote count: 1
tagged with: plugins

http://stackoverflow.com/comment/61882839
has text: I've noticed this too. Especially when marshaling the response. Spring uses the Class of the response type to create a new marshaller. See: AbstractJaxb2PayloadMethodProcessor. `createMarshaller(getJaxbContext(clazz));`
score: 0
comment on: http://stackoverflow.com/q/25185122
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39060167
type: QuestionComment
score: 2
has text: A complete (if minimal) code example showing your problem might help clarify things. As it is, this question is too vague for me to understand. Please edit your question rather than trying to post a code example in comments.
comment on: http://stackoverflow.com/q/25100965
type: Comment

http://stackoverflow.com/a/50853984
score: 7
has comment: http://stackoverflow.com/comment/101074265
downvote count: 0
has comment: http://stackoverflow.com/comment/89339126
type: Answer
has comment: http://stackoverflow.com/comment/125852261
answers question: http://stackoverflow.com/q/25179180
has body: This post deals with the Hibernate. The suggestion of putting the @SqlResultSetMapping and @NamedNativeQuery (or @NamedQuery) inside the @Entity class definition is not elegant and evidently does not follow the separation of concerns principle. The more proper solution is the usage of the @MappedSuperclass annotation as the following: SingerExtended.java (the class must be abstract): package pl.music.model.singer.extended; import javax.persistence.ColumnResult; import javax.persistence.ConstructorResult; import javax.persistence.MappedSuperclass; import javax.persistence.NamedNativeQueries; import javax.persistence.NamedNativeQuery; import javax.persistence.SqlResultSetMapping; @MappedSuperclass @SqlResultSetMapping( // @formatter:off name = "SingerExtendedMapping", classes = @ConstructorResult( targetClass = SingerExtendedDTO.class, columns = { @ColumnResult(name = "singer_id", type = Long.class), @ColumnResult(name = "first_name"), @ColumnResult(name = "last_name"), @ColumnResult(name = "count_albums", type = Long.class) } ) ) @NamedNativeQueries({ @NamedNativeQuery( name = "SingerExtendedAsc", query = "select" + " singer.singer_id," + " singer.first_name," + " singer.last_name," + " (select count(*) from album where album.singer_id = singer.singer_id) as count_albums" + " from singer" + " group by singer.singer_id" + " order by last_name collate :collation asc, first_name collate :collation asc", resultSetMapping = "SingerExtendedMapping" ) }) // @formatter:on public abstract class SingerExtended { } then DAO class SingerExtendedDAO.java: package pl.music.model.singer.extended; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class SingerExtendedDAO { @PersistenceContext EntityManager entityManager; @Autowired private String collation; publi…
upvote count: 7

http://stackoverflow.com/comment/39193180
comment on: http://stackoverflow.com/a/25172239
type: AnswerComment
score: 0
type: Comment
has text: `str is merely a reference to a String` - what does this mean? if you used some other object then `obj is a reference to a Object` and this has got nothing to do with `String` being immutable.

magic-numbers
tag name: magic-numbers
tags question: http://stackoverflow.com/q/25177795
type: Tag

vaadin
tags question: http://stackoverflow.com/q/25204539
tag name: vaadin
tags question: http://stackoverflow.com/q/25163592
tags question: http://stackoverflow.com/q/25204693
tags question: http://stackoverflow.com/q/25196347
type: Tag
tags question: http://stackoverflow.com/q/25194805
tags question: http://stackoverflow.com/q/25218419
tags question: http://stackoverflow.com/q/25107103
tags question: http://stackoverflow.com/q/25190006
tags question: http://stackoverflow.com/q/25143422
tags question: http://stackoverflow.com/q/25129334
tags question: http://stackoverflow.com/q/25192327
tags question: http://stackoverflow.com/q/25201319

http://stackoverflow.com/comment/39180571
has text: There should be algorithms around for finding all combinations--i.e. if you have a set, find all subsets that have exactly 7 elements. Now do that with a multi-set that contains 4 copies of each element from your original set. (But that will get you a lot of duplicate subsets...)
score: 0
comment on: http://stackoverflow.com/q/25165576
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39194993
score: 1
type: Comment
type: QuestionComment
has text: If you sort by name first, shouldn't "Dave"` be ahead of "Sas"?
comment on: http://stackoverflow.com/q/25173229

http://stackoverflow.com/a/25196675
has comment: http://stackoverflow.com/comment/39311658
upvote count: 1
has body: It seems you provide the jar only at compile time and not providing the jar class path when you try to execute the code: javac -cp /home/ec2-user/development/mysql-connector-java-5.1.12.jar Java2MySql.java I assume it to be a typo javac and not java You need to provide the jar path when executing the code as well. So change this java Java2MySql to java -cp .:/home/ec2-user/development/mysql-connector-java-5.1.12.jar Java2MySql Note: mysql-connector-java-5.1.12.jar is only required at runtime in your case because you are loading the class dynamically.
score: 1
has comment: http://stackoverflow.com/comment/39238105
accepted answer of: http://stackoverflow.com/q/25196522
answers question: http://stackoverflow.com/q/25196522
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39244602
type: Answer

http://stackoverflow.com/comment/39255162
type: Comment
type: QuestionComment
has text: Is the server trying to read everything the client might send before writing anything back? It's hard to tell with the way you've formatted the code.
comment on: http://stackoverflow.com/q/25186924
score: 0

http://stackoverflow.com/q/25177134
upvote count: 0
answer count: 1
has body: import com.documentum.com.DfClientX; import com.documentum.com.IDfClientX; import com.documentum.fc.client.IDfClient; import com.documentum.fc.client.IDfSession; import com.documentum.fc.client.IDfSessionManager; import com.documentum.fc.client.IDfSysObject; import com.documentum.fc.common.IDfLoginInfo;; public class Samplesession { IDfSysObject sysObject = null; IDfSessionManager sessMgr = null; public Samplesession() { System.out.println("SessionEx constructor called!!!"); } public IDfSessionManager getSessionManager(String args1, String args2, String args3) throws Exception { IDfClientX clientx= new DfClientX(); IDfClient client=clientx.getLocalClient(); IDfSessionManager sMgr = client.newSessionManager(); IDfLoginInfo login = clientx.getLoginInfo(); login.setUser(args1); login.setPassword(args2); sMgr.setIdentity(args3, login); return sMgr; } public static void main(String[] args) { { String user="",password="",docbase=""; IDfSessionManager sMgr = null; IDfSession session = null; try { Samplesession object = new Samplesession(); sMgr=object.getSessionManager(user,password,docbase); session=sMgr.getSession(docbase); if (session != null) System.out.println("Session created Successfully!!!"+session); else System.out.println("Please check the login information again!!!"); } catch(Exception e) { e.printStackTrace(); } finally { if (session != null) { sMgr.release(session); System.out.println("Session released Successfully!!!"); } } } } } } This is uder the dfc classes And the errors are below!!!!!!!! SessionEx constructor called!!! 0 [main] ERROR com.documentum.fc.common.impl.logging.LoggingConfigurator - Problem locating log4j configuration 0 [main] WARN com.documentum.fc.common.impl.logging.LoggingConfigurator - Using default log4j configuration 10374 [main] WARN com.documentum.fc.client.impl.bof.classmgmt.ModuleManager - [DFC_BOF_COULDNT_CONNECT_TO_REGISTRY] Unable to connect to module registry, docbase name docbasename username dm_bof_registry. DfAuthenticationEx…
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/39209912
has comment: http://stackoverflow.com/comment/39234804
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39212788
has answer: http://stackoverflow.com/a/25191360
tagged with: java
has title: documentum Session getting error
has comment: http://stackoverflow.com/comment/39212759
downvote count: 1
type: Question
tagged with: dfc
has comment: http://stackoverflow.com/comment/39262247
has comment: http://stackoverflow.com/comment/39240506
accepted answer: http://stackoverflow.com/a/25191360
tagged with: documentum

http://stackoverflow.com/q/25182090
tagged with: apache-poi
upvote count: 2
has answer: http://stackoverflow.com/a/25183227
has body: this is a "worksheet#.xml" inside a .xlsx file I created with MS Office Excel. ... <selection activeCell="B27" sqref="B27"/> <sheetFormatPr baseColWidth="10" defaultRowHeight="12.75" x14ac:dyDescent="0.2"/> <c r="A1" s="5" t="s"> <v>43</v> </c><c r="B1" s="1" t="s"> <v>44</v> </c> <c r="A2" s="6" t="s"> <v>45</v> </c><c r="B2" s="2" t="s"> <v>46</v> </c> ... If I append rows to this file using Apache POI, I get additional rows without any spans or formats ... ... ... Is there a way to set the span of a row using Apache POI?
tagged with: excel
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25183227
tagged with: apache
answer count: 1
downvote count: 0
favorite count: 0
has title: Is it possible to set the "spans" attribute of a row in the "worksheet#.xml" using Apache POI
tagged with: xssf
score: 2

http://stackoverflow.com/a/25220164
has comment: http://stackoverflow.com/comment/39282679
has comment: http://stackoverflow.com/comment/39282509
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39282529
has comment: http://stackoverflow.com/comment/39282361
has comment: http://stackoverflow.com/comment/39282619
type: Answer
has comment: http://stackoverflow.com/comment/39282319
has comment: http://stackoverflow.com/comment/39282748
has comment: http://stackoverflow.com/comment/39282547
score: 1
accepted answer of: http://stackoverflow.com/q/25220101
upvote count: 1
answers question: http://stackoverflow.com/q/25220101
has comment: http://stackoverflow.com/comment/39282878
has comment: http://stackoverflow.com/comment/39282585
has body: Without looking at the API calls, the decrypt methods should throw an exception if an error occurs. In your exception handler, you can set a flag that will allow you to display an error message. You can also delay the decrypted file creation till after successful decryption (or at least till after the first block has been successfully decrypted). If decryption then fails further along the line, you can delete the (essentially temporary) decrypted output file and display the error message. [edit] I slightly misunderstood the original post, so some suggestions to check for failed decryption (note that these are higher level than AES, so it might be specific to your application only): Add a checksum to the plaintext data before encryption Append other metadata (file size, user, date, etc) to the plaintext, and check for these when decrypting Usually, a padding exception would occur on decryption - check for these (and any other giveaways) Use PKI (public key infrastructure) functionality such as signatures (this is outside the scope of this answer, and possibly outside the scope of the problem you're trying to solve)

http://stackoverflow.com/comment/39146081
has text: if you maintain which index you are at you can use that to get the previous.
comment on: http://stackoverflow.com/q/25146945
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39049799
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25095459
has text: Most multiplayer games uses UDP for the bulk of their communication. But not often for chat though, then they use TCP.
score: 0

http://stackoverflow.com/q/25206185
tagged with: generics
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39283752
has answer: http://stackoverflow.com/a/25206280
upvote count: 1
possible better answer: http://stackoverflow.com/a/25206479
tagged with: collections
downvote count: 1
has answer: http://stackoverflow.com/a/25206479
has comment: http://stackoverflow.com/comment/39275727
type: Question
accepted answer: http://stackoverflow.com/a/25206280
has comment: http://stackoverflow.com/comment/39256320
has comment: http://stackoverflow.com/comment/39255968
tagged with: java
has title: Is it possible to return raw object from generic method?
has comment: http://stackoverflow.com/comment/39256437
answer count: 3
has comment: http://stackoverflow.com/comment/39256107
has body: research this method from Colletions class: @SuppressWarnings("unchecked") public static final &lt;T&gt; Set&lt;T&gt; emptySet() { return (Set&lt;T&gt;) EMPTY_SET; } Collections.emptySet() return `Set&lt;Object&gt;` This behaviour differ from generic classes. If I instantiate generic class without &lt;T&gt; I work with raw object. I noticed this after method accept generic set was failed as compilation error: public class GenericMethodRaw { public static void main(String [] args){ Set set = Collections.emptySet(); method(set); //fine method(Collections.emptySet()); //compilation error here Set&lt;String&gt; set1 = Collections.emptySet();//fine compilation } public static void method(Set&lt;String&gt; strings){} } compiler message: java: method method in class GenericMethodRaw cannot be applied to given types; required: java.util.Set&lt;java.lang.String&gt; found: java.util.Set&lt;java.lang.Object&gt; reason: actual argument java.util.Set&lt;java.lang.Object&gt; cannot be converted to java.util.Set&lt;java.lang.String&gt; by method invocation conversion
has comment: http://stackoverflow.com/comment/39284983
has answer: http://stackoverflow.com/a/25216628
favorite count: 0
score: 0
tagged with: generic-method

implicit-conversion
tags question: http://stackoverflow.com/q/25072356
type: Tag
tag name: implicit-conversion

http://stackoverflow.com/comment/39210070
has text: i ve edited first post
comment on: http://stackoverflow.com/q/25176436
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39212544
type: Comment
has text: Use HTML parser or write your own.
comment on: http://stackoverflow.com/q/25183323
score: 3
type: QuestionComment

http://stackoverflow.com/comment/39206540
has text: While this most likely describes the symptom correctly, filtering out null characters is not the correct solution. Since the question states that the problem does not occur in single-threaded use it indicates that there is a serious thread-safety problem at the place where `name` has been constructed. This has to be fixed to ensure that there are no other issues lurking to show up at a later time.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25175609

http://stackoverflow.com/q/25217416
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: Here's my code: import java.awt.*; import java.awt.event.*; import java.awt.image.*; import java.util.Random; import javax.imageio.ImageIO; import javax.swing.*; public class FlatShadingDemo { static BufferedImage myPicture; static JLabel pic; static int width = 800; static int height = 450; static Random r = new Random(); private static void initialise() { JFrame frame = new JFrame("Flat shading demo"); JPanel layout = new JPanel(); layout.setLayout(new BoxLayout(layout,BoxLayout.Y_AXIS)); frame.getContentPane().add(layout); myPicture = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); pic = new JLabel(new ImageIcon(myPicture)); JButton button = new JButton("Refresh"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { render(); } } ); layout.add(pic); layout.add(button); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { initialise(); render(); } public static void render() { for (int y = 0; y &lt; height; y++) { for (int x = 0; x &lt; width; x++) { myPicture.setRGB(x, y, new Color(r.nextInt(256),r.nextInt(128),r.nextInt(25)).getRGB()); } } } } When I run this, an image is generated and displayed. When I click 'refresh' nothing happens until I resize the window. Which of myPicture, pic, layout, and frame, do I need to refresh, and what is the the function name for this? I'm completely new to swing and graphics so any help would be appreciated.
type: Question
has title: How to make BufferedImage within JLabel within JPanel within JFrame refresh properly?
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25217438
favorite count: 0
accepted answer: http://stackoverflow.com/a/25217438
tagged with: swing

http://stackoverflow.com/q/25190956
upvote count: 1
has comment: http://stackoverflow.com/comment/39227682
has comment: http://stackoverflow.com/comment/39227950
favorite count: 0
has comment: http://stackoverflow.com/comment/39227788
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39227908
downvote count: 0
linked to: http://stackoverflow.com/q/214741
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25191238
has comment: http://stackoverflow.com/comment/39227716
has title: Java - StackOverFlowError
type: Question
has body: I need some help for this. First I have a class BinarySearchTree import java.util.ArrayList; import java.util.List; public class BinarySearchTree&lt;E extends Comparable&lt;? super E&gt;&gt; { private BSTNode&lt;E&gt; root; private int size; // root ==null iff size == 0 public BinarySearchTree() { root = null; size = 0; } public boolean add(E value) { int oldSize = size; root = addHelper(root, value); return oldSize != size; } private BSTNode&lt;E&gt; addHelper(BSTNode&lt;E&gt; n, E val) { if (n == null) { n = new BSTNode&lt;E&gt;(null, val, null); size++; } else { int diff = val.compareTo(n.getData()); if (diff &lt; 0) n.setLeft(addHelper(n.getLeft(), val)); else if (diff &gt; 0) n.setRight(addHelper(n.getRight(), val)); } return n; } public boolean remove(E value) { int oldSize = size; root = removeHelp(root, value); return oldSize != size; } // helper method for remove private BSTNode&lt;E&gt; removeHelp(BSTNode&lt;E&gt; n, E val) { if (n != null) { int diff = val.compareTo(n.getData()); if (diff &lt; 0) n.setLeft(removeHelp(n.getLeft(), val)); // traverse the left // side else if (diff &gt; 0) n.setRight(removeHelp(n.getRight(), val)); // traverse right // side else // if value is found { size--; if (n.getLeft() == null &amp;&amp; n.getRight() == null) // if value // contained in // leaf, just // make nul; n = null; else if (n.getRight() == null) // single child to left n = n.getLeft(); // move the child up to replace removed // node else if (n.getLeft() == null) n = n.getRight(); else // two children, replace value with max of left subtree - // it will not have a right subtree { n.setData(getMax(n.getLeft())); // now remove max of left subtree from its previous position n.setLeft(removeHelp(n.getLeft(), n.getData())); // add 1 back to size since size will be decremented from // this 2nd removal size++; } } } return n; } // helper method to find Max of a subtree private E getMax(BSTNode&lt;E&gt; n) { while (n.getRight() != null) n = n.getRight(); return n.getDat…
has comment: http://stackoverflow.com/comment/39227565
has comment: http://stackoverflow.com/comment/39227722
linked to: http://stackoverflow.com/q/4734108
has comment: http://stackoverflow.com/comment/39228095
tagged with: stack-overflow
has answer: http://stackoverflow.com/a/25191101
has answer: http://stackoverflow.com/a/25191177
has comment: http://stackoverflow.com/comment/39227603
answer count: 3
has comment: http://stackoverflow.com/comment/39227739

http://stackoverflow.com/a/25155224
answers question: http://stackoverflow.com/q/25154246
type: Answer
score: 0
has body: You can use Joda date/time library. For example: import org.joda.time.{LocalTime, Years, LocalDate, Days} ... Years.yearsBetween(client.birthDate, new LocalDate()).getYears();

http://stackoverflow.com/a/25219828
has comment: http://stackoverflow.com/comment/39282274
score: 5
has comment: http://stackoverflow.com/comment/39282557
upvote count: 5
answers question: http://stackoverflow.com/q/25219770
type: Answer
has body: A difference is that clear resets the limit to the capacity, therefore preparing your buffer for other data to be written (and read by you), whereas rewind doesn't do anything to the limit, therefore your data may be read again.
downvote count: 0

http://stackoverflow.com/comment/39221215
type: QuestionComment
comment on: http://stackoverflow.com/q/25120086
score: 2
has text: Did you try the JBoss AS quickstart in https://github.com/infinispan/infinispan-quickstart/tree/master/jboss-as7 ? It should work, as is, on Wildfly 8. Maybe you want to give it a go to that and then see if it works for you first?
type: Comment

http://stackoverflow.com/a/25106976
has comment: http://stackoverflow.com/comment/39107312
score: 1
has comment: http://stackoverflow.com/comment/39083333
has comment: http://stackoverflow.com/comment/39107477
has comment: http://stackoverflow.com/comment/39084132
has comment: http://stackoverflow.com/comment/39107521
accepted answer of: http://stackoverflow.com/q/25106880
has comment: http://stackoverflow.com/comment/39102156
answers question: http://stackoverflow.com/q/25106880
has comment: http://stackoverflow.com/comment/39107048
has body: I think all you need is just changing these lines: w = new ClientWorker(serverSocket.accept(),f); Thread t = new Thread(w); t.start(); return f.getAbsolutePath(); your problem is after the first client is connect you go out of doInbackground. you must use onProgressPublish() to send the intermidiate result and stay in loop and do not close server. so after you connect to first client and sending him to socket you created, you go out of main loop by return f.getAbsolutePath(); and go out from server. all your code is correct except that for sending out intermediate result use function(onProgressPublish()).
has comment: http://stackoverflow.com/comment/39083892
has comment: http://stackoverflow.com/comment/39082401
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39102244
has comment: http://stackoverflow.com/comment/39107749
has comment: http://stackoverflow.com/comment/39084632
type: Answer
has comment: http://stackoverflow.com/comment/39103512
has comment: http://stackoverflow.com/comment/39083606

http://stackoverflow.com/comment/39113274
type: Comment
score: 2
has text: The listener should be connected to the component of interest, rather than the frame. For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal, Complete, Verifiable Example).
type: QuestionComment
comment on: http://stackoverflow.com/q/25129280

http://stackoverflow.com/comment/39260271
has text: Welcome to StackOverflow! If your program terminates, it must be throwing some exception.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25208461

http://stackoverflow.com/comment/39060198
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25100958
has text: Ok I think I've got it now. I'll update the question to make sure I'm getting it right.

http://stackoverflow.com/a/27562184
answers question: http://stackoverflow.com/q/25206689
downvote count: 0
score: 6
upvote count: 6
has body: Although this is a fairly old thread, I recently encountered this problem and was able to solve it. The reason why maven threw this error is I had, somewhere in my pom.xml file, an absolute path that was not consistent with the directory from which the project was imported into eclipse. So I had two absolute paths (one incorrect, or points to a previous location) that point to resources, i.e. project.build.outputDirectory, in the pom.xml file. The Solution: Locate the faulty absolute path, /home/userA/ProjectB/bin, and replace with a relative, ./bin, path. Update the project in eclipse and you should be fine.
type: Answer
has comment: http://stackoverflow.com/comment/62865857

http://stackoverflow.com/comment/39037808
type: Comment
comment on: http://stackoverflow.com/a/25088285
has text: @bablo I'd like to see the result as well.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39011245
type: AnswerComment
has text: @M.Sharma that would probably be the case. Maybe you really should consider using full path or a wrapper.
comment on: http://stackoverflow.com/a/25074358
type: Comment
score: 0

http://stackoverflow.com/comment/39194459
score: 0
type: Comment
type: QuestionComment
has text: please explain `This works great for zip files, however, it doesn't work well with text files. `
comment on: http://stackoverflow.com/q/25172980

http://stackoverflow.com/q/25170036
tagged with: jax-ws
tagged with: jaxb
type: Question
has body: Where I work we have a large IT shop and have many schemas that have a lot of duplication. I'm not a big fan of maintaining XML in say an XML repository (since we primarily operate in Java). Instead of an XML repository I'm thinking that it would be easier to maintain JAX-B objects. I'm wondering if anyone has this kind of setup where you maintain and share JAX-B objects across your enterprise. So if someone was doing a JAX-WS service that needed to use a common object like for example Address, then they would include that common jar via a build tool that can manage dependencies. Address in this case could be built by someone following some ISO standard or it can be an object that is internal to your enterprise that was built by a team inside your organization. I tried doing various searches but couldn't find anything so I decided to post here to see if I can get any feedback. If anyone could share any pros/cons that are currently doing this I would very much appreciate it!
score: 0
has title: JAX-B Schema Repository
answer count: 1
type: UnansweredQuestion
tagged with: web-services
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
has answer: http://stackoverflow.com/a/25176136

http://stackoverflow.com/comment/112977346
has text: hI @Gary, can you please give us an update about this issue ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25189578
type: AnswerComment

http://stackoverflow.com/q/25095402
type: Question
tagged with: android
tagged with: android-studio
score: 0
linked to: http://stackoverflow.com/q/30045417
answer count: 1
tagged with: java
type: UnansweredQuestion
has body: I am getting this error when I open Android Studio and I have try .gradle deleting and and re-installing it, it is not Working I have also Download Latest Version of Android Studio I have Provided Use Local Repository option trick that is also not working and i have also Downloaded Google Repository Here it is The error: Gradle project sync failed. Basic Functionality (e.g: editing, debugging) will not work properly Error:Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used. Please refer to the user guide chapter on the daemon at http://gradle.org/docs/1.12/userguide/gradle_daemon.html Please read below process output to find out more: ----------------------- Error occurred during initialization of VM Could not reserve enough space for object heap Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
has title: Android Studio error
has answer: http://stackoverflow.com/a/31872681

http://stackoverflow.com/q/25138389
has body: I have a String. String text= //Some String That I know String textToBeColored = //Some Letter User enters at run time How can I change the color of a specific letter that user enters at run time in my String.
possible better answer: http://stackoverflow.com/a/25138542
tagged with: android
has answer: http://stackoverflow.com/a/25138609
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/25138629
linked to: http://stackoverflow.com/q/7221930
has answer: http://stackoverflow.com/a/25138479
has comment: http://stackoverflow.com/comment/39129497
has comment: http://stackoverflow.com/comment/39129467
has comment: http://stackoverflow.com/comment/39129626
has comment: http://stackoverflow.com/comment/39129629
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/39129575
has title: How to change the color of a specific character in a string in java / android?
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39129523
accepted answer: http://stackoverflow.com/a/25138479
type: Question
has comment: http://stackoverflow.com/comment/39129420
has answer: http://stackoverflow.com/a/25138542
downvote count: 0
has comment: http://stackoverflow.com/comment/39129495

http://stackoverflow.com/q/25139369
upvote count: 1
has comment: http://stackoverflow.com/comment/39137379
has comment: http://stackoverflow.com/comment/39133158
type: Question
has title: Mockito equivalent of EasyMock's MockBuilder
tagged with: java
tagged with: easymock
tagged with: mockito
answer count: 1
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/40511728
has comment: http://stackoverflow.com/comment/39133020
has body: EasyMock has a function called createMockBuilder with which someone can specify a partially mocked class. Is it possible to do the same with Mockito? For example in EasyMock some can do the following : classA mockedA = EasyMock. createMockBuilder(A.class). withConstructor(B.class,C.class). withArgs(b,null). addMockedMethod("print"). createMock(); Is it possible to do the same with Mockito?
has comment: http://stackoverflow.com/comment/39137958

http://stackoverflow.com/comment/39247694
type: QuestionComment
has text: show us 185th line,I think error comes from JSONObject.
comment on: http://stackoverflow.com/q/25201868
score: 0
type: Comment

http://stackoverflow.com/q/25226140
has body: I have five colors which saved in an array: int[] colors=new int[]{Color.red,Color.black,Color.blue,Color.gray,Color.green}; Now I have a lot of items, and I want give a random color for each item with two requirements: 1 Color muse be chosen from the array 2 One item can not have the same color with that next to it. int[] colors = getResources().getIntArray(R.array.category_color_array); ArrayList&lt;Integer&gt; cs = new ArrayList&lt;Integer&gt;(); for (int k = 0; k &lt; items.size(); k++) { if (k &lt;= colors.length - 1) { cs.add(colors[k]); } else { cs.add(colors[k - colors.length]); } } Collections.shuffle(cs); for (int i = 0; i &lt; items.size(); i++) { items.get(i).color = cs.get(i); } cs.clear(); But I always get the repeated colors for two items,how to fix it? BTW, my application will run on Andriod, so performance should be under consideration.
has comment: http://stackoverflow.com/comment/39293169
type: UnansweredQuestion
tagged with: performance
tagged with: java
type: Question
score: 0
tagged with: random
has answer: http://stackoverflow.com/a/25226509
has comment: http://stackoverflow.com/comment/39293365
answer count: 1
has title: Get random and no-repeated object from an array

http://stackoverflow.com/a/25174586
answers question: http://stackoverflow.com/q/25142602
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39230689
has body: That is the final solution i have used(Thanks to camickr) : InputMap im = myTable.getInputMap( JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ); final int CMD_BTN = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); im.put( KeyStroke.getKeyStroke( KeyEvent.VK_A, CMD_BTN ), "selectAll" );
score: 2
upvote count: 2

http://stackoverflow.com/q/25136692
possible better answer: http://stackoverflow.com/a/25139194
has answer: http://stackoverflow.com/a/25139194
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/25139174
has comment: http://stackoverflow.com/comment/39130840
has body: The simple attempt to add choices to my choice box results in a InvocationTargetException. I don't really understand the reason of why this exception is thrown, so a explanation along with a soloution would be great! Here is my code in the FXMLDocumentController Class: public class FXMLDocumentController implements Initializable { @FXML private ChoiceBox&lt;?&gt; pilot; public FXMLDocumentController(){ setMembersList(); } private void setMembersList(){ List&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("Item A"); list.add("Item B"); list.add("Item C"); ObservableList obList = FXCollections.observableList(list); pilot.setItems(obList); } } Here is what I get...: Exception in Application start method java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:367) at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767) Caused by: java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:894) at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56) at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158) at java.lang.Thread.run(Thread.java:745) Using trial and error the exception is definitely thrown in the li…
type: Question
has comment: http://stackoverflow.com/comment/39126536
answer count: 2
has title: InvocationTargetException when trying to assign items to choicebox using javafx
has answer: http://stackoverflow.com/a/25139174

http://stackoverflow.com/comment/39122136
type: AnswerComment
type: Comment
has text: Then please post more code about how your `JPanel` and the tabbed pane is added to your frame.
comment on: http://stackoverflow.com/a/25118939
score: 0

http://stackoverflow.com/comment/39269181
comment on: http://stackoverflow.com/q/25210596
score: 0
type: Comment
type: QuestionComment
has text: @CL. I have turned it into a .sqlite file using the excel provided. I also used SQLite Manager. It was actually quite simple. Thank you.

http://stackoverflow.com/comment/39008892
comment on: http://stackoverflow.com/a/25073540
has text: @ElliottFrisch nope. [Arrays.copyOf()](http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#copyOf(T[],%20int)) creates a shallow copy.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39196973
has text: First and second case are almost same when consider the functionality. If one Thread already acquire the lock other method will wait to get the lock. But third case is little deferent. If one Thread already acquire the lock using shared object `GameHandler.class` that thread can acquire new lock. But other Thread have to wait
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25174354

http://stackoverflow.com/q/25163910
tagged with: ftp
has body: I am trying to use Apache camel to do a simple listen of a directory and upload the files via ftp onto an external location. I am new this. I can move my files from one directory to another with this script. So figured I am half way there. I am now struggling to move it from one directory to the ftp server directory. I have tested the ftp connection with an ftp client and it all works ok. When I run it it moves the file into a directory called ".camel" but does not upload it? Its not outputting any error? I am not sure output or view the logs to the terminal so I can view what went wrong? Do I need to include some kind of .process()? Main.class public class Main { public static void main(String[] args) throws Exception{ CamelContext camelContext = new DefaultCamelContext(); camelContext.addRoutes(new MoveFileRoute()); camelContext.start(); Thread.sleep(10000); camelContext.stop(); } } MoveFileToRoute public class MoveFileRoute extends RouteBuilder { @Override public void configure() throws Exception{ from("file://C:\\test") .choice() .when(simple("${in.header.CamelFileName} contains '*.xlsx'")) .to("ftp://rob@10.171.16.100/home/rob/test/?password=rob") .otherwise() .to("log://org.apache.camel.howto?showAll=true&amp;level=DEBUG"); } }
has title: Apache camel - simple scan directory and ftp upload
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25165381
accepted answer: http://stackoverflow.com/a/25165381
score: 1
tagged with: java
tagged with: apache-camel
type: Question
upvote count: 2
tagged with: message-queue
answer count: 1
favorite count: 0

http://stackoverflow.com/q/25195350
downvote count: 0
tagged with: garbage-collection
type: Question
has answer: http://stackoverflow.com/a/25196090
accepted answer: http://stackoverflow.com/a/25196090
score: 1
tagged with: java
has body: Ok, I know there was a few similar questions, but I couldn't find nowhere pure facts about GC in android. When system calls GC? What GC in android counts as not needed? Why GC skips bitmaps? Sample of code that shows how we can bypass GC? (Object = null ?) What does GC do with not needed object? Other important facts...
upvote count: 1
answer count: 1
favorite count: 0
has title: Android Garbage Collector behavior
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/comment/39120875
type: Comment
type: QuestionComment
has text: writing the comparison that way around is non-intuitive - it would be more usual to write `return index < array.length ? ...`
score: 0
comment on: http://stackoverflow.com/q/25133605

http://stackoverflow.com/a/25095378
answers question: http://stackoverflow.com/q/25094866
has comment: http://stackoverflow.com/comment/39074309
score: 0
has comment: http://stackoverflow.com/comment/39184271
has comment: http://stackoverflow.com/comment/39049713
type: Answer
has body: Summary of a all the comments: Don't rely on the string version a Paths. Use the paths directly. To differentiate dirs form files use Files.isDirectory on the path relative dirs have relative childs i.e. you should be able to write code to handle both cases. This is whats nio is for. Answer to the modified question: The filename of a path p: p.getFileName(). The string representation of the filename of p: p.getFileName().toString(). This string has no slashes. e.g. fs.getPath( "abc", "def" ).getFileName().toString() -> "def"
has comment: http://stackoverflow.com/comment/39055852

http://stackoverflow.com/comment/39174613
score: 0
type: Comment
has text: in build.gradle i dont have a defualtConfig i do have sourceSets though?
type: AnswerComment
comment on: http://stackoverflow.com/a/25162009

http://stackoverflow.com/a/25158303
has comment: http://stackoverflow.com/comment/39203453
score: 1
answers question: http://stackoverflow.com/q/25135285
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: For the MERGE statement, you need to use Statement.executeUpdate() instead of executeQuery()
has comment: http://stackoverflow.com/comment/39203704
type: Answer
accepted answer of: http://stackoverflow.com/q/25135285

http://stackoverflow.com/comment/39270551
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25213805
has text: The following logcat messages is when the line player.cueVideo("nCgQDjiotG0"); inside playVideoAtSelection() is uncommented. And yes, how could I implement the line this.player=player; with my code? I understand it references the current object but why am I getting an error when I try to use it?
type: Comment

http://stackoverflow.com/comment/39110096
comment on: http://stackoverflow.com/q/25126953
score: 0
has text: While loop *is* needed (unless you can guarantee that `in.read(buffer)` will read all data in one go, but then you must be using a special-purpose `InputStream` implementation that I don't know of...).
type: Comment
type: QuestionComment

http://stackoverflow.com/a/52694481
has body: If your project is spring-boot, add this: org.springframework.boot spring-boot-starter-web
score: 11
upvote count: 12
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/25220468
has comment: http://stackoverflow.com/comment/119452776
has comment: http://stackoverflow.com/comment/114856177

http://stackoverflow.com/comment/39294312
type: QuestionComment
comment on: http://stackoverflow.com/q/25108562
score: 0
has text: Thanks for getting back. I am overriding the sourceSet for the java plugin. Could this be a reason? I will be editing the question with the gradle script.
type: Comment

http://stackoverflow.com/comment/39020043
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25079699
has text: Where are you getting the `NullPointerException`? Where the stars are?

http://stackoverflow.com/q/25137490
score: 7
tagged with: java
has body: Some utility classes (think java.lang.Math) declares only a private constructor in order to prevent instantiation of the class. Is there any particular reason for why such classes are not implemented in terms of a 0-instance enum? It seems to me like enums is a more direct way of controlling instantiation than access modifiers on constructors. It also prevents the class itself from creating instances which both prevent the programmer from shooting himself in the foot and convey a guarantee outwards of no instances. Joshua Bloch advocates the use of enums for singletons. Shouldn't the same benefits apply to 0-instance utility classes? My question: What are the pros/cons of 0-instance enums vs private constructors. (I personally see no drawbacks of using an enum, though private constructors seems to be the more prevalent approach.) (I know java.lang.Math predates enum. I'm talking 1.5+ code here.)
has answer: http://stackoverflow.com/a/25138196
type: Question
has comment: http://stackoverflow.com/comment/39128233
answer count: 3
has comment: http://stackoverflow.com/comment/39128430
has comment: http://stackoverflow.com/comment/39128545
has comment: http://stackoverflow.com/comment/39127711
favorite count: 0
has comment: http://stackoverflow.com/comment/39127957
has answer: http://stackoverflow.com/a/25138125
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9618583
downvote count: 2
has answer: http://stackoverflow.com/a/25137699
has title: Zero instance enum vs private constructors for preventing instantiation
tagged with: enums
upvote count: 9

http://stackoverflow.com/q/25090486
has answer: http://stackoverflow.com/a/25094355
has body: I have read and reread everything here on SO and many other sites but can't seem to figure out why my updated objects are not updating. The basic overview of what I'm doing: Service layer asks DAO for some People Return an ArrayList of People from the DB (DAO / @Repository) Service Layer manipulates object and adds them to a new arraylist Service Layers passes new list back to DAO to update NOTHING GETS Updated If I throw a log message in my object has the new values, the children are correctly hydrated. I get no errors in the code is just doesn't commit my changes. Here is some code: PersonDAO annotated as @Repository public void updatePeople(List&lt;Person&gt; people) { log.info("Updating " + people.size() + " people"); try { Transaction tx = getCurrentSession().beginTransaction(); for (Person person : people){ getCurrentSession().saveOrUpdate(person); } getCurrentSession().flush(); tx.commit(); getCurrentSession().close(); } catch (Exception e){ log.error("Exception Updating all people " + e.toString()); e.printStackTrace(); } } public List&lt;Person&gt; getAssociatesByStoreId(String storeId) { try { List&lt;Person&gt; usersInStore = (List&lt;Person&gt;) getCurrentSession() .createCriteria(Person.class).createCriteria("store") .add(Restrictions.eq("storeId", storeId)).list(); return usersInStore; } catch (Exception e) { log.error("exception in getAssociatesByStoreId ", e); } return null; } PersonService annotated as @Service - relevant method /* I put the people into a map to do some other logic on them */ for (Person person : personDAO.getAllPeople()){ personMap.put(person.getEmployeeId() + "-" + person.getStore().getStoreId(), person); } /* I iterate a list creating new Person objects (based on some random stuff), including saving any children entities (managementcodes and stores) that need to be created After I have created a new Person I attempt to find it in the map from above. If I find it pull it out of the map and put it into an array list that is eventua…
has comment: http://stackoverflow.com/comment/39056424
has answer: http://stackoverflow.com/a/25091275
answer count: 3
tagged with: jpa
downvote count: 0
has title: java/Spring Hibernate not updating entities
tagged with: persistence
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39056413
has comment: http://stackoverflow.com/comment/39057224
tagged with: spring
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25093587

http://stackoverflow.com/comment/39011862
type: QuestionComment
has text: It could be on another submodule (if there are no dependencies) or to another project if you still have the dependencies.
type: Comment
comment on: http://stackoverflow.com/q/25075154
score: 0

http://stackoverflow.com/a/25128629
answers question: http://stackoverflow.com/q/25128542
accepted answer of: http://stackoverflow.com/q/25128542
has comment: http://stackoverflow.com/comment/39112777
has body: Use a Positive Lookahead for capturing to get the overlapping matches. (?=(:\\w+:)) Note: You can access your match result by refering to capturing group #1 ( Live Demo )
has comment: http://stackoverflow.com/comment/39112372
upvote count: 5
has comment: http://stackoverflow.com/comment/39112287
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39177021
score: 0
has text: See updated answer. You're right, the method doesn't need to be @FXML; I moved it to `initialize(...)` instead. I left it as `setOnMouseClicked(...)` simply because the question specified **upon click of a button**. I assumed that button here meant an FXML button.
type: Comment
comment on: http://stackoverflow.com/a/25162616
type: AnswerComment

http://stackoverflow.com/a/28214229
score: 4
answers question: http://stackoverflow.com/q/25221701
type: Answer
upvote count: 4
downvote count: 0
has body: I think so android driver is belongs to java-client library so giving an error that android driver cannot resolve as type. please add java-client library and then import android driver that can solve problem. this link can help you with java-client :-http://mvnrepository.com/artifact/io.appium/java-client and then user import statement in eclipse :- import io.appium.java_client.android.AndroidDriver; Try this it may help you

http://stackoverflow.com/q/25216687
tagged with: classloader
upvote count: 2
has body: I'm having this weird issue where a class from some transitive dependency keeps showing up at runtime, shadowing a newer version of the class from the (correct) first level dependency, even though I thought I made sure that I excluded the older version from all other dependencies I declare (this is in a Maven/IntelliJ setup) More specifically, at runtime the app fails with a NoClassDefFoundError, since during class loading a wrong version of the owning class is loaded, which has a field of a type that does not exist in newer versions of the library that class is defined in. To illustrate: // lib.jar:wrong-version class Owner { private SomeType f; } // lib.jar:new-version class Owner { private OtherType f; } At runtime, the class loader finds a reference to the symbol Owner and attempts to load the version that has SomeType, which in return does not exist anymore. This is even though I excluded wrong-version where ever I could spot it. I also ran mvn dependency:tree to see if the old version is still being pulled in somewhere, but it's not! In order to further debug this, I was wondering if there is a way to find out where a class loader was reading a specific class from, i.e. which file? Is that possible? Or even better, build a list of origins where a certain symbol is defined, in case it's defined more than once? Sorry if this is vague, but the problem is rather nebulous.
tagged with: maven
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25217016
type: Question
possible better answer: http://stackoverflow.com/a/25216782
answer count: 2
has answer: http://stackoverflow.com/a/25216782
has title: How to find out where a class originates from at runtime?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25217016

http://stackoverflow.com/a/30664421
answers question: http://stackoverflow.com/q/25227098
has body: package com.example.tests; public class RussianDollPrimeNumber { public static void main(String[] args) { int x= 373; int k; int n =x; for ( k= String.valueOf(x).length()-1;k&gt;0;k--){ System.out.println(n); if (isPrime(n)){ String m=String.valueOf(n).substring(0, k); n=Integer.parseInt(m); continue; }else { break; } } if( k==0){ System.out.println("Number is Russianl Doll Number "+x); }else { System.out.println("Number is not Russianl Doll Number "+x); } } private static boolean isPrime(int x) { boolean check=true; for (int i=2;i&lt;x/2;i++){ if( (x%i)==0){ check=false; } } return check; } }
score: 0
type: Answer

http://stackoverflow.com/comment/51976145
has text: Could you please explain why you want to do this with JDBC and not with JPA?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25213935
score: 0

http://stackoverflow.com/q/25185747
accepted answer: http://stackoverflow.com/a/25186226
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/39217546
upvote count: 2
has comment: http://stackoverflow.com/comment/39217675
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25186226
has comment: http://stackoverflow.com/comment/39217846
type: Question
tagged with: jpa
has comment: http://stackoverflow.com/comment/39218120
has comment: http://stackoverflow.com/comment/39218229
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39218188
has title: Don't want to persist one-to-one entity
favorite count: 0
has body: Suppose I have two class Employee and Department. In Employee I have written: @OneToOne( fetch = FetchType.EAGER, cascade = {CascadeType.ALL}) @JoinColumn(name="deptID") private Department department; And Department class having Id and Name. (Just like Master of department). I have a view where I am selecting Department using select/combo box. When I submit form and pass Employee object to persist it gives detached entity passed to persist. I want to save only employee entity with foreign key value, whereas Department is already having records.
has comment: http://stackoverflow.com/comment/39218342

http://stackoverflow.com/comment/39206378
type: Comment
comment on: http://stackoverflow.com/a/25179316
type: AnswerComment
has text: I use the method that you mentioned to have all dependencies with my jar.But the problem still exists
score: 0

http://stackoverflow.com/a/26740696
has body: You are already setup for caching. must-revalidate means once the cache expires (3600 seconds) do not use it anymore so your response headers, i think, are correct for what you want.
has comment: http://stackoverflow.com/comment/42075330
score: 0
answers question: http://stackoverflow.com/q/25113154
type: Answer

http://stackoverflow.com/comment/39014110
comment on: http://stackoverflow.com/a/25074992
type: Comment
type: AnswerComment
has text: I have already overriden the CreateActionBarAdvisor method in ApplicationWorkbenchwindowAdvisor.code belowpublic ActionBarAdvisor createActionBarAdvisor( IActionBarConfigurer configurer) { return new ApplicationActionBarAdvisor(configurer); }
score: 0

http://stackoverflow.com/comment/39056193
has text: You're most welcome, you're gonna accept my answer then :), actually the difference is the first statement defines two variable in the same time, and the other way is to define one variable a time. You use such coding when you have many variable from the same type (if you want to define 5 int, its easier to write 'int var1 var2 var3 var5 var5;' than 'int var1; int var2;...;int var5;'), just keep coding and good luck :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25093652
type: Comment

http://stackoverflow.com/q/25176781
has title: Spring Roo-generated Managed Bean Aspect misses import statement when using @ElementCollection
type: Question
has comment: http://stackoverflow.com/comment/39202460
tagged with: aspectj
answer count: 1
has body: When generating Managed Beans with Spring Roo, Roo forgets to add import statements for Collections like Set or Map. See the following example, a Person with one last name and multiple first names: @RooJavaBean @RooToString @RooJpaActiveRecord public class Person { private String lastName; @ElementCollection private Set&lt;String&gt; firstNames; } When calling web jsf all --package test.jsf in Roo Shell, PersonBean_Roo_ManagedBean.aj is generated, which contains the following code: public HtmlPanelGrid PersonBean.populateCreatePanel() { ... firstNamesCreateInput.setValueExpression("value", expressionFactory.createValueExpression(elContext, "#{personBean.person.firstNames}", Set.class)); ... } As you can see, Setis used (of course). But PersonBean_Roo_ManagedBean is missing the import statement import java.util.Set. The import can easily be added hitting Strg+Shift+O in Eclipse, but Roo is re-creating the file all the time, so this is really annoying. So: Is this a bug? Can you think of any way to circumvent this problem, maybe telling Eclipse to add the missing import statements automatically when the file is changed? Note: the same problem also occurs when you have a @Embedded user type in Person.
score: 0
tagged with: spring-roo
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/39202165
has comment: http://stackoverflow.com/comment/39202108
has answer: http://stackoverflow.com/a/25200773
tagged with: java
tagged with: eclipse

http://stackoverflow.com/q/25169175
has comment: http://stackoverflow.com/comment/39187334
tagged with: inheritance
tagged with: static-methods
has answer: http://stackoverflow.com/a/25169394
accepted answer: http://stackoverflow.com/a/25182306
score: 75
favorite count: 0
linked to: http://stackoverflow.com/q/21817
has comment: http://stackoverflow.com/comment/39210523
has comment: http://stackoverflow.com/comment/39190603
answer count: 5
tagged with: interface
has comment: http://stackoverflow.com/comment/39187310
has comment: http://stackoverflow.com/comment/39190425
has comment: http://stackoverflow.com/comment/39187190
has comment: http://stackoverflow.com/comment/81791988
has comment: http://stackoverflow.com/comment/39187308
tagged with: java-8
linked to: http://stackoverflow.com/q/512877
has comment: http://stackoverflow.com/comment/39187153
type: AnsweredQuestion
has body: I understand that in Java static methods are inherited just like instance methods, with the difference that when they are redeclared, the parent implementations are hidden rather than overridden. Fine, this makes sense. However, the Java tutorial notes that Static methods in interfaces are never inherited. Why? What's the difference between regular and interface static methods? Let me clarify what I mean when I say static methods can be inherited: class Animal { public static void identify() { System.out.println("This is an animal"); } } class Cat extends Animal {} public static void main(String[] args) { Animal.identify(); Cat.identify(); // This compiles, even though it is not redefined in Cat. } However, interface Animal { public static void identify() { System.out.println("This is an animal"); } } class Cat implements Animal {} public static void main(String[] args) { Animal.identify(); Cat.identify(); // This does not compile, because interface static methods do not inherit. (Why?) }
has title: Why are class static methods inherited but not interface static methods?
tagged with: java
has answer: http://stackoverflow.com/a/25182306
upvote count: 76
has answer: http://stackoverflow.com/a/25169781
has comment: http://stackoverflow.com/comment/39191240
has comment: http://stackoverflow.com/comment/39191567
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/62748883
has answer: http://stackoverflow.com/a/53242348
has comment: http://stackoverflow.com/comment/39187370
possible better answer: http://stackoverflow.com/a/25169781
has comment: http://stackoverflow.com/comment/39187240

http://stackoverflow.com/q/25197433
downvote count: 0
has answer: http://stackoverflow.com/a/25198599
favorite count: 0
has answer: http://stackoverflow.com/a/25197668
tagged with: rest
type: UnansweredQuestion
answer count: 4
tagged with: spring-mvc
score: 3
has title: Separation of Spring MVC Restful application & Rest web service
has body: I have read some article regarding Spring MVC &amp; Rest web services. But I have one confusion to implement web application using spring mvc. My requirement is to create a spring based web application and creating Rest web services that will be used by device. eg. I want to get list of objects. This list will be displayed on a jsp page (for web app) List of objects will be return as json (for remote device) I am following this approach to achieve this. //For remote device - return json data public List getObjectsInJson() { return myService.getAllSomeObjects(); } And // Method for getting the view data public ModelAndView getObjectsInModelNAndView() { // Return ModelAndView } Please suggest this approach is right or should I create separate controller for both purpose ? or any other approach ?
upvote count: 3
has answer: http://stackoverflow.com/a/25197672
tagged with: java
has answer: http://stackoverflow.com/a/25198022
type: Question

http://stackoverflow.com/a/25079621
has body: You need to convert the MouseEvent XY coordinates into chart coordinates using java2DToValue(). ChartPanel mouse handling code Rectangle2D dataArea = chartPanel.getChartRenderingInfo().getPlotInfo().getDataArea(); XYPlot xyPlot = chartPanel.getChart().getXYPlot(); // event is the MouseEvent from one of the MouseEvent functions // store the location and use it later to place the annotation java.awt.Point clickLocation = new Point(event.getX(), event.getY()); Annotation code double x = xyPlot.getDomainAxis().java2DToValue(clickLocation.getX(), dataArea, xyPlot.getDomainAxisEdge()); double y = xyPlot.getRangeAxis().java2DToValue(clickLocation.getY(), dataArea, xyPlot.getRangeAxisEdge()); String text = Double.toString(x) + " " + Double.toString(y); XYTextAnnotation annotation = new XYTextAnnotation(text, x, y); plot.addAnnotation(annotation);
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25079071
answers question: http://stackoverflow.com/q/25079071
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/a/25106275
has comment: http://stackoverflow.com/comment/39071327
score: 2
answers question: http://stackoverflow.com/q/25106193
has comment: http://stackoverflow.com/comment/39071590
downvote count: 0
has body: The elements returned by a PriorityQueue's iterator are not ordered using the queue's order. The javadoc says: The Iterator provided in method iterator() is not guaranteed to traverse the elements of the priority queue in any particular order. The only guarantee is that the head of the queue, returned by peek() or poll(), is the smallest of all the elements in the queue. If you want a sorted collection, use a TreeSet or a List that you sort.
type: Answer
has comment: http://stackoverflow.com/comment/39070412
upvote count: 2

http://stackoverflow.com/q/25205685
favorite count: 0
tagged with: maven
upvote count: 1
has answer: http://stackoverflow.com/a/25205837
accepted answer: http://stackoverflow.com/a/25205837
has answer: http://stackoverflow.com/a/25206074
has title: Running an application automatically every day
has comment: http://stackoverflow.com/comment/39255209
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/15395479
score: 1
tagged with: java
type: Question
answer count: 2
has body: I have an application that tests web services. And I want to run this application every day at 6 pm. I wonder if it is possible to do this automatically? *For information: this application is developed with Java, JUnit parameterized tests, maven..., OS: Windows 7 *
possible better answer: http://stackoverflow.com/a/25206074
tagged with: parameterized
downvote count: 0
has comment: http://stackoverflow.com/comment/39255003

http://stackoverflow.com/comment/39222102
type: Comment
type: QuestionComment
has text: @kolossus I wish I could, but I don't have the log now, but I really want to know why this happened, as I believe stop and start the server should have the same effect as the restart service.
comment on: http://stackoverflow.com/q/25184894
score: 0

http://stackoverflow.com/a/25122562
answers question: http://stackoverflow.com/q/25109003
has body: JMeterContext is your friend How about JMeterContextService.getContext().getCurrentSampler().getProperty("property.name.here"); See here and here for example usage of JMeter API.
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/78198694
downvote count: 0

performance
tags question: http://stackoverflow.com/q/25145494
tags question: http://stackoverflow.com/q/25165981
tags question: http://stackoverflow.com/q/25131530
tags question: http://stackoverflow.com/q/25216758
tags question: http://stackoverflow.com/q/25222087
tags question: http://stackoverflow.com/q/25108966
tags question: http://stackoverflow.com/q/25073124
tags question: http://stackoverflow.com/q/25220945
tags question: http://stackoverflow.com/q/25230117
tags question: http://stackoverflow.com/q/25212272
tag name: performance
tags question: http://stackoverflow.com/q/25137856
tags question: http://stackoverflow.com/q/25078828
type: Tag
tags question: http://stackoverflow.com/q/25226140
tags question: http://stackoverflow.com/q/25211231
tags question: http://stackoverflow.com/q/25217332
tags question: http://stackoverflow.com/q/25205750
tags question: http://stackoverflow.com/q/25210475
tags question: http://stackoverflow.com/q/25194100
tags question: http://stackoverflow.com/q/25136573
tags question: http://stackoverflow.com/q/25114261
tags question: http://stackoverflow.com/q/25100239

http://stackoverflow.com/a/25118821
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25118755
upvote count: 1
has body: The threads will stay there (waiting for other tasks to run), but it won't hold on to all the data that you put there. When the thread in the threadpool has executed the task, it will take a next task and won't reference the existing task anymore. So your fears are baseless, unless you explicitly keep references to the tasks.
type: Answer

http://stackoverflow.com/comment/39179389
comment on: http://stackoverflow.com/q/25165047
score: 0
has text: oh..like setting an attribute via session and then checking it on the home page?
type: Comment
type: QuestionComment

executorservice
type: Tag
tag name: executorservice
tags question: http://stackoverflow.com/q/25094912
tags question: http://stackoverflow.com/q/25197160
tags question: http://stackoverflow.com/q/25118755
tags question: http://stackoverflow.com/q/25195503

http://stackoverflow.com/comment/39178026
type: QuestionComment
type: Comment
has text: Sure. I would like to do that, if there is a possibility of me achieving the end goal. Do you any good source where I can read about this?
comment on: http://stackoverflow.com/q/25129620
score: 0

http://stackoverflow.com/a/25182019
type: Answer
has comment: http://stackoverflow.com/comment/54136101
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/54137730
downvote count: 0
has body: How about the following? <constructor-arg value="org.springframework.jms.core.JmsTemplate"/> You probably need to inject the template and configure the mock (given(...).willReturn) in your test.
answers question: http://stackoverflow.com/q/25178454

http://stackoverflow.com/comment/112099690
comment on: http://stackoverflow.com/a/25169891
score: 0
type: AnswerComment
type: Comment
has text: @BrandonYarbrough Google SDK provide lot of functionality out of the box. Do any of the signed URL or resumable URL work with the existing SDKs? Or do we need to use these URLs in our own HTTP requests to do the remaining stuff? (Like chunking and resuming etc)

http://stackoverflow.com/comment/39293580
type: QuestionComment
has text: where would I find it?
comment on: http://stackoverflow.com/q/25226308
score: 0
type: Comment

http://stackoverflow.com/a/25173864
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25172233
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39228660
has body: Your XML does not match your code comments. The call to xsr.nextTag() moves you to the &lt;ResDoc&gt; node, which has no attributes and returns a count of 0. public class Main { public static void main(String args[]) { try{ String raw = "&lt;?xml version='1.0' encoding='iso-8859-1'?&gt;&lt;ResDoc&gt;&lt;resume canonversion='2' dateversion='2' present='735453' xml:space='preserve'&gt;Jack - A Web ResumeHello,My name is Jack.&lt;statements&gt;&lt;personal&gt;This website is all about my career, work experience and skill set. Unlike a traditional resume (available here in Word and PDF) my Web Resume is interactive. Feel free to run a query, a great way to see if I would be a good fit for you and your company, or click on any of the blue links for more details and work samples.Just like my career and capabilities, this site is always growing as I add more examples of my work, and even some blog entries or documentation/ tutorials. You will see this site grow as I do!&lt;/personal&gt;&lt;/statements&gt;I want to thank you for stopping by!Resume&lt;experience&gt;Current employer\t2013\tCurrent\t&lt;title&gt;Systems Administrator&lt;/title&gt;\t&lt;description&gt;Windows &amp;amp; Altiris administration, SEP &amp;amp; Credant Encryption Management and Policies,EMR Software Dev company\t2012\t2013\tHelpesk Technician II\tOffice 365,Data-Center migration, Corporate image creation\\ configuration, Domain administrationCommunications\t2011\t2012\tSr. Helpesk Technician\tPrimarily managed IT support issues, requests and tickets from local station &amp;amp; east coast.&lt;/description&gt;&lt;job id='1'&gt;&lt;employer&gt;University\t2008&lt;/employer&gt;\t2011\t&lt;title&gt;Desktop Technician/ Analyst\tDesktop Support&lt;/title&gt;, &lt;description&gt;managing tickets &amp;amp; walk-ins. I.T. support for professors &amp;amp; faculty..&lt;/description&gt;&lt;/job&gt;&lt;job id='2'&gt;&lt;employer&gt;Emergence Enterprises LLC&lt;/employer&gt;\t2006\t&lt;description&gt;2008\tManagi…
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25172233

http://stackoverflow.com/a/25211357
has comment: http://stackoverflow.com/comment/39679282
has comment: http://stackoverflow.com/comment/40109709
has body: I used Orika, Smooks and dozer. Orika: is very intuitive, but the development is programmatic. Dozer: uses the xml mappings, but is able to avoid them if the source and the target are equal. Smooks: i do not recommend it, the mapping files are too complex.
type: Answer
answers question: http://stackoverflow.com/q/25147739
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25147739
has comment: http://stackoverflow.com/comment/39700846
has comment: http://stackoverflow.com/comment/39528994
has comment: http://stackoverflow.com/comment/39533743
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39098039
type: Comment
comment on: http://stackoverflow.com/a/25121274
score: 0
type: AnswerComment
has text: If you want any [system] locale, then use `Resources.getSystem().getConfiguration().locale` instead of `Locale.US` (You will need to import `android.content.res.Resources`). Note: Don't use `Locale.getDefault()` as this can be overwritten by an Android app.

http://stackoverflow.com/q/25136932
tagged with: manifest
has body: I want to store some metadata for one external file in my project, which won't be packed as a .jar. Is there a way to do so? My guess is that I have to create a Manifest object and then write it out. Can anybody give me some hints?
possible better answer: http://stackoverflow.com/a/25137142
has answer: http://stackoverflow.com/a/25137142
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25156125
type: AnsweredQuestion
has title: Create a manifest file without a .jar file
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25156125
has comment: http://stackoverflow.com/comment/39162319
has comment: http://stackoverflow.com/comment/39126846

http://stackoverflow.com/q/25165567
tagged with: teamcity
tagged with: build
score: 3
tagged with: java
type: Question
has body: I can't find anywhere if TeamCity is able to deploy build artifacts to nexus, when job has finished (like Jenkins does), and not by running "mvn deploy". Is there a way to achieve this? Maybe as a build feature.
tagged with: teamcity-8.0
favorite count: 0
upvote count: 3
has title: teamcity - deploy artifacts to nexus without mvn deploy
has comment: http://stackoverflow.com/comment/39202031
has comment: http://stackoverflow.com/comment/52510599
downvote count: 0
answer count: 0
tagged with: nexus
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39197707

http://stackoverflow.com/q/25093340
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/39046662
duplicate of: http://stackoverflow.com/q/2842982
has comment: http://stackoverflow.com/comment/39047804
answer count: 0
has comment: http://stackoverflow.com/comment/39049069
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39046403
has comment: http://stackoverflow.com/comment/39046716
upvote count: 5
tagged with: java
has body: I want to monitor the strings in Java String constant pool. But I don't know a method to resolve the problem. Thanks!
has comment: http://stackoverflow.com/comment/39046198
type: Question
score: 5
has title: How to output all the contents in Java constant pool (area of String.intern())?
downvote count: 0
has comment: http://stackoverflow.com/comment/39046267
linked to: http://stackoverflow.com/q/2842982

http://stackoverflow.com/comment/39210863
type: AnswerComment
has text: Could you show the code you used? The code above should work. Just verified that it gives the expected results here.
type: Comment
comment on: http://stackoverflow.com/a/25182027
score: 0

http://stackoverflow.com/comment/39276225
has text: I'm just curious: can original `createSomething()` ever return something else than `null` without casting? AFAIK you don't have any means to create or get an exsiting `T` object.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25216255
score: 0

http://stackoverflow.com/q/25099906
has title: Figuring out if a file exists with a different extension
answer count: 1
has comment: http://stackoverflow.com/comment/39058240
favorite count: 0
has comment: http://stackoverflow.com/comment/39058278
has body: I have a lot of files. So, I created a method called ifHasEverExisted. It returns a type string for "COMPLETE: True", "COMPLETE: False", or an "ERROR: [ERROR]". (I know I could've used a boolean, but I needed an error String.) Anyway, I change the default extension to the files a lot, and I wanted to know if there is a way to check if the file exists with a different extension. Can anyone help me? All I have is this, LOL. String[] allPrevExts = {null, "SilvrGaming"}; public static String ifHasEverExsisted(String filePath, String currentExt) { } So... Recap. If the extension of an existing file is different, but the filepath is the same, return "COMPLETE: True." If it throws some exception, return "ERROR: [ERROR]", and if it does not exist, return "COMPLETE: False". Thanks.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25099975
tagged with: file-extension
tagged with: java
downvote count: 3
tagged with: file
has comment: http://stackoverflow.com/comment/39058236
type: Question
score: -2
upvote count: 1

http://stackoverflow.com/comment/39040039
has text: Do you have a *heartbeat interval* set? Do you have re-connecting handling in place?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25089883

http://stackoverflow.com/a/25162166
type: Answer
has body: That depends a bit on what you want to do with the HTML afterwards. If you just want to read it, then you can add a newline after every HTML element that ends with /&gt; (i.e. content.replace("/&gt;", "/&gt;\n") plus you can do a regexp search for &lt;/[^&gt;]+&gt; and put a newline after each match. That should break the HTML quite nicely. Note: Usually, regexp is not the right tool to process HTML. But in this special case, it's enough. Another option is to add JTidy as a dependency to your code. It has code formatters that beautify HTML.
answers question: http://stackoverflow.com/q/25162041
score: 0

http://stackoverflow.com/q/25129084
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25129097
has body: I have this regex and my output seems to be matching each single space but the capturing group is only alpha chars. I must be missing something. String regexstring = new String("1234567 Mike Peloso "); Pattern pattern = Pattern.compile("[A-Za-z]*"); Matcher matcher = pattern.matcher(regexstring); while(matcher.find()) { System.out.println(Integer.toString(matcher.start())); String someNumberStr = matcher.group(); System.out.println(someNumberStr); }
tagged with: regex
has title: Java Regex group matches spaces
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25129097
has comment: http://stackoverflow.com/comment/39113151

http://stackoverflow.com/comment/39019926
type: Comment
has text: Thanks for your advice Fabian, I could solve my issue. I changed the double array to : double lat1 = coord.getX(); double lat = Math.toRadians(lat1); double lon1 = coord.getY(); double lon = Math.toRadians(lon1); You have been most useful. - Somayeh
type: AnswerComment
comment on: http://stackoverflow.com/a/25079038
score: 0

http://stackoverflow.com/a/25081322
upvote count: 1
has body: First, if you have control over the database MongoDB has some pretty good sorting algorithms for location based stuff. Depending on if the addresses you are getting are the same or different you can also insert the lat/long into the db with the address so that you don't have to look it up each time. That being said, you can use the Google Geocoding API to convert an address into a lat and long. You can find a decent example here using PHP using cURL: http://www.techrecite.com/get-latitude-longitude-of-an-address-using-google-geocoding-api/ Combine that with using java.net.Connection, a great explanation here: Using java.net.URLConnection to fire and handle HTTP requests And you are on your way.
answers question: http://stackoverflow.com/q/25081064
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39112185
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25128108
has text: @DavidConrad True. I just assumed that OP's `theme` folder contained the necessary materials for a complete `jar`, because it didn't sound like the issue was with gathering the appropriate files.

http://stackoverflow.com/a/25078003
answers question: http://stackoverflow.com/q/25077543
has comment: http://stackoverflow.com/comment/39025243
has body: Your best bet is a tree map: http://docs.oracle.com/javase/7/docs/api/java/util/TreeMap.html O(log n) pretty much for all operations.. you can get your keys back sorted. There is also a MinMaxPriorityQueue from Google (guava) http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/MinMaxPriorityQueue.html the remove is O(n) though, all other operations are O(log n)
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/39018139
score: 1
has comment: http://stackoverflow.com/comment/39140694
downvote count: 1

http://stackoverflow.com/comment/39262833
type: Comment
has text: You need to use [Eclipse's API](http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fui%2Fconsole%2Factions%2FClearOutputAction.html) for that.
comment on: http://stackoverflow.com/q/25209808
score: 0
type: QuestionComment

http://stackoverflow.com/q/25089874
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25090700
favorite count: 0
has comment: http://stackoverflow.com/comment/39040280
upvote count: 2
tagged with: jdbc
has body: I am using Eclipse and I am trying to connect to my websites mysql database thru Host Gator. This is the code I have so far in Eclipse in my Main.java file. import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; //import java.sql.SQLException; //import com.mysql.jdbc.Connection; public class Main { public static void main(String[] args) throws Exception { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://19x.xxx.xxx.xxx:3306/kwinrow_storage","kwinrow_admin","xxxxxxx"); PreparedStatement statement = con.prepareStatement("SELECT * FROM post_data WHERE type= 'mixtape' ORDER BY id DESC LIMIT 15"); ResultSet result = statement.executeQuery(); while(result.next()) { System.out.println(result.getString(1) + " " + result.getString(2)); } } } This is the error from the console: Exception in thread "main" java.sql.SQLException: Access denied for user 'kwinrow_admin'@'c-69-247-142-223.hsd1.tn.comcast.net' (using password: YES) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1094) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:926) at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1748) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1288) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2508) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2541) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2323) at com.mysql.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:832) at com.mysql.jdbc.JDBC4Connection.&lt;init&gt;(JDBC4Connection.java:46) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.n…
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25090700
tagged with: mysql
tagged with: eclipse
type: Question
has title: error when connecting to remote MySQL (host gator) server using JDBC
has comment: http://stackoverflow.com/comment/39041224

http://stackoverflow.com/comment/39089966
comment on: http://stackoverflow.com/a/25117050
type: AnswerComment
score: 0
type: Comment
has text: OMG. You know what... That actually just worked... 0_0

http://stackoverflow.com/q/25185122
has title: Why is spring creating new jaxb marshaller when I already defined one
type: UnansweredQuestion
tagged with: spring
score: 2
answer count: 0
upvote count: 2
tagged with: spring-ws
tagged with: java
type: Question
has body: In my spring context I have defined marshaller: <sws:annotation-driven marshaller="marshaller" unmarshaller="marshaller" /> ... ... ... Why is spring creating new one when receive request ? com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91) ~[?:1.7.0_25] at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:451) ~[?:1.7.0_25] at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:283) ~[?:1.7.0_25] at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:126) ~[?:1.7.0_25] at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1148) ~[?:1.7.0_25] at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:130) ~[?:1.7.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_25] at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_25] at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:248) ~[?:1.7.0_25] at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:235) ~[?:1.7.0_25] at javax.xml.bind.ContextFinder.find(ContextFinder.java:445) ~[?:1.7.0_25] at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:637) ~[?:1.7.0_25] at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:584) ~[?:1.7.0_25] at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor.getJaxbContext(AbstractJaxb2PayloadMethodProcessor.java:216) ~[spring-ws-core-2.1.2.RELEASE.jar:?] at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor.c…
has comment: http://stackoverflow.com/comment/39232058
downvote count: 0
has comment: http://stackoverflow.com/comment/61882839
favorite count: 0

http://stackoverflow.com/q/25175827
has body: I am using DataOutOutputStream.writeShort(); method to write short on a text file, but using this method I can only write -32768 to 32767, but I don't want to write -ve short but there is no method like writeUnsignedShort(); in DataOutputStream, is there any way to write unsigned short on a text file???
tagged with: java
has answer: http://stackoverflow.com/a/25175898
has answer: http://stackoverflow.com/a/25176264
answer count: 4
has answer: http://stackoverflow.com/a/25176077
has title: how to write unsigned short on a text file in java
has answer: http://stackoverflow.com/a/25175874
downvote count: 0
type: UnansweredQuestion
type: Question
score: 1
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39199274

http://stackoverflow.com/q/25222441
tagged with: printwriter
accepted answer: http://stackoverflow.com/a/25232397
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39286733
tagged with: java
tagged with: printstream
type: Question
tagged with: cout
possible better answer: http://stackoverflow.com/a/25222860
has answer: http://stackoverflow.com/a/25232397
score: 0
answer count: 2
tagged with: cin
has title: File not created by using File.createNewFile();
has answer: http://stackoverflow.com/a/25222860
has comment: http://stackoverflow.com/comment/39286722
has body: im having a small problem with my properties files with a PrintWriter. This is the code for the main file: package org.goverment; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Tg { public static final void main(String[] args) throws Exception { cout("The Goverment - Create your own country!/"); cout("Press the number associated with your choice then press enter./"); cout("1. New Game/"); cout("2. Continue/"); cout("3. ExitGame/"); int c = Integer.parseInt(cin()); if(c == 1) { cout("/"); cout("Country name: "); String name = cin(); cout("\nIs this a soviet country? (y/n): "); String soviet = cin(); boolean svt; if(soviet.equalsIgnoreCase("y") || soviet.equalsIgnoreCase("yes")) svt = true; else if(soviet.equalsIgnoreCase("n") || soviet.equalsIgnoreCase("no")) svt = false; else svt = false; Game.setup(Game.cc(), name, svt); } else if(c == 2) System.exit(0); // Game.c(); else if(c == 3) System.exit(0); } private static String cin() throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); return br.readLine(); } public static final void cout(String s) { if(s.endsWith("/") || s.equalsIgnoreCase("")) { System.out.println(s.substring(0, s.length() - 1)); } else { System.out.print(s); } } } And this is the Game class: http://pastebin.com/bktg6nSc This is the problem: The file isint created... i keep flushing and closing but nothing happens. i keep looking at the application data but no thegoverment.properties is there. So what should i do? I really do need help, its for a school project and i must do it by 2 days.
has comment: http://stackoverflow.com/comment/39286702
has comment: http://stackoverflow.com/comment/39308588

http://stackoverflow.com/a/25204436
has body: Please go through this and make sure you have the needed libraries and plugins: http://www.scalatest.org/user_guide/using_scalatest_with_intellij
answers question: http://stackoverflow.com/q/25204332
score: 0
has comment: http://stackoverflow.com/comment/39253363
type: Answer

http://stackoverflow.com/comment/39349701
comment on: http://stackoverflow.com/q/25173848
score: 0
has text: @MadProgrammer Can you tell me the complete code you are using to make it work using ProcessBuilder?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39153276
type: AnswerComment
type: Comment
has text: Ok, you win. Let me go back to watching at my code and figuring out where did I made mistake :)
comment on: http://stackoverflow.com/a/25150775
score: 0

http://stackoverflow.com/q/25224277
type: AnsweredQuestion
tagged with: string
has answer: http://stackoverflow.com/a/25224303
type: Question
answer count: 2
tagged with: regex
has title: java regex replace any double letter in word with single
score: 0
tagged with: java
has body: I've been searching for hours but can't find an answer, I apologize if this has been answered before. I'm trying to check each word in a message for any double letters and remove the extra letter, words like wall or doll for example would become wal or dol. the purpose is for a fake language translation for a game, so far I've gottan as far as identifying the double letters but don't know how to replace them. here's my code so far: public String[] removeDouble(String[] words){ Pattern pattern = Pattern.compile("(\\w)\\1+"); for (int i = 0; i &lt; words.length; i++){ Matcher matcher = pattern.matcher(words[i]); if (matcher.find()){ words[i].replaceAll("what to replace with?"); } } return words; }
accepted answer: http://stackoverflow.com/a/25224303
possible better answer: http://stackoverflow.com/a/25224297
has answer: http://stackoverflow.com/a/25224297

http://stackoverflow.com/q/25227223
type: AnsweredQuestion
has body: For a descriptive statistical analysis I need to grab the data a webpage. One record looks like that: R110327 Test TestProfession city, street Tel: 129128312 Serie, Fax: 214213413 Email: test Web: http://www.test.at Language: English Profession: meditation, sport I am doing that with selenium 2.42.2. For testing purpose I tried to gather the fullName, profession and the street. public ArrayList<Person> getWantedFields() { log.info("retrieve wanted fields"); resultList = new ArrayList<Person>(); WebElement fullName = driver.findElement(By.xpath("//h1")); WebElement profession = driver.findElement(By.xpath("//p")); WebElement street = driver.findElement(By.xpath("//p/br[1]")); //2811 results for (int i = 0; i < 2811; i++) { resultList.add(new Person(fullName.getText(), profession.getText(), street.getText(), null, null, null, null, null)); } log.info(resultList.toString()); return resultList; } However, I only get back: [Person [fullName=Search, profession=, street=, ... As you can see only the first field gives me always the same text and the other two give me back "". I think my xpath is wrong but I am struggeling to get the wanted fields, when I do not have identifiers. Any recommendations how to get these three fields? I appreciate your answer!
accepted answer: http://stackoverflow.com/a/25227287
score: 1
tagged with: java
tagged with: selenium
upvote count: 1
type: Question
has title: Get data without identifiers
has answer: http://stackoverflow.com/a/25227287
answer count: 1
downvote count: 0
favorite count: 0
tagged with: selenium-webdriver
tagged with: xpath

http://stackoverflow.com/comment/39157553
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25152812
has text: http://stackoverflow.com/questions/9617207/listfoo-as-form-backing-object-using-spring-3-mvc-correct-syntax
type: QuestionComment

http://stackoverflow.com/q/25092326
tagged with: rest
type: Question
has answer: http://stackoverflow.com/a/25092383
possible better answer: http://stackoverflow.com/a/25092380
has answer: http://stackoverflow.com/a/25092380
tagged with: spring-mvc
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/25092539
answer count: 3
has comment: http://stackoverflow.com/comment/39044471
has body: I written a controller is following @RequestMapping(value = "/update/{roleId}", method = {RequestMethod.POST, RequestMethod.PUT}) public String updateRole(@PathVariable Integer roleId,@Valid UserRoleResource roleDTO, ModelMap modelMap) { UserRole userRoleforduplicate = userRoleService.findByRoleName(roleDTO.getRoleName()); if(userRoleforduplicate==null) { UserRole userRole = mapper.updateUserRoleFrom(roleDTO,userRoleService.findById(roleId)); userRoleService.update(userRole); modelMap.addAttribute("user_role", userRole); modelMap.addAttribute("roleId", userRole.getRoleId()); this.succes="redirect:/roles/listroles"; } else { Object s="Role Name Already Exist"; modelMap.addAttribute("aslam", s); this.succes="redirect:/roles/updateLoadDetails/roleId"; } return succes; } In which the else part is not working properly because the variable succes is a string and the roleId is a Integer,So it throws the following error Failed to convert value of type 'java.lang.String' to required type 'java.lang.Integer'; nested exception is java.lang.NumberFormatException: For input string: "roleId" For this issue can i append the roleId to StringBuilder ?Like String s1="redirect:/roles/updateLoadDetails/"; Integer i2=roleId; stringbuilder.append(s1); stringbuilder.append(i2); return stringbuilder; Or any other option to pass a integer value to string?? plz anybody help
tagged with: stringbuffer
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: url
has title: can i append integer value to stringbuilder?
has answer: http://stackoverflow.com/a/25092539
favorite count: 0

http://stackoverflow.com/comment/39245187
comment on: http://stackoverflow.com/q/25198280
type: Comment
type: QuestionComment
has text: BorderLayout does not care about size. It just enlarge the scroll to fill all available width. Try to use another LayoutManager
score: 1

http://stackoverflow.com/q/25102836
type: UnansweredQuestion
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39069397
has comment: http://stackoverflow.com/comment/39069411
type: Question
has comment: http://stackoverflow.com/comment/39063937
has body: Background I have created a game loop to run the UI, but when I push the back button from the game screen (SingleGameActivity) I get to the level-selector menu called (StartLvlActivity). If I try to reenter the game or push the back button from StartLvlActivity I get a keyDispatchingTimedOut error (ANR). When I wrote Log messages, the game activity (SingleGameActivity) was only paused, not stopped when I pushed the back button. And the game loop was never destroyed when I closed the activity. 08-03 09:56:12.130: I/Process(346): Sending signal. PID: 5763 SIG: 3 08-03 09:56:12.130: I/dalvikvm(5763): threadid=3: reacting to signal 3 08-03 09:56:12.333: I/dalvikvm(5763): Wrote stack traces to '/data/anr/traces.txt' 08-03 09:56:12.341: E/ActivityManager(346): ANR in com.coderogden.pongtennis (com.coderogden.pongtennis/.activities.StartLvlActivity) 08-03 09:56:12.341: E/ActivityManager(346): Reason: keyDispatchingTimedOut Questions 1. Why isn't the game loop destroyed when I push the back button from the game menu? I mean, why isn't surfaceDestroyed called when onPaused is called (onStop is never called and I don't know why....). How do I access "/data/anr/traces.txt" How do I handle the errors? If you can answer any of these questions I would appreciate it very much! EDIT This is the surface view class from where I start and destroy the thread (or apperently I'm just starting it as it won't shut down when I press "back"-button). @Override public void surfaceCreated(SurfaceHolder holder) { thread.setRunning(true); thread.start(); Log.d(TAG, " surface created"); } @Override public void surfaceDestroyed(SurfaceHolder holder) { boolean retry = true; while (retry) { try { thread.join(); retry = false; } catch (InterruptedException e) { e.printStackTrace(); } } Log.d(TAG, " surface destroyed"); } EDIT 2 (with solution!) The bug was fixed by changing this piece of code: boolean retry = true; while (retry) { try { thread.join(); retry = false; } catch (InterruptedException e) { …
has comment: http://stackoverflow.com/comment/39063462
tagged with: java
has title: Game Loop Is Not Destroying
has comment: http://stackoverflow.com/comment/39069344
has comment: http://stackoverflow.com/comment/39064289
has comment: http://stackoverflow.com/comment/39064071
downvote count: 0
favorite count: 0
tagged with: android
answer count: 0

http://stackoverflow.com/comment/39194384
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25172937
has text: Immutable may be too strong a word for arrays. For array _size_, sure.
score: 1

multithreading
tags question: http://stackoverflow.com/q/25098539
tags question: http://stackoverflow.com/q/25093661
tags question: http://stackoverflow.com/q/25209599
tags question: http://stackoverflow.com/q/25126980
tags question: http://stackoverflow.com/q/25225684
tags question: http://stackoverflow.com/q/25079093
tags question: http://stackoverflow.com/q/25177034
type: Tag
tags question: http://stackoverflow.com/q/25104668
tags question: http://stackoverflow.com/q/25226906
tags question: http://stackoverflow.com/q/25154091
tags question: http://stackoverflow.com/q/25078278
tags question: http://stackoverflow.com/q/25130389
tags question: http://stackoverflow.com/q/25175015
tags question: http://stackoverflow.com/q/25211966
tags question: http://stackoverflow.com/q/25095868
tags question: http://stackoverflow.com/q/25109590
tags question: http://stackoverflow.com/q/25101589
tags question: http://stackoverflow.com/q/25177767
tags question: http://stackoverflow.com/q/25149429
tags question: http://stackoverflow.com/q/25097928
tags question: http://stackoverflow.com/q/25139753
tags question: http://stackoverflow.com/q/25169970
tags question: http://stackoverflow.com/q/25211904
tags question: http://stackoverflow.com/q/25228029
tags question: http://stackoverflow.com/q/25130495
tags question: http://stackoverflow.com/q/25168062
tags question: http://stackoverflow.com/q/25156724
tags question: http://stackoverflow.com/q/25093592
tags question: http://stackoverflow.com/q/25097806
tags question: http://stackoverflow.com/q/25218504
tags question: http://stackoverflow.com/q/25191804
tags question: http://stackoverflow.com/q/25151942
tags question: http://stackoverflow.com/q/25208171
tags question: http://stackoverflow.com/q/25070808
tags question: http://stackoverflow.com/q/25094229
tags question: http://stackoverflow.com/q/25075213
tags question: http://stackoverflow.com/q/25100813
tags question: http://stackoverflow.com/q/25215145
tags question: http://stackoverflow.com/q/25102241
tags question: http://stackoverflow.com/q/25189656
tags question: http://stackoverflow.com/q/25215832
tags question: http://stackoverflow.com/q/25109961
tags question: http://stackoverflow.com/q/25154039
tags question: http://stackoverflow.com/q/25172331
tags question: http://stackoverflow.com/q/25073997
tags question: http://stackoverflow.com/q/25217996
tags question: http://stackoverflow.com/q/25166568
tags question: http://stackoverflow.com/q/25176993
tags question: http://stackoverflow.com/q/25219686
tags question: http://stackoverflow.com/q/25094683
tags question: http://stackoverflow.com/q/25192648
tags question: http://stackoverflow.com/q/25084248
tags question: http://stackoverflow.com/q/25082815
tags question: http://stackoverflow.com/q/25151214
tags question: http://stackoverflow.com/q/25194582
tags question: http://stackoverflow.com/q/25092615
tags question: http://stackoverflow.com/q/25094912
tags question: http://stackoverflow.com/q/25082706
tags question: http://stackoverflow.com/q/25186500
tags question: http://stackoverflow.com/q/25173197
tags question: http://stackoverflow.com/q/25146734
tags question: http://stackoverflow.com/q/25072648
tags question: http://stackoverflow.com/q/25189624
tags question: http://stackoverflow.com/q/25086150
tags question: http://stackoverflow.com/q/25217432
tags question: http://stackoverflow.com/q/25197160
tags question: http://stackoverflow.com/q/25106880
tags question: http://stackoverflow.com/q/25224033
tags question: http://stackoverflow.com/q/25155838
tags question: http://stackoverflow.com/q/25171994
tags question: http://stackoverflow.com/q/25216217
tags question: http://stackoverflow.com/q/25169291
tags question: http://stackoverflow.com/q/25091736
tags question: http://stackoverflow.com/q/25120328
tags question: http://stackoverflow.com/q/25147446
tags question: http://stackoverflow.com/q/25155031
tags question: http://stackoverflow.com/q/25192164
tags question: http://stackoverflow.com/q/25118755
tags question: http://stackoverflow.com/q/25133076

http://stackoverflow.com/comment/102387722
comment on: http://stackoverflow.com/a/25164757
score: 0
type: AnswerComment
type: Comment
has text: Thanks, this is the approach I was looking for. However, this doesn't quite work "across 0" -- positive +ε and negative -ε aren't seen as being anywhere close. Here's an alternate version that passes the tests I've made (but I wouldn't be shocked if it has some glitch somewhere, too): `return d1==d2 /* hotpath; also handles infinities and NaNs. */ || (Math.abs(d1-d2) < Math.max( Math.ulp(d1), Math.ulp(d2) ) * (0b1L << bits));`

http://stackoverflow.com/a/25137286
has comment: http://stackoverflow.com/comment/39127701
accepted answer of: http://stackoverflow.com/q/25135753
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39127487
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/39127672
has comment: http://stackoverflow.com/comment/39128048
score: 2
has comment: http://stackoverflow.com/comment/39128540
has body: No. you need to provide a location to write the log file. If you need to generate the logs in the folder where you war is deployed , &lt;param name="file" value="../logs/logFile.log" /&gt; will create logfile in the folder where you have deployed Read more here
has comment: http://stackoverflow.com/comment/39127728
has comment: http://stackoverflow.com/comment/39136467
answers question: http://stackoverflow.com/q/25135753

http://stackoverflow.com/a/25176835
upvote count: 2
has body: You are redefining your String with every iteration of for loop. Move declaration of String outside the loop. String fileContent = ""; for(File file:files) { fileContent += readFileContents(file.getAbsolutePath()); } Also StringBuilder is a better choice for string manipulations. So this is an efficient soution: StringBuilder fileContent = new StringBuilder(); for(File file:files) { fileContent.append(readFileContents(file.getAbsolutePath())); }
has comment: http://stackoverflow.com/comment/39201069
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39201441
has comment: http://stackoverflow.com/comment/39201354
accepted answer of: http://stackoverflow.com/q/25176814
type: Answer
has comment: http://stackoverflow.com/comment/39201136
answers question: http://stackoverflow.com/q/25176814
score: 2
has comment: http://stackoverflow.com/comment/39201103
downvote count: 0
has comment: http://stackoverflow.com/comment/39201275
has comment: http://stackoverflow.com/comment/39201411

http://stackoverflow.com/comment/39029237
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25084120
has text: Instead of your `for (char a : testAnswer.toCharArray()) { answer.add(a); }` you should write `answer = new ArrayList<Character>(Arrays.asList(testAnswer.toCharArray()));`.
type: Comment

http://stackoverflow.com/comment/39972212
type: Comment
comment on: http://stackoverflow.com/a/25079756
score: 1
type: AnswerComment
has text: thats helpful. Even I'm facing the same.

http://stackoverflow.com/q/25203897
type: Question
favorite count: 0
has comment: http://stackoverflow.com/comment/39251232
has answer: http://stackoverflow.com/a/25204008
answer count: 1
tagged with: format
linked to: http://stackoverflow.com/q/30360089
accepted answer: http://stackoverflow.com/a/25204008
has body: I want to change my Date object format. I looked other topics but always Date converted to String. I have this one: String datee=unitdata[i].toString(); Date dater = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").parse(datee); String smp= new SimpleDateFormat("MM").format(dater); SimpleDateFormat df = new SimpleDateFormat("MM"); Date date = df.parse(smp); x[i]=date; date returned like this: "Wed Jul 01 00:00:00 CET 1970", but I want like this: "01" in Date format not String. Thanks
tagged with: java
has title: Java Change Date Format
downvote count: 3
linked to: http://stackoverflow.com/q/4216745
tagged with: date
duplicate of: http://stackoverflow.com/q/30360089
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/39251322
score: -3

http://stackoverflow.com/comment/39083442
score: 0
has text: Problem was solved by using json-simple.jar instead of javax.json-1.0.jar. Thanks.
comment on: http://stackoverflow.com/q/25092244
type: Comment
type: QuestionComment

google-bigquery
tags question: http://stackoverflow.com/q/25158570
type: Tag
tag name: google-bigquery

http://stackoverflow.com/q/25185428
type: UnansweredQuestion
score: 2
tagged with: redeploy
upvote count: 2
tagged with: java
has title: How to hot swap JSF xhtml files using Eclipse and WebLogic 11g without JRebel?
type: Question
tagged with: eclipse
has body: I don't have JRebel. I hope there are solutions out there without buying JRebel.
tagged with: weblogic11g
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25187998
favorite count: 0

http://stackoverflow.com/q/25081383
tagged with: android-listview
tagged with: android
has comment: http://stackoverflow.com/comment/39024801
answer count: 4
accepted answer: http://stackoverflow.com/a/25081612
score: 2
has comment: http://stackoverflow.com/comment/39026813
has body: I have created two Activities (MainActivity, ListActivity) and in MainActivity, I have an EditText and a save-button. In ListActivity, I have a ListView. I want to save the value/data/string text that is written in EditText and send it to the other Activity in the ListView. This is how it looks now, but I think I know what I'm missing but don't know how to do it. MainActivity. public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button save = (Button) findViewById(R.id.btnSave); final EditText et = (EditText) findViewById(R.id.editText); save.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, ListActivity.class); intent.putExtra("data", et.getText().toString()); startActivity(intent); } }); } } And the ListActivity. public class ListActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list); ListView lv = (ListView) findViewById(R.id.listView); Intent intent = getIntent(); String data = intent.getStringExtra("data"); } } Now the text is saved in data-string, but how paste it in ListView?
tagged with: android-edittext
has answer: http://stackoverflow.com/a/25081478
upvote count: 2
has answer: http://stackoverflow.com/a/25081618
possible better answer: http://stackoverflow.com/a/25081655
has title: Send data from edittext to listview
has answer: http://stackoverflow.com/a/25081655
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39023461
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/63547010
has answer: http://stackoverflow.com/a/25081612
has comment: http://stackoverflow.com/comment/112369972
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/25092771
has answer: http://stackoverflow.com/a/25092917
tagged with: java
score: 0
has title: How to resove the issue unable to resolve class XSSFWorkbook?
answer count: 1
accepted answer: http://stackoverflow.com/a/25092917
favorite count: 0
has body: I am trying to read the xlsx file using the below code but getting unable to result class.. any help would be appreciated... org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script7.groovy: 8: unable to resolve class XSSFWorkbook @ line 8, column 11. srcBook = new XSSFWorkbook(new FileInputStream(new File("C:\\PerTableData\\TestData-Mix.xlsx"))) ^ org.codehaus.groovy.syntax.SyntaxException: unable import org.apache.poi.ss.usermodel.*; //import org.apache.poi.ss.usermodel.DataFormatter //Create data formatter //dFormatter = new DataFormatter() //Create a new workbook using POI API srcBook = new XSSFWorkbook(new FileInputStream(new File("C:\\PerTableData\\TestData-Mix.xlsx"))) //Create formula evaluator to handle formula cells fEval = new XSSFFormulaEvaluator(srcBook) //Get first sheet of the workbook (assumes data is on first sheet) sourceSheet = srcBook.getSheetAt(0) //Sets row counter to 0 (first row)-- if your sheet has headers, you can set this to 1 context.rowCounter = 0 //Read in the contents of the first row sourceRow = sourceSheet.getRow(0) //Step through cells in the row and populate property values-- note the extra work for numbers elNameCell = sourceRow.getCell(0) testCase.setPropertyValue("ElName",dFormatter.formatCellValue(elNameCell,fEval)) atNumCell = sourceRow.getCell(1) testCase.setPropertyValue("AtNum",dFormatter.formatCellValue(atNumCell,fEval)) symbolCell = sourceRow.getCell(2) testCase.setPropertyValue("Symbol",dFormatter.formatCellValue(symbolCell,fEval)) atWtCell = sourceRow.getCell(3) testCase.setPropertyValue("AtWeight",dFormatter.formatCellValue(atWtCell,fEval)) boilCell = sourceRow.getCell(4) testCase.setPropertyValue("BoilPoint",dFormatter.formatCellValue(boilCell,fEval)) //Rename request test steps for readability in the log; append the element name to the test step names testCase.getTestStepAt(0).setName("GetAtomicNumber-" + testCase.getPropertyValue("AtNum")) testCase.getTestStepAt(1).setName("GetAtomicWei…
type: AnsweredQuestion
tagged with: apache-poi
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/comment/42672161
type: Comment
type: QuestionComment
has text: I have wrote a blog u might be interested into, http://jasenkoh.blogspot.com/2014/11/java-restful-web-services-with-spring.html
comment on: http://stackoverflow.com/q/25185023
score: 0

http://stackoverflow.com/q/25204496
has comment: http://stackoverflow.com/comment/39286393
has title: Can't display the contents of a CSV
has comment: http://stackoverflow.com/comment/39254399
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39253008
tagged with: http://stackoverflow.com/tag/r
score: 0
tagged with: http://stackoverflow.com/tag/csv
has body: When I am trying to display the contents of a CSV file by integrating R with java, I get the following output: org.rosuda.REngine.REXPGenericVector@2f8c5b4f+[1]named My code is REXP x; x= c.eval("elements&lt;-read.csv(file ='D:/Book2.csv', head=TRUE, sep=',')"); System.out.println(x); asString() is not helping to change the output. I want the program to display the contents of the CSV file in readable format. What do I do?
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25096634
score: 1
has comment: http://stackoverflow.com/comment/39052094
has comment: http://stackoverflow.com/comment/39052170
favorite count: 0
has comment: http://stackoverflow.com/comment/39052948
has comment: http://stackoverflow.com/comment/39053329
upvote count: 1
has answer: http://stackoverflow.com/a/25097577
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25097594
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/25096674
has answer: http://stackoverflow.com/a/25096674
has title: How do I insert a NULL value into a db table in java?
downvote count: 0
accepted answer: http://stackoverflow.com/a/25097577
has comment: http://stackoverflow.com/comment/39052019
has body: The problem is that I can't figure out how to insert a null value. The column is date and if it's empty it just adds the current date to the db by default, but I don't know how to leave it empty or null if the user doesn't specify a custom date. statement.executeUpdate("insert into table values(null, 100, 'text')"); This is the query. I've tried to skip the first value, insert a null, insert empty string, a 0 value. nothing seems to do the trick.
has comment: http://stackoverflow.com/comment/39052919
answer count: 3
tagged with: sql
has comment: http://stackoverflow.com/comment/39057120

http://stackoverflow.com/a/25186786
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39222042
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/39220012
has body: Sounds like something you could use AsyncTask for http://developer.android.com/reference/android/os/AsyncTask.html then again, it depends on the specifics of what you're going for
accepted answer of: http://stackoverflow.com/q/25186538
answers question: http://stackoverflow.com/q/25186538
downvote count: 0

http://stackoverflow.com/a/26733069
has comment: http://stackoverflow.com/comment/42054552
has comment: http://stackoverflow.com/comment/55212446
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42055001
has comment: http://stackoverflow.com/comment/42054223
score: 1
has comment: http://stackoverflow.com/comment/42053601
downvote count: 0
answers question: http://stackoverflow.com/q/25113154
has body: Spring 4 documentation has this solution, "If you actually want to cache specific responses, your application can selectively invoke HttpServletResponse.setHeader(String,String) to override the header set by Spring Security". This is useful to ensure things like CSS, JavaScript, and images are properly cached. Below snippet can be used for springmvc configuration, @EnableWebMvc public class WebMvcConfiguration extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry .addResourceHandler("/resources/**") .addResourceLocations("/resources/") .setCachePeriod(31556926); } // ... } For reference: http://docs.spring.io/spring-security/site/docs/4.0.0.CI-SNAPSHOT/reference/htmlsingle/#headers-cache-control

http://stackoverflow.com/comment/39016375
has text: i am making use of springs tag to show up the form and <form:hidden path="" id=""> does not provide any value attribute to set value
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25076167
type: Comment

http://stackoverflow.com/q/25140742
has answer: http://stackoverflow.com/a/25140868
score: 4
accepted answer: http://stackoverflow.com/a/25140804
has body: I have in my unit test the following line verify(MyMock).handleError(any(ICallBack.class),any(BaseError.class) ); But what I want to write is a verify that tests if the base error class (2nd parameter) has BaseError::errorCode = 3 How do I do it? Is it only with argument capture? Thanks.
has title: Mockito - verify method is called with a specific parameter ( condition )
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/25140804
tagged with: mockito
downvote count: 0
possible better answer: http://stackoverflow.com/a/25140868
favorite count: 0

http://stackoverflow.com/comment/39290630
type: Comment
comment on: http://stackoverflow.com/a/25224807
type: AnswerComment
has text: if you are beginner to java, i wouldn't recommend you using a simple text editor. Try using Eclipse or other IDE. It will help you move faster
score: 0

http://stackoverflow.com/q/25091027
tagged with: locale
has comment: http://stackoverflow.com/comment/39049407
answer count: 1
downvote count: 0
has title: Set the system language
has comment: http://stackoverflow.com/comment/39041941
tagged with: windows
has body: I need to setup a text field and it's input language to be Malayalam-India in Windows. I tried with this code: System.setProperty("user.language","MY"); System.setProperty("user.country","IN"); But it didn't succeed. How can I set the system language in Java?
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/25091106
score: 1
has comment: http://stackoverflow.com/comment/39041929
tagged with: java
type: Question

http://stackoverflow.com/a/25098438
answers question: http://stackoverflow.com/q/25098416
has comment: http://stackoverflow.com/comment/39055520
has comment: http://stackoverflow.com/comment/39055659
type: AcceptedAnswer
downvote count: 0
has body: A word boundary asserts that on one side there is a word character, and on the other side there is not. You can use the following regex: String s = "foil boil oil toil hello"; s = s.replaceAll("\\w*oil\\w*", "").trim(); System.out.println(s); //=&gt; "hello" Or if you want to be strict on just matching letters. String s = "foil boil oil toil hello"; s = s.replaceAll("(?i)[a-z]*oil[a-z]*", "").trim(); System.out.println(s); //=&gt; "hello"
type: Answer
has comment: http://stackoverflow.com/comment/39055801
score: 2
accepted answer of: http://stackoverflow.com/q/25098416
has comment: http://stackoverflow.com/comment/39055571
upvote count: 2

http://stackoverflow.com/q/25137577
has comment: http://stackoverflow.com/comment/39127869
type: UnansweredQuestion
has body: I'm drawing charts in 4 JPanels by selecting in a JComboBox the Item from which I should read informations to draw. The selection starts a Thread who readInformations() and repaint() every second. It works fine about information reading, but when i select back an Item already started, it doesn't repaint the entire chart, but begin from the current information, so it lost a part of chart. public class MainClass extends JFrame { private ArrayList&lt;Item&gt; items; public MainClass() { items = new ArrayList(); } private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) { if(!items.get((jComboBox1.getSelectedIndex())).isRunning()) { items.get(jComboBox1.getSelectedIndex()).start(); } for(int i=0; i&lt;forni.size(); i++) { if(forni.get(i).isRunning() &amp;&amp; forni.get(i) != forni.get(jComboBox1.getSelectedIndex())) { jPanel1.remove(items.get(i).getChart1()); jPanel2.remove(items.get(i).getChart2()); jPanel3.remove(items.get(i).getChart3()); jPanel4.remove(items.get(i).getChart4()); } } jPanel1.add(forni.get(jComboBox1.getSelectedIndex()).getChart1()); jPanel2.add(forni.get(jComboBox1.getSelectedIndex()).getChart2()); jPanel3.add(forni.get(jComboBox1.getSelectedIndex()).getChart3()); jPanel4.add(forni.get(jComboBox1.getSelectedIndex()).getChart4()); jPanel1.revalidate(); jPanel2.revalidate(); jPanel3.revalidate(); jPanel4.revalidate(); } } Item Class import java.util.Timer; public class Item { private Chart chart1; private Chart chart2; private Chart chart3; private Chart chart4; private Timer timer; private boolean running = false; public Item() { timer = new Timer(); chart1 = new Chart(); //... } public void start() { running = true; timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { read(); repaint(); } }, 1000,1000); } private void read() { chart1.read(); //.... } private void repaint() { chart1.repaint(); //... } public Boolean isRunning() { return running; } // And the getting methods that return a JComponent } The Chart class…
has comment: http://stackoverflow.com/comment/39129215
type: Question
has title: Java Swing - MultiThread and Repaint
has comment: http://stackoverflow.com/comment/39128010
tagged with: repaint
score: -1
favorite count: 0
has answer: http://stackoverflow.com/a/25137884
tagged with: multithreading
answer count: 2
has answer: http://stackoverflow.com/a/25137737
tagged with: swing
tagged with: java
downvote count: 1
upvote count: 0

http://stackoverflow.com/q/25169957
tagged with: java
has comment: http://stackoverflow.com/comment/39189564
type: Question
has title: Write to remote file using SSH
score: 0
has comment: http://stackoverflow.com/comment/39189420
tagged with: ssh
answer count: 1
has body: I want to write a String generated by a POJO to be written to a file in a remote server accessible only through scp/ssh. Would like to avoid creating local temporary file and scp the files to the remote machines. Implementation using Jsch library is preferred.
tagged with: jsch
has comment: http://stackoverflow.com/comment/39189477
tagged with: scp
has answer: http://stackoverflow.com/a/25188801
accepted answer: http://stackoverflow.com/a/25188801
type: AnsweredQuestion

http://stackoverflow.com/comment/39002747
has text: Same behavior if you use sudo instead of gksu?
comment on: http://stackoverflow.com/q/25069980
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39129260
type: AnswerComment
type: Comment
has text: Could you please post how I have to modify my example?
comment on: http://stackoverflow.com/a/25138277
score: 0

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/25154708
tags question: http://stackoverflow.com/q/25138517

http://stackoverflow.com/comment/39241169
comment on: http://stackoverflow.com/q/25197935
score: 0
type: Comment
type: QuestionComment
has text: If you had confusion on data type of interval you could have gone for generic <T>.

http://stackoverflow.com/comment/39070282
score: 0
type: Comment
has text: Ok, when I use merge instead of persist, I got no error, selecting or not an option; but when I select an option, it isn't stored in the database.
type: AnswerComment
comment on: http://stackoverflow.com/a/25106406

http://stackoverflow.com/comment/39144215
comment on: http://stackoverflow.com/a/25145871
type: AnswerComment
score: 0
has text: That's a really solid idea. Thank you.
type: Comment

http://stackoverflow.com/comment/134520827
score: 0
type: AnswerComment
has text: I had to tweak your code a bit, but your approach is exactly what I as looking for. `@ExceptionHandler(MissingRequestHeaderException.class)` `public ResponseEntity<String> handleException(MissingRequestHeaderException exc) {` `return new ResponseEntity<>(exc.getMessage(), HttpStatus.BAD_REQUEST);` `}`
type: Comment
comment on: http://stackoverflow.com/a/67568544

http://stackoverflow.com/comment/39199382
comment on: http://stackoverflow.com/q/25175463
score: 0
type: QuestionComment
has text: Post your logcat error along with question
type: Comment

http://stackoverflow.com/comment/39277152
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25217356
has text: How will you identify the date? The present format doesnot provide the date information!

android-studio
tags question: http://stackoverflow.com/q/25157640
tags question: http://stackoverflow.com/q/25149692
tags question: http://stackoverflow.com/q/25161291
tags question: http://stackoverflow.com/q/25223957
tags question: http://stackoverflow.com/q/25139047
tags question: http://stackoverflow.com/q/25207380
tags question: http://stackoverflow.com/q/25071241
tags question: http://stackoverflow.com/q/25170453
tags question: http://stackoverflow.com/q/25095402
tags question: http://stackoverflow.com/q/25101058
tags question: http://stackoverflow.com/q/25082180
tags question: http://stackoverflow.com/q/25089796
tags question: http://stackoverflow.com/q/25131978
tags question: http://stackoverflow.com/q/25084517
type: Tag
tags question: http://stackoverflow.com/q/25160338
tags question: http://stackoverflow.com/q/25112288
tag name: android-studio
tags question: http://stackoverflow.com/q/25186124
tags question: http://stackoverflow.com/q/25182774

http://stackoverflow.com/q/25078578
tagged with: methods
has answer: http://stackoverflow.com/a/25078601
downvote count: 1
type: Question
has body: The assignment is asking me to: "Design and implement the class CupDispenser. Each CupDispenser object has a location and keeps track of the number of cups it currently contains. Define two constructors, set and get methods for each data field, and the method toString. Also, define a method getOneCup that simply decrements the number of cups in the dispenser by 1. Demonstrate your class by creating several CupDispenser objects." This is my class file: public class CupDispenser { // Data Fields private String location; private int numberCups; // Constructors public CupDispenser(){ location = "Unknown"; numberCups = 0; } public CupDispenser(String theLocation, int firstCups){ location = theLocation; numberCups = firstCups; } // Methods public String getLocation(){ return location; } public void setLocation(String location){ location = location; } public int getNumberCups(){ return numberCups; } public void setNumberCups(int numberCups){ numberCups = numberCups; } public void decrementNumberCups(){ numberCups = numberCups - 1; } //Other public String toString(){ String result = ("Location: " + location + ". Number of cups: " + numberCups + "."); return result.toString(); } }//end CupDispenser class This is my demo file: public class CupDispenserDemo{ public static void main(String[] args) { CupDispenser cd1 = new CupDispenser("My house", 10); CupDispenser cd2 = new CupDispenser("Your house", 15); System.out.println(cd1.toString); System.out.println(cd2.toString); cd1.setLocation("Her home"); cd1.setNumberCups(12); cd2.decrementNumberCups(); cd2.decrementNumberCups(); } } In terminal I javac'd the CupDispenser.java class successfully, however the same can't be said for the CupDispenserDemo.java, as I get these errors: CupDispenserDemo.java:14: error: cannot find symbol System.out.println(cd1.toString); ^ symbol: variable toString location: variable cd1 of type CupDispenser CupDispenserDemo.java:15: error: cannot find symbol System.out.println(cd2.toString); ^ symbol: va…
tagged with: java
tagged with: class
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: error: cannot find symbol while calling toString method
tagged with: constructor
upvote count: 2
score: 1

http://stackoverflow.com/a/25172770
answers question: http://stackoverflow.com/q/25172201
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/39195057
downvote count: 0
has body: First create your desired layout and than in your main starting activity run one thread which shows splash screen layout for given time and then Launch MainActivity Eenter link description here public class Splash extends Activity { private final int DISPLAY_LENGTH = 1000; @Override public void onCreate(Bundle saved) { super.onCreate(saved); setContentView(R.layout.splashscreen); new Handler().postDelayed(new Runnable(){ @Override public void run() { /* Create an Intent that will start the Menu-Activity. */ Intent mainIntent = new Intent(Splash.this,MainActivity.class); Splash.this.startActivity(mainIntent); Splash.this.finish(); } }, DISPLAY_LENGTH); } }

http://stackoverflow.com/q/25209855
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25209934
tagged with: java
possible better answer: http://stackoverflow.com/a/25209900
type: Question
has answer: http://stackoverflow.com/a/25209900
has title: How to "safely" use polymorphism with generic template?
downvote count: 0
has answer: http://stackoverflow.com/a/25209931
has answer: http://stackoverflow.com/a/25209912
has body: I have an interface that a few of classes implements it: interface Vehicle {} class Car implements Vehicle {} class Bicycle implements Vehicle {} And I have another interface that has getter and setter of this: interface Person { public ArrayList&lt;Vehicle&gt; getVehicles(); public void setVehicles (ArrayList&lt;Vehicle&gt; vs); } And a few of classes implement it: class CarOwner implements Person { public ArrayList&lt;Car&gt; cars; public ArrayList&lt;Car&gt; getVehicles() { return cars; } public void setVehicles(ArrayList&lt;Car&gt; cars) { this.cars = cars; } } class BicycleOwner implements Person { //... } However it complains the setter has the same erasure as the interface but does not override it. I had to change the ArrayList&lt;Vehicle&gt; to ArrayList, and cast it in the function, but it is not "safe" (I know it should work but others may not). How to deal with this situation? Edit: As I changed my code to the answers, it stopped complaining. But when I use it, e.g. //I have an arraylist of Person ArrayList&lt;Person&gt; persons; //... Vehicle first = persons.get(0).getVehicles().get(0); The first line it complains the type requires a parameter... But it could be any type of person because the Arraylist persons can contain all types of Person.. How can do this? Or it has to leave it without template parameter? Edit2: I updated the answer down there and found when I call the setter it raises error again... Person&lt;?&gt; personA = persons.get(0); ArrayList&lt;Vehicle&gt; vs = new ArrayList&lt;Vehicle&gt;(); //vs.add(carA); personA.setVehicles(vs); The last line gives error: This gives error saying The method setVehicles(ArrayList&lt;capture#6-of ?&gt;) in the type Post&lt;capture#6-of ?&gt; is not applicable for the arguments (ArrayList&lt;Vehicle&gt;). I tried to change to ArrayList&lt;?&gt; but it does not work...
has answer: http://stackoverflow.com/a/25209934
tagged with: polymorphism
tagged with: generics
answer count: 4
favorite count: 0
upvote count: 2

http://stackoverflow.com/q/25174498
type: Question
type: AnsweredQuestion
has body: I followed a few different tutorials on how to get this working and I just can't seem to get my buttons to update the JLabel. Can you tell me which part is incorrect and lead me in the right path of what to fix. This has been plaguing me for hours. import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.SwingConstants; public class CoinApp extends JFrame { private JLabel label; private JRadioButton rdbtnNewRadioButton_3, rdbtnNewRadioButton, rdbtnNewRadioButton_1, rdbtnNewRadioButton_2; public CoinApp() { setBounds(50, 50, 500, 300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); ButtonGroup buttonGroup = new ButtonGroup(); JPanel panel = new JPanel(); getContentPane().add(panel); JRadioButton rdbtnNewRadioButton_3 = new JRadioButton(""); buttonGroup.add(rdbtnNewRadioButton_3); rdbtnNewRadioButton_3.setIcon(new ImageIcon(getClass().getResource("UsCent.png"))); panel.add(rdbtnNewRadioButton_3); JRadioButton rdbtnNewRadioButton = new JRadioButton(""); buttonGroup.add(rdbtnNewRadioButton); rdbtnNewRadioButton.setIcon(new ImageIcon(getClass().getResource("UsNickel.png"))); panel.add(rdbtnNewRadioButton); JRadioButton rdbtnNewRadioButton_1 = new JRadioButton(""); buttonGroup.add(rdbtnNewRadioButton_1); rdbtnNewRadioButton_1.setIcon(new ImageIcon(getClass().getResource("UsDime.png"))); panel.add(rdbtnNewRadioButton_1); JRadioButton rdbtnNewRadioButton_2 = new JRadioButton(""); buttonGroup.add(rdbtnNewRadioButton_2); rdbtnNewRadioButton_2.setVerticalAlignment(SwingConstants.TOP); rdbtnNewRadioButton_2.setIcon(new ImageIcon(getClass().getResource("UsQuarter.png"))); panel.add(rdbtnNewRadioButton_2); rdbtnNewRadioButton_3.setSelected(true); label = new JLabel("CENT w:2.5 d:19.1", …
tagged with: jlabel
tagged with: jframe
accepted answer: http://stackoverflow.com/a/25174542
score: 0
answer count: 2
tagged with: swing
possible better answer: http://stackoverflow.com/a/25174776
tagged with: java
has answer: http://stackoverflow.com/a/25174776
has answer: http://stackoverflow.com/a/25174542
has title: Display text on Jlabel with if statements and radio buttons

http://stackoverflow.com/a/25101845
has body: You can add an EntityInterceptor in your LocalSessionFactoryBean definition. The LocalSessionFactoryBean is Hibernate-specific.
score: 0
answers question: http://stackoverflow.com/q/25099491
type: Answer

http://stackoverflow.com/q/25169927
has comment: http://stackoverflow.com/comment/39188753
upvote count: 1
tagged with: libgdx
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39188984
tagged with: memory
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/39196130
has body: So I'm rather new to lib and im having some issues determining whats causing my out of memory errors: The program will run for aprox 45 seconds and then crash with the following errors: &lt;sharedmem_gpumem_alloc_id:1431&gt;: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory &lt;ioctl_kgsl_sharedmem_alloc:1532&gt;: ioctl_kgsl_sharedmem_alloc: FATAL ERROR : (null) MAIN CLASS CODE: package com.mygdx.game; import java.util.Random; import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.PerspectiveCamera; import com.badlogic.gdx.graphics.VertexAttributes.Usage; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g3d.Environment; import com.badlogic.gdx.graphics.g3d.Material; import com.badlogic.gdx.graphics.g3d.Model; import com.badlogic.gdx.graphics.g3d.ModelBatch; import com.badlogic.gdx.graphics.g3d.ModelInstance; import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; import com.badlogic.gdx.input.GestureDetector; import com.badlogic.gdx.input.GestureDetector.GestureListener; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector3; public class GDXGame extends ApplicationAdapter implements GestureListener { public CameraInputController camController; public Environment environment; public static PerspectiveCamera cam; public ModelBatch modelBatch; public Model cube; public ModelInstance cube1; public Model camCube; public ModelInstance camCubeInst; public float xPos,yPos,zPos; public Vector3 camPos; public Vector3 forward; public Vector3 side; public ModelBuilder modelBuilder; public static SpriteBatch batch; private button button1; @Override public void create () { environment = new Env…
has comment: http://stackoverflow.com/comment/95799564
favorite count: 0
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/39188838
has title: LibGDX errno 12 Out of memory
has comment: http://stackoverflow.com/comment/39188929
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25104238
has title: Create dummy objects for classes using JMockit
has answer: http://stackoverflow.com/a/25108398
has answer: http://stackoverflow.com/a/25106130
has body: I'd like to create dummy objects (see definition here) using JMockit. These objects are required as nonnull constructor arguments, but aren't needed for the specific unittest. Because the constructor might check the parameter (e. g. using Objects.requireNonNull), the dummy can't just be null. I'd like to use something like new ObjectWithUnusedDependency(dummy()); where dummy() creates a dummy object. Using public static &lt;T&gt; T dummy() { return new MockUp&lt;T&gt;() {}.getMockInstance(); } this might work if T is an interface, but for classes getMockInstance returns null. It would be nice, if the test would fail when a method is invoked on such a dummy object. Is there a way to accomplish this using JMockit?
has comment: http://stackoverflow.com/comment/39067073
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39068897
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/25106130
has comment: http://stackoverflow.com/comment/39066924
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/39066847
accepted answer: http://stackoverflow.com/a/25108398
tagged with: jmockit
answer count: 2
has comment: http://stackoverflow.com/comment/39066998

http://stackoverflow.com/a/26618592
has comment: http://stackoverflow.com/comment/41848367
has comment: http://stackoverflow.com/comment/41901252
upvote count: 21
has body: radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { // checkedId is the RadioButton selected RadioButton rb=(RadioButton)findViewById(checkedId); Toast.makeText(getApplicationContext(), rb.getText(), Toast.LENGTH_SHORT).show(); } });
answers question: http://stackoverflow.com/q/25102156
type: Answer
has comment: http://stackoverflow.com/comment/41900864
downvote count: 0
score: 21

http://stackoverflow.com/q/25107991
has answer: http://stackoverflow.com/a/25109299
upvote count: 1
type: Question
tagged with: android-service
has body: I am aware that there are dozens of links on Stackoverflow and other sites about the SpeechRecognizer class and how to implement it. I have been through several of them and have searched for hours. Although there are examples of implementations in services, they don't seem to work for me. My application has an activity, however it is only used for user settings and does not run when my service runs, which is called separately from the system. Thus my service does not have any main application thread to relate to in order to run/invoke the methods of the SpeechRecognizer class. As it is stated in the android docs, here: 'This class's methods must be invoked only from the main application thread.' When I run my code including the SpeechRecognizer.startListening(mSpeechRecognizerIntent) method which is in my service class I get the following error: java.lang.RuntimeException: SpeechRecognizer should be used only from the application's main thread Is there a way to solve this problem? I have read that the SpeechRecognizer can 'recognize speech while running in the background or from a service', I found that here: Comparison of Speech Recognition use in Android: by Intent or on-thread? So that is basically what I want I just can't seem to get the SpeechRecognizer started because I get the mentioned error. Could you also tell me whether it is necessary to call the following methods in the application's main thread (,which i don't have): mSpeechRecognizer = SpeechRecognizer.createSpeechRecognizer(this); mSpeechRecognizer.setRecognitionListener(new SpeechRecognitionListener()); My code is basically identical to the code in the top answer of this link: (without the IncomingHandler class, which I believe is only used to control the timing of the listener) Android Speech Recognition as a service on Android 4.1 &amp; 4.2 Would really appreciate some help, thanks in advance. This is my first android application so I am pretty new to it, please bear with me ;)
has title: How to invoke Speechrecognizer methods from service with no main thread or activity
linked to: http://stackoverflow.com/q/11913704
linked to: http://stackoverflow.com/q/14940657
downvote count: 0
answer count: 1
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: java

http://stackoverflow.com/q/25161813
type: UnansweredQuestion
has title: SOAP handlers using java keystore
tagged with: web-services
score: 2
tagged with: java
has body: I am working on web services security, trying to encrypt and sign SOAP messages between the server and the client. I used BouncyCastle, WSS4j and SOAP handlers. To test my work at first I used the same keystore file on both the server and the client sides.I followed some tutorials on the net and it worked: the messages sent by one side were encrypted and signed and then decrypted successfully on the other side. But now that I generated different certificates for the server and the client, and imported the client's cert into the servers jks file and vice-versa, I can't seem to figure out how to finish the task. It is still crypting and signing as if it only had a jks file without an imported cert in it. below is the code: Crypt_handler.java public class Crypt_handler implements SOAPHandler&lt;SOAPMessageContext&gt; , CallbackHandler{ public Properties prop; public InputStream input= null; public Crypt_handler () { try { prop=new Properties(); input = new FileInputStream("config.properties"); if(input==null){ System.out.println("Sorry, unable to find " ); return;} prop.load(input); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public boolean handleMessage(SOAPMessageContext messageContext) { try { // got the message from the context SOAPMessage msg = messageContext.getMessage(); // is outgoing? Boolean isOutGoing = (Boolean) messageContext .get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (isOutGoing) { // if it is outgoing code and sign crypt.EncryptUtil.EncryptSOAPEnvelope(msg, prop); crypt.EncryptUtil.SignSOAPEnvelope(msg, prop); } else { // if it is incooming decode and check signature. crypt.EncryptUtil.CheckSignatureAndDecode(msg, this , prop); } } catch (Exception ex) { ex.printStackTrace(); throw new RuntimeException(ex.getMessage()); } return true; } public boolean handleFault(SOAPMessageContext context) { System.out.println("Se…
tagged with: ssl
type: Question
upvote count: 2
tagged with: soaphandler
downvote count: 0
tagged with: keystore
favorite count: 0
answer count: 0

http://stackoverflow.com/a/25119290
has comment: http://stackoverflow.com/comment/39094294
type: Answer
answers question: http://stackoverflow.com/q/25118993
downvote count: 2
score: -2
upvote count: 0
has body: Try this something like this. Here Target is important attribute to be noticed. The console appender has one param element defined. Looking at the javadoc for ConsoleAppender , the setTarget method is used to choose which console stream to print messages to, System.out or System.err. The example configures the appender to use System.out. &lt;log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"&gt; &lt;appender name="console" class="org.apache.log4j.ConsoleAppender"&gt; &lt;param name="Target" value="System.out"/&gt; &lt;layout class="org.apache.log4j.PatternLayout"&gt; &lt;param name="ConversionPattern" value="%-5p %c{1} - %m%n"/&gt; &lt;/layout&gt; &lt;/appender&gt; &lt;root&gt; &lt;priority value ="debug" /&gt; &lt;appender-ref ref="console" /&gt; &lt;/root&gt; &lt;/log4j:configuration&gt;

http://stackoverflow.com/comment/39322859
has text: @SergeBallesta Thanks a lot mate... Was able to remove the error.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25183297
score: 0

http://stackoverflow.com/comment/39200535
has text: @mikez You made picture clear
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25175886

http://stackoverflow.com/q/25096737
has body: Working on a google cloud storage projectm, I am trying to caclculate the Crc32c value and get the base64 encoding of the long value return by crc32c algorithm. To calculate crc32c I'm using https://github.com/GoogleCloudPlatform/crc32c-java/blob/master/src/com/google/cloud/Crc32c.java Crc32c crc32c = new Crc32c(); crc32c.update(byteSource.read(), 0, byteArrayLength); long crcValue = crc32c.getValue(); byte[] bArray = String.valueOf(crcValue).getBytes(); String mEncodedCrc = BaseEncoding.base64().encode(bArray); // GCSReturnedCrc is the encoded string returned by google cloud storage assertEquals(GCSReturnedCrc, mEncodedCrc); // Results java.lang.AssertionError: expected [MjY0MDc0ODQwNQ==] but found [nWafdQ==]` Other related links: https://developers.google.com/storage/docs/hashes-etags#_JSONAPI
accepted answer: http://stackoverflow.com/a/25111119
downvote count: 0
has answer: http://stackoverflow.com/a/25144946
answer count: 3
possible better answer: http://stackoverflow.com/a/25144946
has answer: http://stackoverflow.com/a/25099204
favorite count: 0
tagged with: crc32
has title: Base64 encoding of Crc32c (long) value
has answer: http://stackoverflow.com/a/25111119
upvote count: 1
type: AnsweredQuestion
tagged with: guava
score: 1
tagged with: java
tagged with: base64
tagged with: google-cloud-storage
type: Question

http://stackoverflow.com/comment/39285306
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25221596
has text: By the way, when you ask "any ideas on how else I can do it" ... do _what_?
score: 0

http://stackoverflow.com/comment/39104173
type: QuestionComment
score: 1
has text: @pavel: i remember reading the original question as if this happened without multiple threads. This is why everyone asks for the comparator. Reading the edited version it seems as if this is just "normal" concurrent modification.
type: Comment
comment on: http://stackoverflow.com/q/25113987

http://stackoverflow.com/comment/39182545
score: 0
type: QuestionComment
has text: It would definitely be a workaround, sorry I don't know if there is a formal "java-ish" method as currently most of my exposure to Java is actually on Android where the runtime details are quite different.
comment on: http://stackoverflow.com/q/25165537
type: Comment

http://stackoverflow.com/a/25230262
has body: You should only make Spring aware of those classes that need to be wired together making use of dependency injection and those that are required for configurational aspects. Always ask yourself why should Spring need to know about the concrete class you are currently focusing on. For example like this: Controller ... to route incoming requests to the correct class and method Service ... to be injected into other services or controllers Configuration ... to be used to set up the Spring application context Repository ... to be injected into services.
accepted answer of: http://stackoverflow.com/q/25230038
upvote count: 2
answers question: http://stackoverflow.com/q/25230038
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/25229428
tagged with: gql
has body: Hello sir I am trying to get data from datastore of google app engine. I am executing following query to get data in descending order using app engine endpoint method. Query highScorer = mgr.createQuery("select from CheckIn as CheckIn ORDER BY CheckIn.score DESC LIMIT 1"); Actually above query should give only one result but I am getting all entity in descending order. How to query for only one result.? Is there any thing wrong I am doing in Query? Thanks Please let me know if i have to provide more information.
answer count: 1
has answer: http://stackoverflow.com/a/25246857
tagged with: google-app-engine
tagged with: android
has title: how to limit the results from datastore of google app engine.?
accepted answer: http://stackoverflow.com/a/25246857
type: AnsweredQuestion
score: 0
type: Question
tagged with: java

http://stackoverflow.com/comment/39073466
score: 0
type: QuestionComment
type: Comment
has text: `(text = getConfig().getString("flatrav.zprava.prikaz")).length()` appears to be causing the NPE, please make sure your `config.yml` file has a value associated with that key.
comment on: http://stackoverflow.com/q/25108040

http://stackoverflow.com/comment/39127916
has text: @HishamMuneer: Do you mind trying the new code snippet with out references to `javax.xml.bind.DatatypeConverter` but `android.util.Base64`?
comment on: http://stackoverflow.com/a/25123606
type: AnswerComment
score: 0
type: Comment

rule
tags question: http://stackoverflow.com/q/25092093
type: Tag
tag name: rule

http://stackoverflow.com/q/25125130
score: 0
tagged with: treeview
has comment: http://stackoverflow.com/comment/39108109
type: Question
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39127083
has title: Load a form inside eclipse tableviewer
tagged with: eclipse-plugin
tagged with: eclipse-rcp
type: UnansweredQuestion
has body: I have been trying to implement to below table in eclipse RCP application using TableViewer, where if user click on any row it will load another form and display it right below to the row ,exactly same as below UI. Is it possible to tweak the eclipse tableviewer and display another form just like the above UI ? It looks like eclipse tableviewer work in accordance with the cell, so it has some limitation for displaying above UI. Please help me, i am new to the eclipse RCP application.
answer count: 0

http://stackoverflow.com/comment/39295729
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25216191
has text: Sorry for delay in response. Your code looks to be correct. Will it be possible to turn on the show_sql property to see the actual query fired in the find method and whether the new message got satisfies the criteria given in find and also log the result of find to make sure it is returning only one record. Sorry for not being able to help out much here. Please do let us know just in case if you found a fix.
score: 0

http://stackoverflow.com/comment/39218088
has text: Hadoop is a distributed one , so suppose you run this on a 500 node cluster , the namenode randomly runs on some datanode. So i would prefer using namenode or edgenode as the place to create the file
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25184680
score: 0

http://stackoverflow.com/comment/39206284
type: QuestionComment
comment on: http://stackoverflow.com/q/25179806
has text: In your JS code you are just creating url variable, but you are not submitting it. You can try with `window.location = url`, as here url is your url variable.
score: 0
type: Comment

http://stackoverflow.com/q/25139713
has title: Service discovery failed - sending/receiving data through Bluetooth
linked to: http://stackoverflow.com/q/23922865
type: UnansweredQuestion
has body: I would like to send and receive some data through Bluetooth. I followed this post: Bluetooth Sending and Receiving Text Data My MainActivity.java: package com.example.proba2x8; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Set; import java.util.UUID; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends Activity { BluetoothAdapter mBluetoothAdapter; BluetoothSocket mmSocket; BluetoothDevice mmDevice; OutputStream mmOutputStream; InputStream mmInputStream; Thread workerThread; EditText myTextbox; TextView myLabel; byte[] readBuffer; int readBufferPosition; int counter; volatile boolean stopWorker; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try { Button sendButton = (Button) findViewById(R.id.send); Button openButton = (Button) findViewById(R.id.open); myTextbox = (EditText) findViewById(R.id.editText); myLabel = (TextView) findViewById(R.id.textView); openButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { findBT(); openBT(); } catch (IOException ex) { } } }); // send data typed by the user to be printed sendButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { sendData(); } catch (IOException ex) { } } }); } catch (NullPointerException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } // This will find a bluetooth device void findBT() { try { mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (mBluetoothAdapt…
has comment: http://stackoverflow.com/comment/39155858
tagged with: java
has comment: http://stackoverflow.com/comment/39161354
type: Question
has comment: http://stackoverflow.com/comment/39132402
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25156465
tagged with: bluetooth
has comment: http://stackoverflow.com/comment/39134801
tagged with: android-bluetooth
tagged with: service-discovery
tagged with: android

http://stackoverflow.com/comment/39225694
score: 0
has text: ....and save it in a static field if you're sure it will be used by a single thread.
type: AnswerComment
comment on: http://stackoverflow.com/a/25189831
type: Comment

http://stackoverflow.com/a/25212929
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25196092
has comment: http://stackoverflow.com/comment/40551424
score: 0
has comment: http://stackoverflow.com/comment/40551409
has comment: http://stackoverflow.com/comment/40289715
answers question: http://stackoverflow.com/q/25196092
has body: ejb 3.1 spec By default, if a TransactionAttribute annotation is not specified for a method of an enterprise bean with container-managed transaction demarcation, the value of the transaction attribute for the method is defined to be REQUIRED persistence 2.0 spec Propagation of persistence contexts only applies within a local environment. Persistence contexts are not propagated to remote tiers. You see what you see because persistence context is not propagated to remote tiers and default value for TransactionAttribute is REQUIRED.
type: Answer

http://stackoverflow.com/q/25218630
accepted answer: http://stackoverflow.com/a/25225015
has answer: http://stackoverflow.com/a/25219034
tagged with: java
has answer: http://stackoverflow.com/a/25220969
type: Question
has answer: http://stackoverflow.com/a/25225015
has body: I have a table in google app engine datastore as ItemDatawith columns as below. item_no, letter, f_no, s_no, t_no I need to get the max value in item_no column. How can I achieve this?
score: 0
answer count: 3
upvote count: 1
tagged with: google-cloud-datastore
tagged with: max
downvote count: 1
favorite count: 0
tagged with: google-app-engine
has title: Find the max value in a column of app engine datastore
possible better answer: http://stackoverflow.com/a/25220969
has comment: http://stackoverflow.com/comment/39283554
type: AnsweredQuestion

http://stackoverflow.com/a/41651410
downvote count: 0
upvote count: 3
answers question: http://stackoverflow.com/q/25222811
type: Answer
score: 3
has body: I have eclipse JRE 8.112 , not sure if that matters but what i did was this: Right clicked on my projects folder went down to properties and clicked clicked on the java build path folder once inside, I was in the order and export I checked the JRE System Library [jre1.8.0_112] then moved it up above the one other JRE system library there (not sure if this mattered) then pressed ok This solved my problem.

http://stackoverflow.com/q/25162605
has body: I have following in the XML 1. tag : Signature in this is in the PKCS#7 format, This is an international standard. The signature includes the Signer's public key certificate as part of the PKCS#7 bag, along with the encrypted hash of data. 2. tag: Original Data is in this tag. I don't understand how to verify the signature. Client said that "Any API / tool that can read the PKCS#7 Signature can give you the Public Key." The examples which I saw require public key separately to verify the signature. Is it even possible that required public key float with signature and some tool will automatically identify it and verify the data? If yes, I am not able to find any java API which will verify this signature.
type: AnsweredQuestion
tagged with: pkcs#7
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25164172
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/25164172
has title: Signature Verification (formate is PKCS#7)
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/3166159
score: 0

http://stackoverflow.com/a/25096140
has comment: http://stackoverflow.com/comment/39141836
score: 0
answers question: http://stackoverflow.com/q/25094873
has body: 1 Check the Spring reference documentation, you are using the old Spring style (verbose) to get access to an object through a JSP file. you have the following: change from &lt;spring:bind path="Brand"&gt; to &lt;spring:bind path="brand"&gt;
has comment: http://stackoverflow.com/comment/39067661
has comment: http://stackoverflow.com/comment/39066323
type: Answer
has comment: http://stackoverflow.com/comment/39352957
has comment: http://stackoverflow.com/comment/39104156
has comment: http://stackoverflow.com/comment/39113371
has comment: http://stackoverflow.com/comment/39200285
has comment: http://stackoverflow.com/comment/39137767
has comment: http://stackoverflow.com/comment/39997792

http://stackoverflow.com/a/25210384
has comment: http://stackoverflow.com/comment/39266598
answers question: http://stackoverflow.com/q/25210317
has comment: http://stackoverflow.com/comment/39266748
has comment: http://stackoverflow.com/comment/39264392
downvote count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/39264478
type: Answer
has body: Put the try...catch in the method defintion: public void eatBacon(){ try{ // some nasty code here to cause an exception } catch(Exception e){ //do something } } This won't look as bad as putting it when you call the method. If you know where exactly in the code the exception could be happening, then only surround those statements.
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25210317
has comment: http://stackoverflow.com/comment/39263992

http://stackoverflow.com/q/25163713
tagged with: conditional-operator
upvote count: 40
answer count: 4
score: 39
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25164343
has comment: http://stackoverflow.com/comment/39178257
has answer: http://stackoverflow.com/a/25164185
has body: Is it possible to change this: if (string != null) { callFunction(parameters); } else { // Intentionally left blank } to a ternary operator?
favorite count: 0
has answer: http://stackoverflow.com/a/25163791
has comment: http://stackoverflow.com/comment/39176904
type: Question
has comment: http://stackoverflow.com/comment/39176895
has comment: http://stackoverflow.com/comment/39176981
has title: Ternary Operator
tagged with: java
linked to: http://stackoverflow.com/q/21219695
downvote count: 1
has answer: http://stackoverflow.com/a/25164367

http://stackoverflow.com/comment/39011871
score: 0
type: Comment
type: QuestionComment
has text: probably you can use regex. Then, you will get all the results that match the pattern. that would be more better approach i guess
comment on: http://stackoverflow.com/q/25075281

http://stackoverflow.com/comment/39219880
comment on: http://stackoverflow.com/q/25187040
has text: You're only declaring `balUser` in the first `if` statement - it's not in scope for the second.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/39519210
score: 0
comment on: http://stackoverflow.com/a/25101604
type: AnswerComment
has text: I have not used AndroidUnusedResources.jar; however, it seems like `**AndroidUnusedResources.jar** reduces size of apk, it **shrinks** our code **by removing unused code**. The result is a smaller sized .apk file that does not have unneeded library code.`
type: Comment

http://stackoverflow.com/comment/39018772
has text: @ Smutje I will have a look at those, thanks! @ Eel Lee I was trying to use the split function but it didn't seem to be the right approach from what I tried, was looking for a point in the right basically. @ TheLostMind It will be formatted consistently but if formatting it differently makes it easier then it's not hard to change the file ie no quotations around the name etc
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25078949

http://stackoverflow.com/a/25165484
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25164868
upvote count: 1
has body: Essentially no - you cannot get away from using two maps, concurrent or otherwise, because you are working with two different types of key (unless you decide to use Map&lt;Object,Object&gt; which would be criminal). But - you can hide the complexity: public interface BiMap&lt;P, Q&gt; { public Q putQ(P key, Q value); public Q getQ(P key); public P putP(P key, Q value); public P getP(Q key); } Now wrap your two maps in one of those and things look tidier, they just aren't tidy inside. This should work: public class BiMap&lt;P, Q&gt; { final Map&lt;P, Q&gt; pq; final Map&lt;Q, P&gt; qp; public BiMap(MapFactory maker) { pq = maker.&lt;P, Q&gt;make(); qp = maker.&lt;Q, P&gt;make(); } public BiMap() { // Default to ConcurrentHashMap this(MapFactory.ConcurrentHashMap); } public Q putQ(P key, Q value) { return pq.put(key, value); } public Q getQ(P key) { return pq.get(key); } public P putP(Q key, P value) { return qp.put(key, value); } public P getP(Q key) { return qp.get(key); } // Puts both at once. public synchronized void put(P p, Q q) { putQ(p, q); putP(q, p); } public enum MapFactory { ConcurrentHashMap { @Override &lt;P, Q&gt; Map&lt;P, Q&gt; make() { return new java.util.concurrent.ConcurrentHashMap&lt;P,Q&gt;(); } }; abstract &lt;P, Q&gt; Map&lt;P, Q&gt; make(); } }

http://stackoverflow.com/q/25195319
score: 1
has answer: http://stackoverflow.com/a/25896492
tagged with: java
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/25195329
has body: I am looking for a data structure where I need to store values and then to retrieve it based on key.But in my case my key and value will be same, so I can't use HashMap. HashSet is also not useful because in that case I need to do a sequential searching to find my key. so here is the example of what I am looking: class A{ int x; int y; int z; equals(){ //equals is overridden based only on int x and int y; and not on z. } } Class B{ Map&lt;A,z&gt;mapA = new HasMap&lt;&gt;(A,z); - option 1 , not useful. //store values in mapA. my z is dummy, in fact I need only class A object on some condition match. fun(object k){ if(mapA.containsValue(k)) { /*here I need to get class object A if it matches with "k". There is no function available in map to get the key if it matches key. Also if I use HashSet, in that case I need to retrieve the value by iterating over the set which is not preferable. I wanted to achieve this search in O(1) or O(logn) */ } } } Any suggestions will be highly appreciated. Edit1: Hashset only tells whether key is present in collection or not ? it doesn't give me the key. To get Key I have to iterate through the collection.Please correct me if I am wrong.
tagged with: data-structures
has comment: http://stackoverflow.com/comment/39236213
has title: need to find out "key" in data structure in java
answer count: 2
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39235537
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39235551
downvote count: 0

http://stackoverflow.com/q/25225421
has comment: http://stackoverflow.com/comment/39303128
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39294537
tagged with: excel
tagged with: apache-poi
answer count: 0
tagged with: java
type: Question
has body: In the example below how to add the formula in individual user totals as the number of rows for the user can vary. +------+--------------+---------+--------------+-------+ | Name | Date | Billable| Non-Billable | Total | +------+--------------+---------+--------------+-------+ | abc | 06/23/2012 | 860 | 10 | 870 | | | User Totals: | 860 | 10 | 870 | | xyz | 07/12/2012 | 45 | 0 | 45 | | | User Totals: | 45 | 0 | 45 | | ccc | 09/19/2013 | 165 | 35 | 200 | | | 10/15/2013 | 240 | 0 | 240 | | | User Totals: | 405 | 35 | 440 | | | Grand Totals | 1310| 45 | 1355 | +------+--------------+---------+--------------+-------+
score: 0
has title: Generate Excel having Formula using Apache POI

http://stackoverflow.com/q/25127982
tagged with: maven
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25129622
tagged with: java
tagged with: integration-testing
has title: Maven running jetty on integration-test stage
type: Question
possible better answer: http://stackoverflow.com/a/25129622
answer count: 2
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/25161236
has comment: http://stackoverflow.com/comment/73296434
downvote count: 0
has body: I use failsafe plugin. So when I type mvn failsafe:integration-test it stars my integration tests (which is great). But I want my jetty server starts on pre-integration stage then. What should I do? (I don't want launch mvn verify since it involves whole cycle running, but mvn failsafe:integration-test- it seems it's supposed to work that way) There are two plugins: org.apache.maven.plugins maven-failsafe-plugin 2.16 integration-test integration-test verify verify org.eclipse.jetty jetty-maven-plugin ${jetty.version} STOP 9999 5 5 ${project.basedir}/src/main ${project.basedir}/src/test ${project.basedir}/src/test/resources/jetty-context.xml /${project.artifactId}-${project.version} start-jetty pre-integration-test run-exploded 0 true stop-jetty post-integration-test stop
favorite count: 0
accepted answer: http://stackoverflow.com/a/25161236
tagged with: maven-failsafe-plugin
tagged with: jetty

http://stackoverflow.com/q/25180718
downvote count: 0
favorite count: 0
score: 2
type: AnsweredQuestion
has body: I have some parameterized test with Spock, and it's 10 cases which coming to test in where block. So, I decide to use @Unroll annotation so when some of the 10 cases fail, I will understand which one. So I add to feature placeholder with message about what kind of case it is, let's say it's "Test with #message case"(String message, etc..){...}. If I'll try to launch it in IDEA, output is looks like expected. (in the left side of the window where tree of tests is opened) Test with SomeIterationMessage case: failed Test with AnotherIterationMessage case: failed But console IDEA output is looks like: Condition not satisfied: resultList.size() == expectedSize | | | | [] 0 | 1 false &lt;Click to see difference&gt; at transformer.NameOfSpec.Contract. Test with #message case (NameOfSpec.groovy:220) If I launch building the project by Maven through command line and this tests failed I just get messages like in IDEA Console output. So it's absolutely useless and like in the IDEA Console output. Test with #message case: failed Test with #message case: failed So it does not replace placeholders with particular iteration data to get info about which iteration was crushed. How to figure it out so the IDEA console output and the Maven outputs get it right? 'Cause if it impossible, this @Unroll annotation really piece of nothing. 'Cause in IDE test can pass with no problem, but in a big project with tons of dependencies it can crush when you build it, and you will never get why and which iteration failed cause output is telling you nothing.
tagged with: maven
has answer: http://stackoverflow.com/a/25184227
type: Question
accepted answer: http://stackoverflow.com/a/25184227
tagged with: spock
tagged with: java
has title: Spock and Maven. Tests with @Unroll failed with errors but placeholders is not filled with iteration data in Maven output
upvote count: 2
tagged with: groovy
answer count: 1

http://stackoverflow.com/q/25205883
has comment: http://stackoverflow.com/comment/39255228
tagged with: jpanel
has comment: http://stackoverflow.com/comment/39255262
type: Question
linked to: http://stackoverflow.com/q/7229226
answer count: 1
tagged with: user-interface
downvote count: 0
has comment: http://stackoverflow.com/comment/39255295
has answer: http://stackoverflow.com/a/25205942
favorite count: 0
upvote count: 2
tagged with: jframe
has body: I am creating a Java application which has a login screen. Right now I am designing the login screen. I use a Panel in a JFrame, which is positioned at BorderLayout.CENTER, and then set the layout of the Panel as GridLayout(3,1). Right now my application looks like this: I want to design my JFrame like this: Here the grey portion is the JFrame and the red portion is the Panel which has the login screen, TextField's and Button's. I don't want the TextField and Button's on the entire screen. This is what I did right now public class MailClient { JFrame loginScreen; JTextField emailid; JPasswordField password; JButton login; Dimension loginScreenSize; JPanel entireLogin; BorderLayout mainLayout; public static void main (String args[]) { MailClient obj = new MailClient(); obj.build(); } public void build() { mainLayout = new BorderLayout(40, 40); loginScreenSize = new Dimension(300,300); loginScreen = new JFrame("MailClient"); loginScreen.setSize(loginScreenSize); loginScreen.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); loginScreen.setResizable(false); loginScreen.setLocationRelativeTo(null); loginScreen.setLayout(mainLayout); entireLogin = new JPanel(); entireLogin.setLayout(new GridLayout(3,1)); emailid = new JTextField(); password = new JPasswordField(); login = new JButton("LOGIN"); entireLogin.add(emailid); entireLogin.add(password); entireLogin.add(login); loginScreen.add(entireLogin, BorderLayout.CENTER); loginScreen.setVisible(true); } }
has title: JPanel consuming entire JFrame
tagged with: swing
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25205942
has comment: http://stackoverflow.com/comment/39255762
tagged with: java

http://stackoverflow.com/q/25156904
accepted answer: http://stackoverflow.com/a/25158905
has comment: http://stackoverflow.com/comment/39165730
has comment: http://stackoverflow.com/comment/39164244
has comment: http://stackoverflow.com/comment/39165136
tagged with: sockets
has answer: http://stackoverflow.com/a/25158905
has comment: http://stackoverflow.com/comment/39164529
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39164553
has comment: http://stackoverflow.com/comment/39164285
tagged with: java
linked to: http://stackoverflow.com/q/3834468
type: Question
has comment: http://stackoverflow.com/comment/39164790
has body: My Socket client is written in C and sends the values in the format below: x00\x2C\x02\x00\xE0\x00 Now I would like to read the hex values from the TCP/IP socket server which is written in Java. What should be a approach to read the stream values in Java Socket? I'm trying to read in the following way, but it does not work: InputStream ins = sock.getInputStream(); int byteRead; while((byteRead = ins.read()) != -1) { System.out.println(Integer.toHexString(byteRead &amp; 0xFF)); }
tagged with: http://stackoverflow.com/tag/c
possible better answer: http://stackoverflow.com/a/25158613
has answer: http://stackoverflow.com/a/25158613
has title: Trouble receiving data to C socket client from Java socket server
score: 0
answer count: 2

http://stackoverflow.com/comment/39045317
comment on: http://stackoverflow.com/a/25092494
type: AnswerComment
type: Comment
score: 1
has text: Read the note at the bottom :)

http://stackoverflow.com/q/25117728
downvote count: 0
favorite count: 0
type: Question
has title: UnfoldingMaps doesn't refresh in JPanel
score: 1
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/25117819
answer count: 1
tagged with: processing
tagged with: java
has body: For a application I'm developing, I make use of the UnfoldingMaps library for displaying a map. The map is placed inside a JPanel. In the same JPanel other Jpanels are showed. So I change between the map and other panels with the help of buttons. The problem is that the map doesn't refresh. I can display it once and when I've displayed another Panel, and go back to the map, the map won't display. The only option I got then is to restart the application. private void showVis(String chart) { //visual is the JPanel where elements are viewed in visual.removeAll(); if (chart.equals("bar")) { bar.setPart("", partial, location); bar.createVisualisation(ai); if (bar.checkGraph()) { System.out.println("Really creating bar"); ChartPanel panB = bar.getPanel(); JPopupMenu popB = panB.getPopupMenu(); panB.setPopupMenu(popB); visual.add(panB); visual.validate(); } } else if (chart.equals("map")) { map = null; map = new Maps(); map.setPart("", partial, location); map.createVisualisation(ai); if (map.checkGraph()) { map.init(); visual.add(map); visual.validate(); } } the string chart decides which panel will be showed.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25117819

http://stackoverflow.com/a/25140314
has comment: http://stackoverflow.com/comment/39138239
has comment: http://stackoverflow.com/comment/39137478
upvote count: 1
has comment: http://stackoverflow.com/comment/39136847
answers question: http://stackoverflow.com/q/25140010
accepted answer of: http://stackoverflow.com/q/25140010
has comment: http://stackoverflow.com/comment/101212398
type: AcceptedAnswer
downvote count: 0
score: 1
has body: your piece of code works fine when using org.json-20120521.jar. I think there is something wrong with the jar you are using.
type: Answer
has comment: http://stackoverflow.com/comment/88263964

http://stackoverflow.com/a/25192617
downvote count: 0
has body: Try using: (?&lt;=\/)[A-Za-z0-9-]+
type: Answer
accepted answer of: http://stackoverflow.com/q/25192324
score: 2
answers question: http://stackoverflow.com/q/25192324
upvote count: 2
has comment: http://stackoverflow.com/comment/39231495
type: AcceptedAnswer

http://stackoverflow.com/comment/39283752
score: 0
comment on: http://stackoverflow.com/q/25206185
type: QuestionComment
type: Comment
has text: Your sample compiles in Java 8 which has better type inference.

http://stackoverflow.com/a/25123063
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39101485
upvote count: 6
has comment: http://stackoverflow.com/comment/39101744
accepted answer of: http://stackoverflow.com/q/25123002
score: 6
answers question: http://stackoverflow.com/q/25123002
has body: You don't want to do this. This totally destroys the purpose of using an AsyncTask- it will halt the original thread until the task is done, preventing it from doing other things. If you wanted to do that, you'd be better off without the task. Instead, you should put the code you want to execute after the task is done in the onPostExecute method of the AsyncTask.

http://stackoverflow.com/comment/39235109
has text: Is the text mixed content like that or is wrapped in a parent tag?
comment on: http://stackoverflow.com/q/25195086
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25069724
upvote count: 2
has body: No, it really wouldn't make any sense because generics in Java only exist at compile-time, so unless you know something about c at that point, there's no advantage to be had by casting your Bar to a generic type.
answers question: http://stackoverflow.com/q/25069671
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/39170735
has text: Is this [post](http://stackoverflow.com/questions/22269623/retrieve-init-parameters-outside-servlet/22270264#22270264) not helpful for you in this case?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25160151

http://stackoverflow.com/a/25073230
type: AcceptedAnswer
downvote count: 0
has body: There could be any number of reasons why this doesn't work for you, for starters, the button may be transparent (opaque == false) I would strongly recommend against KeyListener in favour of Key Bindings as KeyListener has issues with focus... For example... The following uses the key bindings API in order to respond to a given key stroke, depending on if it's a key press or release event, it will set the background color and opacity state accordingly and even sets the buttons pressed state... import java.awt.BorderLayout; import java.awt.Color; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class KeyboardTest { public static void main(String[] args) { new KeyboardTest(); } public KeyboardTest() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { public TestPane() { JButton btnA = createButton("A"); JButton btnB = createButton("B"); JButton btnC = createButton("C"); JButton btnD = createButton("D"); JButton btnE = createButton("E"); add(btnA); add(btnB); add(btnC); add(btnD); add(btnE); addKeyBinding(btnA, "A", KeyEvent.VK_A); addKeyBinding(btnB, "B", KeyEvent.VK_B); addKeyBinding(btnC, "C", KeyEvent.VK_C); addKeyBinding(btnD, "D", KeyEvent.VK_D…
answers question: http://stackoverflow.com/q/25073094
type: Answer
accepted answer of: http://stackoverflow.com/q/25073094
upvote count: 3
has comment: http://stackoverflow.com/comment/39008362
score: 3
has comment: http://stackoverflow.com/comment/39008301
has comment: http://stackoverflow.com/comment/39008342
has comment: http://stackoverflow.com/comment/39008321

http://stackoverflow.com/q/25073093
has answer: http://stackoverflow.com/a/25073281
has title: Unsupported Operation exception in java
type: UnansweredQuestion
has body: I am getting the exception java.lang.UnsupportedOperationException: Not supported yet Code is private static void mode(int i) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } private static void quality(int i) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } private static void complexity(int i) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } private static void sampleRate(int i) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } public static void main(final String[] args) { mode(0); quality(1); complexity(1); sampleRate(8000); JSpeexEnc encoder = new JSpeexEnc(); if (encoder.parseArgs(args, FILE_FORMAT_WAVE)) { encoder.encode(); } Please tell me why this exception is coming...
has comment: http://stackoverflow.com/comment/39007984
has comment: http://stackoverflow.com/comment/39008034
has comment: http://stackoverflow.com/comment/39008086
has comment: http://stackoverflow.com/comment/39007959
has answer: http://stackoverflow.com/a/25073208
favorite count: 0
has answer: http://stackoverflow.com/a/25073186
type: Question
downvote count: 2
score: -2
has comment: http://stackoverflow.com/comment/39008072
has comment: http://stackoverflow.com/comment/39008019
has comment: http://stackoverflow.com/comment/39008064
has comment: http://stackoverflow.com/comment/39008010
has comment: http://stackoverflow.com/comment/39007991
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/39007985
upvote count: 0

http://stackoverflow.com/q/25221948
tagged with: java
tagged with: multithreading
has title: using thread in android
type: Question
has answer: http://stackoverflow.com/a/25222060
has answer: http://stackoverflow.com/a/25221991
score: 0
has body: I have a database in my application and I want to retrieve some information from database. I use this code ( this code works correctly ) but I want to write these code via Thread. How can I change my code? public StructNameImage Open_Tbl_Plants(Context context_t, final String SQL_CODE) { Is_Exist_Database(); open(); cursor = mydb.rawQuery(SQL_CODE, null); StructNameImage ni = new StructNameImage(); while (cursor.moveToNext()) { ni.Str_NameFa.add(cursor.getString(cursor.getColumnIndex("Name"))); ni.Str_Image.add(cursor.getString(cursor.getColumnIndex("Image"))); } cursor.close(); return ni; }
answer count: 2
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/25137555
has answer: http://stackoverflow.com/a/25137597
has comment: http://stackoverflow.com/comment/39127861
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39128155
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: How to get part of httpResponse in java
has comment: http://stackoverflow.com/comment/39127920
has body: I want to get just ID from httpResponse after I did HttpGet. This is my code: HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet("http://localhost:80/api/"); HttpResponse httpResponse = httpClient.execute(httpGet); System.out.println(httpResponse); BufferedReader rd = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent())); String line = ""; while ((line = rd.readLine()) != null) { System.out.println(line); } which returns this: {"list":[{"timestamp":{"$date":"2014-08-01T08:37:54.058Z"},"nameGroup":false,"_id":{"$oid":"53db5045ccf2b2399e0e6128"},"created":{"$date":"2014-08-01T08:31:01.139Z"}],"name":"John"}]} But I just want Oid not the whole thing. Any idea? Thanks
type: Question
linked to: http://stackoverflow.com/q/2591098
has answer: http://stackoverflow.com/a/25137685
has comment: http://stackoverflow.com/comment/39128220
score: 0
has answer: http://stackoverflow.com/a/25137623
answer count: 3

http://stackoverflow.com/q/25196092
has answer: http://stackoverflow.com/a/25212929
accepted answer: http://stackoverflow.com/a/25212929
has comment: http://stackoverflow.com/comment/39260573
tagged with: transactions
has comment: http://stackoverflow.com/comment/39261113
tagged with: java
has comment: http://stackoverflow.com/comment/39262369
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/39260676
tagged with: ejb
has comment: http://stackoverflow.com/comment/39261131
has title: Same WAR file, Same Package, EJB call EJB using remote interface
has body: It is a bit weird to ask this, I just faced an application in development which make extensive use of @EJB Remote to @EJB Remote on the Same Package. I know is a very bad approach since you have a transaction and you do the rest possibly with CDI and managed entities around and if necessary Local EJB with requires new. On this Application I have seen EclipseLink ConcurrencyManager Exceptions locks, Huge RMI IIOP stacks while Lazy Loading. and other gray behaviours. (this Remote EJB do not pass entities but only pointers to @Id between them, then use EntityManager.find , EntityManager.merge and Occasionally EntityManager.refresh) I couldn't find any answer (may me i was not careful enough) around the web and neither in the EJB specs. You have 2 Implementation @Stateless EImpl1 and @Stateless EImpl2 each of them implements @Remote E1 and @Remote E2. on EImpl1 you @EJB E2. does E2 react like TransactionAttributeType.REQUIRES_NEW ? I would bet on a Yes, but i am not sure, if someone can explain me,.. i would be thankfull Thanks a Lot for your help.
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39237601
linked to: http://stackoverflow.com/q/4136852
has comment: http://stackoverflow.com/comment/39238764
type: AnsweredQuestion

http://stackoverflow.com/q/25203821
type: Question
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25204477
has body: Let's say I have the following log4j.properties: # Root logger option log4j.rootLogger=INFO, stdout # Direct normal log messages to stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p %c{1}:%L - %m%n # Application logs log4j.logger.com.company.app=DEBUG, file log4j.additivity.com.company.app=false log4j.logger.com.company.app.sub=TRACE, file log4j.additivity.com.company.app.sub=false # Direct application log messages to a custom log file log4j.appender.file=org.apache.log4j.DailyRollingFileAppender log4j.appender.file.File=${com.sun.aas.instanceRoot}/logs/app.log log4j.appender.file.DatePattern='.'yyyy-MM-dd-a log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p %c{1}:%L - %m%n So I want to log messages that don't come from my app to console, messages that I create in my own log and have a different level for messages of my subpackage. When I try it like this I get messages for my subpackage twice, even with additivity set to false. What I'm trying to achieve is log all messages from my application exactly once (not to the main log, but to my own file), but to be able to set different levels for subpackages. I'm using log4j v 1.2 and SLF4J as a front.
upvote count: 3
answer count: 1
has title: Log4j: Different log levels for subpackages
has answer: http://stackoverflow.com/a/25204477
tagged with: log4j
favorite count: 0
type: AnsweredQuestion
downvote count: 0
tagged with: logging

http://stackoverflow.com/q/25114261
has title: Best method to count byte codes executed for a Java code
has comment: http://stackoverflow.com/comment/39086766
has comment: http://stackoverflow.com/comment/39085089
has comment: http://stackoverflow.com/comment/39085277
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25114512
has body: I was trying to get timing data for various Java programs. Then I had to perform some regression analysis based on this timing data. Here are the two methods I used to get the timing data: System.currentTimeMillis(): I used this initially, but I wanted the timing data to be constant when the same program was run multiple times. The variation was huge in this case. When two instances of the same code were executed in parallel, the variation was even more. So I dropped this and started looking for some profilers. -XX countBytecodes Flag in Hotspot JVM: Since the variation in timing data was huge, I thought of measuring the number of byte codes executed, when this code was executed. This should have given a more static count, when the same program was executed multiple times. But This also had variations. When the programs were executed sequentially, the variations were small, but during parellel runs of the same code, the variations were huge. I also tried compiling using -Xint, but the results were similar. So I am looking for some profiler that could give me the count of byte codes executed when a code is executed. The count should remain constant (or correlation close to 1) across runs of the same program. Or if there could be some other metric based on which I could get timing data, which should stay almost constant across multiple runs.
has comment: http://stackoverflow.com/comment/39084946
has comment: http://stackoverflow.com/comment/39085216
tagged with: performance
tagged with: java
score: 4
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/39085309
answer count: 1
downvote count: 0
tagged with: jprofiler
tagged with: jvm
tagged with: profiler
favorite count: 0
has comment: http://stackoverflow.com/comment/39085054

http://stackoverflow.com/comment/39020142
comment on: http://stackoverflow.com/a/25079539
type: AnswerComment
score: 0
type: Comment
has text: No, It did not solve the problem : application1.jar is kept in Referenced Libraries folder of application 2.

http://stackoverflow.com/q/25115218
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39086844
upvote count: 0
has answer: http://stackoverflow.com/a/25115268
accepted answer: http://stackoverflow.com/a/25115818
favorite count: 0
has title: Writing more than one String to a file without deleting the first one. I am making favorites for a browser
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39086686
tagged with: android
tagged with: java
has body: I am making a simple browser for school and I am trying to make the favorites. This code here adds a favorite to a file(so I can keep it after the app is closed) and displays it in the TextView. My problem is that it can only save one. If i add the second one, the first one is replaced. I thought i could add them in an array or arrayList(or anything that works, i am open to suggestions), but i can't succeed. Please try to be explicit because I am kind of a beginner. Thank you. package com.example.browser3; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class Favorite extends Activity { EditText etName; EditText etAdress; Button bAdd; TextView tvDisplay; protected void onResume() { readFile("favorite.txt", tvDisplay); super.onResume(); } public void writeFile(String fileName, EditText v, EditText x){ try { OutputStreamWriter out=new OutputStreamWriter(openFileOutput(fileName,0)); out.write(v.getText().toString()+ x.getText().toString()); out.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void readFile(String fileName, TextView w){ try { InputStream in=openFileInput(fileName); if(in!=null){ InputStreamReader reader= new InputStreamReader(in); BufferedReader buffreader= new BufferedReader(reader); StringBuilder builder= new StringBuilder(); String str; while((…
has answer: http://stackoverflow.com/a/25115818
linked to: http://stackoverflow.com/q/25058187
has comment: http://stackoverflow.com/comment/39086668
has comment: http://stackoverflow.com/comment/39086672
score: -4
downvote count: 4
duplicate of: http://stackoverflow.com/q/25058187
possible better answer: http://stackoverflow.com/a/25115268

http://stackoverflow.com/a/25198668
upvote count: 2
score: 0
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/39241787
has comment: http://stackoverflow.com/comment/39241719
has comment: http://stackoverflow.com/comment/39241796
has comment: http://stackoverflow.com/comment/39241763
answers question: http://stackoverflow.com/q/25198627
has body: public static int isGreater(int limit, int[] data){ int counter=0; for(int k = 0; k &lt; data.length; k++){ if (data[k] &gt; limit) counter++ } return counter; }

http://stackoverflow.com/comment/39431147
score: 0
has text: but the identifier is recursive so it can not end....it is infinite how to solve...
type: Comment
comment on: http://stackoverflow.com/a/25152814
type: AnswerComment

http://stackoverflow.com/comment/39099648
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25122162
has text: actually I think the `integer` part does compile, it refers to android.R.integer, which is a class - although probably not what the OP want.

http://stackoverflow.com/comment/39227944
score: 0
comment on: http://stackoverflow.com/q/25119798
type: Comment
type: QuestionComment
has text: Android don't have split in its java implementation

http://stackoverflow.com/q/25152731
has body: I try to transform a string into an array of byte (byte[]) and save it in a xml file. my problems are different values of the byte[] after marshal und unmarshal the object with jaxb. I´m sorry for the format of my posting! ` @XmlRootElement public class Token { private byte[] token; public void createToken(){ String stringTest = "ABCDEF"; this.token = stringTest.getBytes(Charset.forName("UTF-8")); } public byte[] getToken() { return token; } public void setToken(byte[] token) { this.token = token; } }// ENDE CLASS TOKEN @XmlRootElement(namespace = "TokenNS") public class TokenCollection { private List<byte[]> collection = new ArrayList<>(); public void addToken(byte[] tokenIn){ this.collection.add(tokenIn); } @XmlElement( name = "TokenCollection") public List<byte[]> getTokenCollection(){ return this.collection; } public void test(){ Token t = new Token(); t.createToken(); byte[] tmp = t.getToken(); this.addToken(tmp); } }// ENDE TOKENCOLLECTION STARTER: public Starter() { Path path = Paths.get("trivial.xml"); tc.test(); JAXB.marshal(tc, System.out); try (Writer out = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) { JAXB.marshal(tc, out); } catch (IOException io) { io.printStackTrace(); } } ` OUTPUT: Should be: 65 66 67 68 69 70 XML-FILE (with wrong values): <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns2:tokenCollection xmlns:ns2="TokenNS"> QUJDREVG </ns2:tokenCollection>
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/39157038
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/39157467
has comment: http://stackoverflow.com/comment/39157547
answer count: 2
has answer: http://stackoverflow.com/a/25160950
downvote count: 0
favorite count: 0
tagged with: byte
upvote count: 2
has title: JAXB write and read byte[] to xml - different values
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25153707

http://stackoverflow.com/q/25197450
downvote count: 1
tagged with: superclass
has title: Accessing a superclass arraylist in a subclass
has answer: http://stackoverflow.com/a/25197471
tagged with: java
has body: Hopefully i can describe my problem as intended: I have 2 classes; JavaApplication65(please don't question the name :D) and a subclass of JavaApplication65, Logs. Now I have an ArrayList in JavaApplication65 named temp and i want to copy its values into an Arraylist called allLogsText in Logs. How can I do it? package javaapplication65; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; /** * * @author MertKarakas */ public class JavaApplication65 { /** * @param args the command line arguments */ Logs importer = new Logs(); private String nameOfLog; private String wholeLog; static ArrayList&lt;String&gt; temp = new ArrayList&lt;String&gt;(); /** * * @param nameOfLog1 * @param wholeLog1 */ public JavaApplication65(String nameOfLog1, String wholeLog1){ this.nameOfLog = nameOfLog1; this.wholeLog = wholeLog1; } public JavaApplication65(){} public static void main(String[] args) throws FileNotFoundException{ System.out.println("Data Log V1. @author MertKarakas"); Scanner s = new Scanner(new File("/Users/mertkarakas/Desktop/Logs/LogList.txt")); while (s.hasNext()){ temp.add(s.next()); } s.close(); new Logs().menuOpt(); } } public class Logs { Scanner console = new Scanner(System.in); ArrayList&lt;JavaApplication65&gt; allLogs = new ArrayList&lt;JavaApplication65&gt;(); ArrayList&lt;String&gt; allLogsText = new ArrayList&lt;String&gt;(JavaApplication65.temp); private String name; public void Logs(){ this.name = ""; } public void menuOpt(){ System.out.println("Menu: Write a log[log], See entered logs[see] --&gt; Read an entered log[#], Delete a log[del], Read a specific log[spf]"); WriteStringToFile2(allLogsText); choices(); WriteStringToFile2(allLogsText); } public void choices(){ String input1 = console.next(); if ( input1.equalsIgnoreCase("log") ){ log(); }else if ( input1.equalsIgnoreCase("see") ){ getLogs(); System.out.println("Enter the index of requested l…
has comment: http://stackoverflow.com/comment/39239922
possible better answer: http://stackoverflow.com/a/25197626
has answer: http://stackoverflow.com/a/25197626
type: AnsweredQuestion
upvote count: 0
tagged with: inheritance
favorite count: 0
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/25197471
type: Question
tagged with: subclass
score: -1
answer count: 2

http://stackoverflow.com/q/25197160
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25197189
tagged with: java
type: Question
has body: InWhen invokeAny successfully returns, what happens to remaining threads? Does it get killed automatically? If not how can I make sure that thread is stopped and return back to threadpool ExecutorService executorService = Executors.newFixedThreadPool(10); executorService.invokeAny(callables);
has title: What happens to remaining thread of invokeAny Executor Service
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/69236699
has answer: http://stackoverflow.com/a/25197189
tagged with: executorservice
has answer: http://stackoverflow.com/a/69236699
tagged with: multithreading

http://stackoverflow.com/q/25137016
has comment: http://stackoverflow.com/comment/39127008
upvote count: 0
favorite count: 0
has title: How can I find the file size of files in a list?
has answer: http://stackoverflow.com/a/25137131
type: UnansweredQuestion
answer count: 4
has body: I have a list of files, all in random folders and would like to know how to find their files size - is there a script that I can run to go through the list to find their sizes please?
has answer: http://stackoverflow.com/a/25137134
has answer: http://stackoverflow.com/a/25137272
tagged with: java
tagged with: file
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25137093
score: -1

http://stackoverflow.com/a/25091460
type: Answer
score: 6
answers question: http://stackoverflow.com/q/25091425
upvote count: 6
has body: Break it down: i++-j ++ has higher precedence than - so that's: (i++)-j The ++ is the postfix increment — it'll evaluate to the value of i before the increment. The initial value of i is 4 so that's: 4-j j is 2 so the expression evaluates as 4-2 = 2. i has been incremented so now has the value 5; j is modified by the code in the switch statement.
has comment: http://stackoverflow.com/comment/39042598
accepted answer of: http://stackoverflow.com/q/25091425
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/77712408
type: AnswerComment
score: 0
type: Comment
has text: plus for great and straightforward answer
comment on: http://stackoverflow.com/a/35525977

http://stackoverflow.com/comment/39129424
score: 0
type: AnswerComment
type: Comment
has text: System.out.print((char)Byte.parseByte(c,2)); what does 2nd parameter says ??
comment on: http://stackoverflow.com/a/25132064

http://stackoverflow.com/a/25208291
score: 2
answers question: http://stackoverflow.com/q/25208105
downvote count: 0
has body: Maybe jawr can help you. If not, you can implement a Servlet that does it for you (reading the file and writing it to the response). If you use something like Resteasy it will be easier because you don't need to write the IO stuff.
upvote count: 2
has comment: http://stackoverflow.com/comment/39270529
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25208105

http://stackoverflow.com/q/25074586
has comment: http://stackoverflow.com/comment/39010641
type: Question
has comment: http://stackoverflow.com/comment/39010851
has comment: http://stackoverflow.com/comment/39010921
has title: How to make PreferenceActivity update faster?
has body: I have set PreferenceActivity to set IP address. After it is saved , it shows me that it is set , but when to use it , shows me " ". It uses the IP I set only after i restart my app. public class SettingsActivity extends PreferenceActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.prefs); } }
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/39010785
answer count: 0
type: UnansweredQuestion
tagged with: preferenceactivity
has comment: http://stackoverflow.com/comment/39010817
tagged with: java

http://stackoverflow.com/comment/39204897
type: Comment
has text: Is it not an option to limit the number of objects from the input collection?
comment on: http://stackoverflow.com/q/25122854
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39023189
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25081200
has text: Thank you for your answer ! but this is precisely my issue: how to define scrollUp() and scrollDown()... I have search an easy way to implement those methods but i didn't succeed
score: 0

http://stackoverflow.com/a/25175024
upvote count: 9
has comment: http://stackoverflow.com/comment/39197958
answers question: http://stackoverflow.com/q/25175001
has comment: http://stackoverflow.com/comment/39197968
score: 9
has comment: http://stackoverflow.com/comment/39198055
accepted answer of: http://stackoverflow.com/q/25175001
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39198837
has comment: http://stackoverflow.com/comment/39198042
has comment: http://stackoverflow.com/comment/39198023
type: Answer
has body: This StringBuffer sb = new StringBuffer("Welcome"); String st = sb + ""; will result more or less in StringBuffer sb = new StringBuffer("Welcome"); StringBuilder builder = new StringBuilder(); builder.append((sb == null) ? "null" : sb.toString()); builder.append(""); String st = builder.toString();
has comment: http://stackoverflow.com/comment/39198341
has comment: http://stackoverflow.com/comment/39197921
has comment: http://stackoverflow.com/comment/39197926
has comment: http://stackoverflow.com/comment/39197914
has comment: http://stackoverflow.com/comment/39198132
has comment: http://stackoverflow.com/comment/39198084
has comment: http://stackoverflow.com/comment/39198112
has comment: http://stackoverflow.com/comment/39197920
has comment: http://stackoverflow.com/comment/39198716

http://stackoverflow.com/q/25199676
answer count: 7
has comment: http://stackoverflow.com/comment/39243826
has comment: http://stackoverflow.com/comment/39243640
favorite count: 0
has answer: http://stackoverflow.com/a/25199737
tagged with: static
has title: reference an instance variable from a static method java
has answer: http://stackoverflow.com/a/65573799
tagged with: reference
has answer: http://stackoverflow.com/a/25199731
has answer: http://stackoverflow.com/a/25199768
downvote count: 0
has body: Line 1: public class C { Line 2: public static void main(String[] args) { Line 3: // method2(); Line 4: } Line 5: Line 6: Line 7: Circle c = new Circle(); Line 8: public static void method2() { Line 9: // Circle c = new Circle(); Line 10: Line 11: System.out.println("What is radius "+ c.getRadius()); //compile error : non-static variable c cannot be referenced from a static context. Why? here "c" is a instance variable. Line 12: } Line 13: Line 14: Line 15: } Line 16: Line 17: class Circle Line 18: { Line 19: public int getRadius() Line 20: { Line 21: return 3; Line 22: } Line 23: } Question : in line 11 ,compile error says, non-static variable c cannot be referenced from a static context. Why? here "c" is a instance variable. But the following code is ok . Why? if I change From line 8 to 12 public static void method2() { Circle c = new Circle(); System.out.println("What is radius "+ c.getRadius()); } Or: Circle c = new Circle(); public void method2() { System.out.println("What is radius "+ c.getRadius()); }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25199741
has comment: http://stackoverflow.com/comment/39243757
score: 1
has answer: http://stackoverflow.com/a/25199751
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25200255
upvote count: 1

http://stackoverflow.com/comment/114507635
has text: It not give the time ago for me it simply returning the value as 26 Oct 2020. How can i acheive this my DateUtils.getRelativeTimeSpanString(time, System.currentTimeMillis(),DateUtils.MINUTE_IN_MILLIS); my time = 1603714252000
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25175096

http://stackoverflow.com/comment/39101520
type: Comment
has text: PLease, can you give a sample example on how to apply this.
comment on: http://stackoverflow.com/a/25120023
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42055001
type: Comment
has text: Just tried it and does not seems to work,My bad.It seems to be an open issue https://jira.spring.io/browse/SEC-2728
score: 2
comment on: http://stackoverflow.com/a/26733069
type: AnswerComment

http://stackoverflow.com/q/25208933
tagged with: java
has comment: http://stackoverflow.com/comment/39290220
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/39261146
has comment: http://stackoverflow.com/comment/39261288
has title: Method Local Strings Memory Allocation?
answer count: 1
tagged with: string
favorite count: 0
tagged with: string-pool
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39290690
has comment: http://stackoverflow.com/comment/39290240
score: 2
has answer: http://stackoverflow.com/a/25209447
has body: I understand how String pool and intern() method works in java. Here is a brief introduction. String.intern() in Java 6 In those good old days all interned strings were stored in the PermGen – the fixed size part of heap mainly used for storing loaded classes and string pool. Besides explicitly interned strings, PermGen string pool also contained all literal strings earlier used in your program (the important word here is used – if a class or method was never loaded/called, any constants defined in it will not be loaded). The biggest issue with such string pool in Java 6 was its location – the PermGen. PermGen has a fixed size and can not be expanded at runtime. You can set it using -XX:MaxPermSize=96m option. As far as I know, the default PermGen size varies between 32M and 96M depending on the platform. You can increase its size, but its size will still be fixed. Such limitation required very careful usage of String.intern – you’d better not intern any uncontrolled user input using this method. That’s why string pooling at times of Java 6 was mostly implemented in the manually managed maps. String.intern() in Java 7 Oracle engineers made an extremely important change to the string pooling logic in Java 7 – the string pool was relocated to the heap. It means that you are no longer limited by a separate fixed size memory area. All strings are now located in the heap, as most of other ordinary objects, which allows you to manage only the heap size while tuning your application. Technically, this alone could be a sufficient reason to reconsider using String.intern() in your Java 7 programs. But there are other reasons. Source OK up to this point I am comfortable with how Strings are stored in memory until I came across this tool Java Visualizer. I wrote up following simple Java class to visualize how memory is allocated in a program. public class A { String iWillAlwaysBeOnHeap="I am on heap...!!!"; class Dummy{ private int dummyNumber; Dummy(int dummyNumber) { this.du…
downvote count: 0

http://stackoverflow.com/q/25198208
accepted answer: http://stackoverflow.com/a/25198891
type: Question
has title: org.jdom2.xpath doesn't return results on queries from html head element
tagged with: jdom-2
score: 0
has body: I am using org.jdom2.xpath to evaluate XPath queries on html documents. Attempting to retreive a script text from the head element, I tried this query: /html/head/script[contains(text(), 'expression1') and contains(text(), 'expression2')]/text() This query returns a single result in both XPath Helper and Chrome console ($x queries) but retuns an empty result set using org.jdom2.xpath. Trying the simpler (but heavier) query: //script[contains(text(), 'expression1') and contains(text(), 'expression2')]/text() produces the same results. Code sample: String xpath = "/html/head/script[contains(text(), 'expression1') and contains(text(), 'expression2')]/text()"; List&lt;Text&gt; tokeScriptResults = (List&lt;Text&gt;) xpathFactory.compile(xpath).evaluate(document); Afterthought: looking at the Document object, I see that since the script text is very long that jdom2 split it into an array of Texts instead of one long Text. Could this be the issue?
answer count: 1
has answer: http://stackoverflow.com/a/25198891
linked to: http://stackoverflow.com/q/3030487
tagged with: xpath
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/39152983
comment on: http://stackoverflow.com/a/25150618
type: Comment
score: 0
has text: Could you be more specific? If you are concerned about type safety I am not sure why you are using jstl
type: AnswerComment

http://stackoverflow.com/q/25178835
has title: storing and retrieving an instance of a class in a hashtable
tagged with: java
has body: So I am trying to store an instance of a class in hash table: public void insertEdge(String val1, String val2, int len) { Hashtable ref = new Hashtable(10, 3); if(!ref.containsKey(val2)) { Vert temp = new Vert(val2); ref.put(val2, temp); curNod++; } ref.get(val1).firstEdge = new Edge(ref.get(val2), ref.get(val1).firstEdge, len); } When I run the program above the compiler returns the following error: error: cannot find symbol ref.get(val1).firstEdge = new Edge(ref.get(val2), ref.get(val1).firstEdge, len); I am still learning hashtables so go easy. from what I understand you should be able to store an instance of a class in hashtable and retrieve it, firstEdge is a variable of my class Vertso I in theory I should technically be able to retrieve it without a problem! Here is the Vert class class Vert { public Edge firstEdge; public String name; public Vert() { firstEdge = null; } public Vert(String n) { firstEdge = null; name = n; } }
type: Question
has comment: http://stackoverflow.com/comment/39204910
accepted answer: http://stackoverflow.com/a/25179205
has comment: http://stackoverflow.com/comment/39204717
score: 0
answer count: 1
tagged with: hashtable
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25179205

http://stackoverflow.com/q/25110272
has answer: http://stackoverflow.com/a/25110381
has comment: http://stackoverflow.com/comment/39077666
type: Question
has title: How to change the color of an individual ellipse when clicking a jButton?
score: 0
answer count: 1
has body: I want to be able to click the JButton and change the next individual ellipse I make to its respective color, Red or Black, from its default Blue. So far I'm able to change the color of all the ellipses I have made. public class MainClient { private JFrame frame; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MainClient window = new MainClient(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public MainClient() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 800, 600); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final SpriteField panel = new SpriteField(); panel.setBounds(0, 110, 782, 331); panel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int tX = e.getX(); int tY = e.getY(); panel.CreateObjectAt(tX,tY); } }); frame.getContentPane().setLayout(null); panel.setBackground(Color.LIGHT_GRAY); frame.getContentPane().add(panel); final JButton btnRed = new JButton("black"); btnRed.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { panel.setColor(Color.BLACK); } }); btnRed.setBounds(229, 500, 97, 25); frame.getContentPane().add(btnRed); JButton btnRed_1 = new JButton("red"); btnRed_1.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { panel.setColor(Color.RED); } }); btnRed_1.setBounds(342, 500, 97, 25); frame.getContentPane().add(btnRed_1); } } I have a SriteField Class public class SpriteField extends JPanel { ArrayList&lt;RoundSprite&gt;mSprites = new ArrayList&lt;RoundSprite&gt;(); private Color color = Color.BLUE; @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; AffineTransform tOldTransform = g2.getTransform(); for(RoundSprite…
type: UnansweredQuestion
tagged with: swing
tagged with: ellipse
tagged with: jbutton
tagged with: mouselistener
tagged with: java

http://stackoverflow.com/a/27544027
answers question: http://stackoverflow.com/q/25188108
has body: You need to put the mysql jar and and also need to make corrections in persistence.xml: &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" /&gt; this will help you surely.
score: 0
type: Answer

http://stackoverflow.com/comment/39255762
type: Comment
comment on: http://stackoverflow.com/q/25205883
type: QuestionComment
has text: Do you need to use `BorderLayout`? I don't think it's a good choise here
score: 0

http://stackoverflow.com/q/25208516
has answer: http://stackoverflow.com/a/25208685
score: 0
answer count: 3
tagged with: state
has body: hi guys i have a problem. when i run my app, one activity crash after i press the buttons x times. sometimes it works, sometimes not. please help. don't know what to do.strong text 08-08 09:19:57.087: E/AndroidRuntime(2772): FATAL EXCEPTION: main 08-08 09:19:57.087: E/AndroidRuntime(2772): Process: org.nolodigas, PID: 2772 08-08 09:19:57.087: E/AndroidRuntime(2772): java.lang.IllegalStateException: Could not execute method of the activity 08-08 09:19:57.087: E/AndroidRuntime(2772): at android.view.View$1.onClick(View.java:3823) 08-08 09:19:57.087: E/AndroidRuntime(2772): at android.view.View.performClick(View.java:4438) 08-08 09:19:57.087: E/AndroidRuntime(2772): at android.view.View$PerformClick.run(View.java:18422) 08-08 09:19:57.087: E/AndroidRuntime(2772): at android.os.Handler.handleCallback(Handler.java:733) 08-08 09:19:57.087: E/AndroidRuntime(2772): at android.os.Handler.dispatchMessage(Handler.java:95) 08-08 09:19:57.087: E/AndroidRuntime(2772): at android.os.Looper.loop(Looper.java:136) 08-08 09:19:57.087: E/AndroidRuntime(2772): at android.app.ActivityThread.main(ActivityThread.java:5017) 08-08 09:19:57.087: E/AndroidRuntime(2772): at java.lang.reflect.Method.invokeNative(Native Method) 08-08 09:19:57.087: E/AndroidRuntime(2772): at java.lang.reflect.Method.invoke(Method.java:515) 08-08 09:19:57.087: E/AndroidRuntime(2772): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 08-08 09:19:57.087: E/AndroidRuntime(2772): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 08-08 09:19:57.087: E/AndroidRuntime(2772): at dalvik.system.NativeStart.main(Native Method) 08-08 09:19:57.087: E/AndroidRuntime(2772): Caused by: java.lang.reflect.InvocationTargetException 08-08 09:19:57.087: E/AndroidRuntime(2772): at java.lang.reflect.Method.invokeNative(Native Method) 08-08 09:19:57.087: E/AndroidRuntime(2772): at java.lang.reflect.Method.invoke(Method.java:515) 08-08 09:19:57.087: E/AndroidRuntime(2772): at android.view.View…
has title: app crashing after clicking button x times
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25208646
tagged with: java
has answer: http://stackoverflow.com/a/25208556
tagged with: lang
type: Question

http://stackoverflow.com/comment/39060083
has text: Thanks for that. Never had so many classes that I've had to worry about unloading them!
type: AnswerComment
comment on: http://stackoverflow.com/a/25099121
score: 0
type: Comment

http://stackoverflow.com/q/25170869
has title: Getting Wilson Primes; wont work?
type: UnansweredQuestion
tagged with: primes
has answer: http://stackoverflow.com/a/26301294
tagged with: java
type: Question
has body: so I tried making a java program to get ONLY Wilson primes; which have this characteristic: "{[(n-1)!+1]/n}%n=0". The program kind of works, but it only goes as far as number 13 (another wilson prime is 563 for example) when I input 1000. Here's what I have so far. package again; import java.util.Scanner; public class AGAIN { public static void main(String[] args) { Scanner lol = new Scanner(System.in); System.out.println("Write a number."); int n = 1; long r; long g; for (long u = lol.nextInt(); u &gt;= n; u--) { long s = 1; for (r = u - 1; r &gt;= 1; r--) { s = s * r; } if ((s + 1) % u == 0) { g = (s+1) / u; if (g % u == 0) { System.out.printf(u + " "); } } } } } Why isn't this showing me any larger numbers? Please help! (here's the video https://www.youtube.com/watch?v=eZUa5k_VIZg )
has comment: http://stackoverflow.com/comment/39190825
tagged with: factorial
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39312670
has answer: http://stackoverflow.com/a/25170994
has comment: http://stackoverflow.com/comment/39190723

http://stackoverflow.com/q/25108418
answer count: 1
downvote count: 0
has body: So, I had to have my laptop restored, and now when I open my eclipse workspace, my appcompat_v7_11 package has an error in it, and now some of my apps have errors all over the place because of it. I need to reinstall the appcompat package or at least restore the 7_11 package back to the way it was. I want the proper way of doing this, that way I don't end up deleting the wrong files, duplicating the same files, or anything else that will make the problem worse. Thank you in advance. EDIT: So I realized that each of my appcompat files are assigned to each one of my apps. So obviously my appcompat file 7_11 must have been messed up when my computer was restored. Is there a way to fix or restore this file that way I won't have 100 errors in my app? EDIT 2: This is the error I get: Errors occurred during the build. Errors running builder 'Android Resource Manager' on project 'DayManager'. java.lang.NullPointerException Errors running builder 'Android Resource Manager' on project 'appcompat_v7_11'. java.lang.NullPointerException If you know of any android help centers that may help me, please post them, as I can't continue my app development without fixing this problem. EDIT 3: I've noticed that it is missing the Android 4.4.2 and Android Private Libraries
favorite count: 0
tagged with: android
tagged with: android-appcompat
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32095749
upvote count: 1
score: 1
has title: How to reinstall the appcompatv7_11 package in android?
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/a/25167633
has comment: http://stackoverflow.com/comment/39245990
answers question: http://stackoverflow.com/q/25147645
has comment: http://stackoverflow.com/comment/39860283
has body: If you write a recursive function, the problem can be solved because the announcement of one number occurs only after the previous ones are finished. The method below can be used- private void announceNumber(int input){ int numberOfDigits = countNumberOfDigits(input); if(numberOfDigits&gt;1){ int currentDigitToBeAnnounced = (input/Math.pow(10,(numberOfDigits-1))); int nexIterationNumber = (input%Math.pow(numberOfDigits-1)); // The next two announce calls can be synchronized by putting them // in the same method announcedCurrentNumber(currentDigitToBeAnnounced); announceMultiplier(numberOfDigits); // make the recursive call made here in the method that you // use to make the sound. announceNumber(nextIterationNumber); }else{ announceNumber(input); } }
has comment: http://stackoverflow.com/comment/39248073
has comment: http://stackoverflow.com/comment/39276593
score: 0
has comment: http://stackoverflow.com/comment/39247214
has comment: http://stackoverflow.com/comment/39215143
type: Answer

http://stackoverflow.com/a/40477548
answers question: http://stackoverflow.com/q/25190357
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: soapMessage.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, "UTF-8"); soapMessage.setProperty(SOAPMessage.WRITE_XML_DECLARATION, "true");

http://stackoverflow.com/q/25094386
upvote count: 5
has answer: http://stackoverflow.com/a/25094532
tagged with: java
has answer: http://stackoverflow.com/a/25094448
accepted answer: http://stackoverflow.com/a/26310064
linked to: http://stackoverflow.com/q/26307443
type: Question
score: 5
has title: How to convert from java.util.HashMap to android.content.ContentValues?
downvote count: 0
tagged with: platform-independent
has comment: http://stackoverflow.com/comment/39048078
answer count: 3
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/39047887
favorite count: 0
has answer: http://stackoverflow.com/a/26310064
tagged with: database-independent
has body: Is there a simple way to convert from a java Map&lt;String,Object&gt; to android.content.ContentValues ? android.content.ContentValues is used in android database programming to keep the data of a database-row as name-value-pairs. Background: I try to port the businesslogic of an existing android app to a j2se-swing-app My goal is having android specific code and android independant code that goes into a seperate lib that can be used by both android and by swing-gui. currently i am analysing if i have to implement a complete seperate set of repositoryimplementations with lot of redundant code or if there is common code that can be used in both (j2se-swing- and android-) repository-Implementations. Repository-Database-Code relies on database-field-name-value pairs which uses android.content.ContentValues. I thought that my android independat version can use a HashMap&lt;String,Object&gt; insead of ContentValues and create code to convert between both. The android dependant version would look like this // android dependant code in android-app class AndroidTimeSliceCategoryRepsitory implements ICategoryRepsitory { public long createTimeSliceCategory(final TimeSliceCategory category) { // get values from android independant layer Map&lt;String, Object&gt; columsToBeInserted = TimeSliceCategorySql.asHashMap(category); // &gt;&gt;&gt;&gt; this is where i am stuck ContentValues androidColumsToBeInserted = DbUtils.asContentValues(columsToBeInserted); final long newID = AndroidTimeSliceCategoryRepsitory.DB.getWritableDatabase() .insert(TimeSliceCategorySql.TIME_SLICE_CATEGORY_TABLE, null, androidColumsToBeInserted); category.setRowId((int) newID); return newID; } } This is the android independant part: // android independant code in common jar class TimeSliceCategorySql {.... /** converts {@link ....model.TimeSliceCategory} to {@link java.util.HashMap} */ public static Map&lt;String, Object&gt; asHashMap(final TimeSliceCategory category) { final Map&lt;String, Object&gt; val…
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25094532

http://stackoverflow.com/comment/39201417
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25160703
score: 0
has text: I don't see a reason why not, if I am not missing something.

http://stackoverflow.com/a/25177759
has comment: http://stackoverflow.com/comment/98909782
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/25177379
downvote count: 0
has body: In general, you use a Collection (List, Map, Set) to store objects with similar characteristics, that's why generics exist. So using a Map to store objects of several classes forces you to cast every object you have stored when you are getting it, which is not the cleanest code we can write. Also, even using a HashMap, where the objects are easily fetched using the hashCode value, the access is slower than to a Java Bean attribute... and you have always to ensure that those objects have a good hashCode() generator. But anyway, I cannot imagine when this could be a bottleneck in performance in a regular application. So my recommendation is using a Java Bean every time that you know in compilation time how many attributes you are going to store and their classes, using the Map to store elements of the same class. For example, if you have a DB table with users, and you want to "cache" the users to access to anyone of them quickly, you could do something like this: class User { long id; String name; ... //other attributes //setters and getters } And then store them in a Map to have a fast access to them by their id: Map&lt;Long,User&gt; usersMap= new HashMap&lt;&gt;(); ... usersMap.put(user.getId(),user);
has comment: http://stackoverflow.com/comment/98909271
score: 5

http://stackoverflow.com/a/25108456
has comment: http://stackoverflow.com/comment/39074189
has comment: http://stackoverflow.com/comment/39074106
answers question: http://stackoverflow.com/q/25108416
downvote count: 2
has body: Your Question is answered here: Size-limited queue that holds last N elements in Java To summerize it: No there is no data structure in the default java sdk, but Apache commons collections 4 has a CircularFifoQueue.
has comment: http://stackoverflow.com/comment/39074205
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/39074310
score: -2
has comment: http://stackoverflow.com/comment/51696997

http://stackoverflow.com/a/25223649
has body: http://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#HOUR_OF_DAY HOUR_OF_DAY is 24 hour format
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25223602
type: Answer

http://stackoverflow.com/comment/39224383
type: QuestionComment
has text: If you change the position will the button move? Or is it stuck in the center of the screen?
comment on: http://stackoverflow.com/q/25189046
score: 0
type: Comment

http://stackoverflow.com/a/25116256
score: 0
type: Answer
has body: Assuming you are selecting these values with a POST request you can use the parameters to do something like this - NAME VALUE HasAccount false Settings.ageGroup ${__Random(1,4)} This is on a newsletter sign up page I was testing. The parameters that are set to false (or true) are for checkboxes and radio buttons. The other one is a dropdown where I wanted to select a random value. In your case, I imagine this could result in some invalid values. I think the best option is a small Beanshell (or similar) sampler that evaluates whether Jack or John has been selected. This is will obviously scale very badly if you have lots of users though.
answers question: http://stackoverflow.com/q/25077784

http://stackoverflow.com/comment/39289767
has text: Oh, right, I just got it working. I can't really see what's taking so long... Could the problem be that the program uses Java 6, but my system is running Java 7?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25202645

http://stackoverflow.com/comment/39262358
type: QuestionComment
comment on: http://stackoverflow.com/q/25209028
score: 1
has text: I'd **strongly** suggested refactoring the code. Right now you have a `while` inside of a `switch` inside of another `switch` inside of another `while`. If you pull some of that functionality out into separate methods, it will be much easier to figure out what's going wrong.
type: Comment

http://stackoverflow.com/a/25133247
has body: I'd go double timeElapsed = (now - then) / 1000.0; But, unless you ar doing this 1000s of times in a tight loop it doesn't matter. Do whatever seems clearest to you. Some claim that "there is no Double.valueOf(long)". Well, Java behaves as if there were. Double.valueOf(2L) does exactly what one thinks it should do. In your code, unless the test were running for years, Double.vaueOf(now - then) would do exactly what you thought it would do. I'd argue that Double.valueOf(long) does exist. It's just not in the Javadocs. If I write double d = 3 + 4.5 does that not exist? I agree with others here that the Double.valueOf(now - then).doubleValue() is silly, but it should be avoided because it adds confusion, not because it "serves no purpose". With the advent of autoboxing and unboxing, many methods serve no purpose, except, possibly to make things clear. If you think that the explicit Double makes things clearer (in this example, I think not, but your mileage may vary) you should write the code that way. For example, I still often use the "unnecessary" double primitive = someDouble.doubleValue() to remind myself and other programmers that otherwise auto-unboxing would be happening and a mysterious NPE may be thrown.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39259662
has comment: http://stackoverflow.com/comment/39120564
answers question: http://stackoverflow.com/q/25133157
has comment: http://stackoverflow.com/comment/39121955
score: -1
has comment: http://stackoverflow.com/comment/39260192
has comment: http://stackoverflow.com/comment/39122334
has comment: http://stackoverflow.com/comment/39122477
has comment: http://stackoverflow.com/comment/39270320
downvote count: 2

http://stackoverflow.com/comment/39067822
type: QuestionComment
has text: Have you made any attempts at creating the required regex?
score: 0
comment on: http://stackoverflow.com/q/25105117
type: Comment

http://stackoverflow.com/comment/39225285
type: Comment
has text: Ok i will try this. May be you could add this to your answer. Thanks again.
comment on: http://stackoverflow.com/a/25177470
type: AnswerComment
score: 0

http://stackoverflow.com/q/25222404
has comment: http://stackoverflow.com/comment/39286369
has comment: http://stackoverflow.com/comment/39286936
score: 0
has comment: http://stackoverflow.com/comment/39296274
has answer: http://stackoverflow.com/a/25247997
linked to: http://stackoverflow.com/q/2715118
has title: setFont in paint() using MigLayout don't resize back containers
has comment: http://stackoverflow.com/comment/39295640
tagged with: swing
has comment: http://stackoverflow.com/comment/39286303
tagged with: miglayout
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25247997
tagged with: java
has comment: http://stackoverflow.com/comment/39287117
has body: I'm trying to write a panel with 3 vertical section in MigLayout: top growing, middle fixed and bottom growing. The top is a JLabel with font-size-based-on-container-size. The middle is also a Jlabel, and the bottom is currently an empty JPanel. Enlarging window is ok: When I resize back the window, content doesn't resize back (note that the problem is not the font size, but the container width): This problem exists only when in overrided method paint (see below) is called setFont on timer JLabel. public class TabRace extends JPanel { private JLabel timer; public TabRace() { super(); // Set the layout this.setLayout(new MigLayout("","[grow]","[grow][][grow]")); // Timer label timer = new JLabel("00:00:00.000"); timer.setOpaque(true); timer.setBackground(new Color(0, 0, 0)); timer.setForeground(new Color(255, 255, 255)); this.add(timer,"grow,wrap"); // Table label JLabel tableCaption = new JLabel("Last Records:"); this.add(tableCaption,"wrap"); JPanel bottom = new JPanel(); this.add(bottom, "grow,wrap"); } public void paint(Graphics g) { super.paint(g); // Thanks to coobird // @see https://stackoverflow.com/questions/2715118/how-to-change-the-size-of-the-font-of-a-jlabel-to-take-the-maximum-size Font labelFont = timer.getFont(); final int stringWidth = timer.getFontMetrics(labelFont).stringWidth(timer.getText()); final int componentWidth = timer.getWidth(); // Find out how much the font can grow in width. double widthRatio = (double)componentWidth / (double)stringWidth; int newFontSize = (int)(labelFont.getSize() * widthRatio); int componentHeight = timer.getHeight(); // Pick a new font size so it will not be larger than the height of label. int fontSizeToUse = Math.min(newFontSize, componentHeight); // Set the label's font size to the newly determined size. // REMOVING NEXT LINE AND RESIZING IS WORKING timer.setFont(new Font(labelFont.getName(), Font.PLAIN, fontSizeToUse)); } } I've tried also to put JLabel inside JPanel. Any ideas?
type: Question
answer count: 1
tagged with: layout-manager

http://stackoverflow.com/comment/39269664
has text: What is `SearchYoutube.ystuff`? Does it contain the `results` list? If not, the list is empty because you are not populating it with the results.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25213360
type: QuestionComment

http://stackoverflow.com/q/25227233
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/39295181
has comment: http://stackoverflow.com/comment/39300842
has comment: http://stackoverflow.com/comment/39295174
score: 0
has title: NetBeans suddenly doesn't detect Swing components on runtime
tagged with: build-error
type: UnansweredQuestion
has body: I guess this is odd, as NetBeans GUI components are not detected by Builder, for exp "cannot find symbol variable jButton...". It used to work fine, but now after some minutes of latest successful build it does't work any more! I tried to solve the problem by restarting project and NetBeans IDE but nothing changed. How can I solve this issue? Netbeans IDE v7.4 Mac OS 10.9.4 Thanks in advance for your help!
has comment: http://stackoverflow.com/comment/39295689
linked to: http://stackoverflow.com/q/19714659
tagged with: build
tagged with: netbeans
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39295536
has comment: http://stackoverflow.com/comment/39295292

http://stackoverflow.com/q/25221617
tagged with: constructor
has comment: http://stackoverflow.com/comment/39285273
type: UnansweredQuestion
has body: I have a Song class as follow public class Song { protected String title; protected String artiest; ...} and a Node class which inherits the Song class public class Node extends Song{ protected Node next; ...} Finally, there is a List class which has a Node object public class List { protected Node head; ...} Now I need to write the constructor and insert functions for each class. My problems is how to determine the number of those functions and the argument list of those functions. To be special, take the List class as example. I know I must have the constructor like public List() { head = null; } public List(List source) { copy_from_list(this.head, source.head); } public List(Node source){ Node temp = New Node(source); temp.set_next(head); hand = temp; } and insert function public void insert(Node source) { Node temp = new Node(source); temp.set_next(head); head = temp; } Do I need one more constructor with String as argument? public List(String title, String artiest) { Node temp = new Node(title, artiest); temp.set_next(head); head = temp; } and one more insert function with String as argument? public void insert(String title, String artiest){...} Or it depends on the need, which means I need it if I want to insert two Strings title_source and artiest_source to List directly. Thanks for reading. Waiting for reply.
has title: How to determine the argument of constructor and insert function?
answer count: 0
tagged with: java
type: Question
tagged with: function
score: 0
tagged with: insert
has comment: http://stackoverflow.com/comment/39285251

http://stackoverflow.com/comment/39106392
comment on: http://stackoverflow.com/q/25125582
score: 0
type: Comment
type: QuestionComment
has text: Because a session has a connection, and connections come from a provider?

http://stackoverflow.com/q/25086475
score: 1
accepted answer: http://stackoverflow.com/a/25088588
tagged with: jvm
favorite count: 0
has body: I am trying to instrument class files using asm-framework such that based on a boolean flag at runtime, for certain set of classes, I can switch whether the base class or its sub class gets instantiated (All of this happens transparently without the user's knowledge). Here is an example quasi-asm that my program so far generates. public void createInstance(); flags: ACC_PUBLIC aload_1 //load the string flag ifnull label_0 new com.example.BaseClass goto label_1 label_0: new com.example.SubClass label_1: dup ldc "a" aload_1 //load the string flag ifnull label_2: invokespecial com.example.BaseClass.&lt;init&gt;(java.lang.String) goto label_3 label_2: invokespecial com.example.SubClass.&lt;init&gt;(java.lang.String) label_3: astore_1 return The problem is ASM does not complain about the generate class files. However, JVM fails when I try to run this code with the following error(partial stack trace shown here): Exception in thread "main" java.lang.VerifyError: Mismatched stack types at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2446) at java.lang.Class.getConstructor0(Class.java:2756) at java.lang.Class.newInstance0(Class.java:328) at java.lang.Class.newInstance(Class.java:310) Is what I am doing an impossible task with JVM ? If not, how I correct my mistake? Similar errors I found online: http://objectmix.com/java/158464-strange-verifier-semantics.html JVM Spec: http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html#9839 Any help highly appreciated!
upvote count: 1
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25088588
has title: Weird JVM verification error: Mismatched stack types
answer count: 1
downvote count: 0

http://stackoverflow.com/a/34754680
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: Another option we used as well is to implement a custom repository factory for your specific storage type. You can extend from RepositoryFactoryBeanSupport, build your own PersistentEntityInformation and take care of CRUD ops in a default repo impl for your custom data storage type. See JpaRepositoryFactoryBean for example. You maybe need to implement about 10 classes in total but then it gets reusable.
answers question: http://stackoverflow.com/q/25201306

http://stackoverflow.com/a/25080879
type: Answer
has body: You can use .matches("-?\\d+") expression on a String to check whether it's an Integer. { int number; if (v1.matches("-?\\d+")) number = Integer.parseInt(v1); else System.out.println("It's not a number!") }
answers question: http://stackoverflow.com/q/25080819
score: 0

http://stackoverflow.com/comment/39146003
score: 0
comment on: http://stackoverflow.com/q/25146938
has text: `Project Name.class` is present. Are you sure? A class name can't contains spaces.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25183293
upvote count: 3
answers question: http://stackoverflow.com/q/25177177
type: AcceptedAnswer
has body: How about: @Test public void foo() { mongoTemplate.dropCollection(RssSearchResponse.class); RssSearch rs = new RssSearch(); rs.id = "123"; rs.rssSearchResponse = new RssSearchResponse( new Journey[] {new Journey("A", 1),new Journey("B", 0),new Journey("C", 0),new Journey("D", 1)} ); mongoTemplate.insert(rs); Aggregation agg = newAggregation(RssSearch.class, // match(where("_id").is(rs.id)) // , project("rssSearchResponse.journeys") // , unwind("journeys") // , match(where("journeys.stops").is(0)) // ); AggregationResults&lt;DBObject&gt; result = mongoTemplate.aggregate(agg, RssSearch.class, DBObject.class); System.out.println(result); } static class RssSearch{ String id; RssSearchResponse rssSearchResponse; } static class RssSearchResponse{ Journey[] journeys; public RssSearchResponse(Journey[] journeys) { this.journeys = journeys; } } static class Journey{ String name; int stops; public Journey(String name, int stops) { this.name = name; this.stops = stops; } } This will return B and C. We generate the following aggregation command: { "aggregate" : "rssSearch" , "pipeline" : [ { "$match" : { "_id" : "123"}} , { "$project" : { "journeys" : "$rssSearchResponse.journeys"}} , { "$unwind" : "$journeys"} , { "$match" : { "journeys.stops" : 0}} ] }
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/39238027
score: 3
accepted answer of: http://stackoverflow.com/q/25177177

http://stackoverflow.com/comment/129382784
has text: Improvement of your statement would be: ``` ```
comment on: http://stackoverflow.com/a/63439588
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39078948
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25110565
has text: I wish I could answer this question but I'm not even sure why I used it haha
score: 0

http://stackoverflow.com/q/25143657
type: AnsweredQuestion
score: 1
tagged with: java
has title: How to rerun a task
type: Question
tagged with: illegalstateexception
has body: I have a task running and if it fails I want to run it again up to three times. The issue is that Android gets mad that I'm trying to run a task inside of it's self. What's the best way to get around this? The code (look inside task.callback at the bottom): final GenericAsyncTask task = new GenericAsyncTask(); task.background = new Runnable() { public void run() { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(GCMIntentService.this.host); String addremove = "add"; if(register == false) addremove = "remove"; try { // Add your data List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(4); nameValuePairs.add(new BasicNameValuePair("cmd", addremove)); nameValuePairs.add(new BasicNameValuePair("subscription_key", SUBSCRIPTION_KEY)); // unique per app nameValuePairs.add(new BasicNameValuePair("token", str)); nameValuePairs.add(new BasicNameValuePair("os_family", "android")); if(addremove.equals("remove")) nameValuePairs.add(new BasicNameValuePair("hard", "" + hard)); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(nameValuePairs); httppost.setEntity(entity); Log.i(LCHApplication.TAG, "Name Value Pairs: " + nameValuePairs.toString()); // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); task.result = EntityUtils.toString(response.getEntity()); } catch (IOException e) { e.printStackTrace(); } } }; task.callback = new Runnable() { public void run() { try { Log.i(LCHApplication.TAG, "registration response: " + task.result.toString()); } catch(Exception e) { if(attempts++ &lt; ATTEMPTS_LIMIT) { // try to register the device again task.execute(); } else { Crashlytics.logException(e); } } } }; task.execute();
has answer: http://stackoverflow.com/a/25143947
answer count: 3
has answer: http://stackoverflow.com/a/25143721
has answer: http://stackoverflow.com/a/25143729
downvote count: 0
favorite count: 0
tagged with: android-asynctask
possible better answer: http://stackoverflow.com/a/25143721
accepted answer: http://stackoverflow.com/a/25143729
tagged with: android
upvote count: 1

http://stackoverflow.com/comment/39267225
comment on: http://stackoverflow.com/q/25209015
score: 0
type: QuestionComment
type: Comment
has text: heyyy in the server, the line: "filecontent = filePart.getInputStream();" I have a nullpointerexception here!!

http://stackoverflow.com/a/25186790
type: Answer
has body: You want the JDBC thin driver, which is 100% Java, not the OCI driver. That requires a DLL, which the JVM is telling you isn't in the LD_LIBRARY_PATH. Change the URL to Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@mydevdb:1521:mysandbox", "uname", "pwd"); I don't like the driver JARs you have, either. I would recommend getting ojdbc6.jar at a minimum. The ojdbc14.jar is JDK 1.4 vintage - way out of date.
has comment: http://stackoverflow.com/comment/39219548
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/39226505
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25186725
answers question: http://stackoverflow.com/q/25186725

http://stackoverflow.com/q/25222623
score: 0
tagged with: fragment
linked to: http://stackoverflow.com/q/10903077
type: Question
type: AnsweredQuestion
has title: How to call a method on a Fragment of Activity?
tagged with: java
has answer: http://stackoverflow.com/a/25222704
has comment: http://stackoverflow.com/comment/39286841
has body: Activity method of fragment call as follows: MyActivity method = (MyActivity) getActivity (); method.MyMethod ("string"); Here's how it looks in the Activity: public void MyMethod (String var) { Toast.makeText (MyActivity.this, var,Toast.LENGTH_SHORT).show(); } Question. How to call a method on a Fragment of Activity? (Ie, reverse)
accepted answer: http://stackoverflow.com/a/25222704
answer count: 3
possible better answer: http://stackoverflow.com/a/25222698
has answer: http://stackoverflow.com/a/25222698
has answer: http://stackoverflow.com/a/25222786
tagged with: android
tagged with: android-activity

http://stackoverflow.com/q/25190024
has comment: http://stackoverflow.com/comment/39225785
has comment: http://stackoverflow.com/comment/39225827
linked to: http://stackoverflow.com/q/1497946
tagged with: regex
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25190141
type: Question
has body: I have following html content part, and I want to get the value -7326630261683062897:1196341531039871985 from all http content. There is only one unique point that is id javax.faces.ViewState. How can I get the value? What kind of regex do I have to use? &lt;input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-7326630261683062897:1196341531039871985" autocomplete="off" /&gt;
has title: Getting the value of an input tag with a specific ID using regex
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25194847

http://stackoverflow.com/comment/132308279
has text: Thanks, @OleV.V. for your encouraging words and valuable feedback. I had missed the requirement, *I am using a prefix of 0001 for dates which don't have a year as an internal representation. How to overcome this?*. Based on your suggestion, I have extended my answer to address this requirement.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/74974442
type: AnswerComment

http://stackoverflow.com/comment/39068716
type: QuestionComment
has text: @trashgod Nowhere, since it doesn't change anything. edit: It doesn't solve the problem is what I mean.
comment on: http://stackoverflow.com/q/25105476
score: 0
type: Comment

http://stackoverflow.com/comment/39114052
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25129781
has text: I'm new at this. How can you tell what you are running? I'm using Eclipse Android Developer Tools...

http://stackoverflow.com/comment/39046298
type: Comment
has text: @jeanluc: I see your problem. I've updated the answer.
comment on: http://stackoverflow.com/a/25091901
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39033265
has text: peeSkillet, Thank you. I'll edit my code with you're suggestions, try to make it more legible, and if I still have an error, then I'll post the edited code.
type: Comment
comment on: http://stackoverflow.com/q/25085910
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39204190
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25178719
has text: This isn't clear though. Is a method signature a direct reference? In other words, would A() always throw ClassNotFound even if the Exception is not actually thrown?
type: AnswerComment

http://stackoverflow.com/a/25208495
upvote count: 1
has comment: http://stackoverflow.com/comment/41501354
type: Answer
downvote count: 0
score: 1
has body: Class oracle.xml.parser.v2.XMLParseException is in xmlparserv2.jar Available at http://www.oracle.com/us/downloads/index.html
has comment: http://stackoverflow.com/comment/39261575
has comment: http://stackoverflow.com/comment/39260617
answers question: http://stackoverflow.com/q/25208239

http://stackoverflow.com/comment/39051136
type: Comment
has text: Why not make public (no-nested) and prototype the nested bean?. "Perhaps" (I am not sure) being abstract, it to let the child override it
score: 0
comment on: http://stackoverflow.com/q/25087525
type: QuestionComment

http://stackoverflow.com/q/25082619
type: Question
type: AnsweredQuestion
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/25082783
tagged with: java
has comment: http://stackoverflow.com/comment/39026829
upvote count: 1
has answer: http://stackoverflow.com/a/25083040
favorite count: 0
has answer: http://stackoverflow.com/a/25082900
score: 0
answer count: 5
has answer: http://stackoverflow.com/a/25082783
tagged with: android
has title: How to shuffle a deck of cards using Java (trying to use hashmap, not working)?
downvote count: 1
accepted answer: http://stackoverflow.com/a/25082739
has body: I have a hashmap&lt;Integer, Card&gt; Card is a class. I have initialized the hashmap with keys from 0-51 and the values are array of Card, as follows Card [] card = new Card[52] for (int i=1; i&lt;=13; i++) for (int j=0; j&lt;4; j++) card[++index] = new Card( ((i*10)+j) ); and I populate the hashmap as follows: for (int i=1; i&lt;=13; i++) for (int j=0; j&lt;4; j++) deck.put( ++key, card[++index] ); Now, what I want to do is to shuffle the values side of the hashmap, i do not want,for an example, the key[1] corresponds to card[0] and key[1] corresponds to card[1]. I want, for an exampel, the key[1] corresponds to card[38]. I want the values side to be shuffled. I tried the following: Collections.shuffle(card,new Random()); But it seems it accepts only ArrayList and List.
has answer: http://stackoverflow.com/a/25083532
has comment: http://stackoverflow.com/comment/39025755
has comment: http://stackoverflow.com/comment/39025831
has comment: http://stackoverflow.com/comment/39025796
has answer: http://stackoverflow.com/a/25082739
tagged with: collections
has comment: http://stackoverflow.com/comment/39025843

http://stackoverflow.com/comment/41490687
type: AnswerComment
comment on: http://stackoverflow.com/a/26402132
has text: Sorry. There was a slight mistake. We need to download Nightly builds. This link will work http://scala-ide.org/download/nightly.html Let me edit it :)
type: Comment
score: 0

http://stackoverflow.com/a/25132424
has body: A Calendar can be either in "lenient" or "non-lenient" mode. If it's in lenient mode, it can accept invalid values (like day=36) and interpret them somehow; if it's in non-lenient mode and you try to set invalid values, an exception will be thrown (but not necessarily right away; see this question. isLenient will tell you whether the Calendar is in lenient or non-lenient mode, but it tells you nothing about whether the data is valid. To test whether the values are valid, you can try another Calendar in non-lenient mode. Your class has day, month, and year fields, so you can try something like: public boolean validDate() { try { Calendar tempCal = Calendar.getInstance(); tempCal.setLenient(false); tempCal.set(Calendar.MONTH, month); tempCal.set(Calendar.YEAR, year); tempCal.set(Calendar.DAY_OF_MONTH, day); tempCal.get(Calendar.MONTH); // throws ArrayIndexOutOfBoundsException if any field is invalid; we don't care about the // method result return true; } catch (ArrayIndexOutOfBoundsException | IllegalArgumentException e) { return false; } } Note that this doesn't affect your calendar field which may still be in lenient mode. EDIT: Now tested. The javadoc says get() throws ArrayIndexOutOfBoundsException if any data is invalid, but I believe this may be an error in the javadoc. I'll try to report this to Oracle.
has comment: http://stackoverflow.com/comment/39119902
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39139084
answers question: http://stackoverflow.com/q/25131867
upvote count: 1

http://stackoverflow.com/a/54434036
has body: Two things needs to be done to resolve this. By default scheduled message support is disabled. We must enabled it in the broker XML configuration file. broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}" schedulerSupport="true"> Set the delay before sending the message. public void send(Object object) { log.info("put &lt;" + object + "&gt;"); jmsTemplate.convertAndSend(QUEUE_NAME, object, m -&gt; { m.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, 10000); return m; }); }
downvote count: 0
has comment: http://stackoverflow.com/comment/110638807
type: Answer
answers question: http://stackoverflow.com/q/25121094
upvote count: 1
score: 1

http://stackoverflow.com/q/25110725
answer count: 2
has answer: http://stackoverflow.com/a/25110784
accepted answer: http://stackoverflow.com/a/25110784
has answer: http://stackoverflow.com/a/25110782
tagged with: inheritance
has comment: http://stackoverflow.com/comment/39090672
score: 0
linked to: http://stackoverflow.com/q/2770321
has title: Value casting when extending Generic parent
tagged with: generics
has comment: http://stackoverflow.com/comment/39078748
possible better answer: http://stackoverflow.com/a/25110782
has body: Why does subclass still need a casting to access value from his Generic parent's properties ? Any particular reason ? have a look : class a&lt;U, T&gt; { public U u; public T t; public a(U u, T t) { this.u = u; this.t = t; } public U getU(){ return u; } } class b extends a { public b(String u, Integer t) { super(u, t); } // Here I call b's parent method where casting occurs public String get(){ return (String) getU(); // Here's the cast } } I know that the type returned by super.getU() is U , but Isn't b inherited from a which means a's properties will be visible to its children classes!? Plus superclass' constructor had been refered by super(11111,"aString"); ? Isn't it enough to tell b's parent that "I'm your child passing an Integer &amp; a String " , it looks to me like there is no relation between class "a" and class "b" *UDPATE : code typos had been fixed ,sorry it happened because i typed in hurry.
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/39163591
type: Comment
comment on: http://stackoverflow.com/a/25156593
has text: @PareshMayani ya absolutely fine, u r the genious as always.
score: 0
type: AnswerComment

http://stackoverflow.com/a/25132436
type: Answer
answers question: http://stackoverflow.com/q/25120884
has body: On JBoss is was even easier @Override public void execute(JobExecutionContext context) throws JobExecutionException { Context ctx = null; try { ctx = new InitialContext(); IJobContent exampleBean = (IJobContent) ctx .lookup("java:global/DSMonitor/jobcontent!de.bva.dsmonitor.job.IJobContent"); exampleBean.doStuff(); } catch (NamingException e) { System.err.println("EJB JobContent not found!"); e.printStackTrace(); } }
accepted answer of: http://stackoverflow.com/q/25120884
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/25093985
has title: highlight the cell in jtable
has comment: http://stackoverflow.com/comment/39048955
has answer: http://stackoverflow.com/a/25120023
has comment: http://stackoverflow.com/comment/39048002
has answer: http://stackoverflow.com/a/25095175
tagged with: swing
has comment: http://stackoverflow.com/comment/39065696
linked to: http://stackoverflow.com/q/18141677
has comment: http://stackoverflow.com/comment/39048660
score: 2
has body: I have this code fom stackoverflow how to highlight multiple cells in jtable : private static class CellHighlighterRenderer extends JLabel implements TableCellRenderer { public CellHighlighterRenderer() { setOpaque(true); // Or color won't be displayed! } @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { String val = (String)value; Color c; if (val.matches(".*MIN.*")) // Add a method to configure the regexpr c = Color.YELLOW; // Add a method to configure color else c = UIManager.getColor("Table.background"); setBackground(c); setText(val); return this; } } But when i use it for highlighting a cell , it gives wrong action like the whole data gets lost . Iam new to java swing. Please help to make a cell gets highlighted on a button press action event. UPDATE: adding my sample code: package myPackage; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import javax.swing.table.TableCellRenderer; public class JTableCreatingDemo { public static void main(String args[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Object rowData[][] = { { "Row1-Column1"}, { "Row2-Column1" } ,{ "Row3-Column1"},{ "Row4-Column1"},}; Object columnNames[] = { "Column One" }; final JTable table = new JTable(rowData, columnNames); JButton button = new JButton("Highlight cell-1"); //Add action listener to button button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { table.setDefaultRenderer(Object.class, new CellHighlighterRenderer()); } }); JPanel pnl = new JPanel(); pnl.add(button); JScrollPane scrollPane = new JScrollPane(table); frame.add(scrollPane, BorderLayout.CENTER); frame.add(pnl,BorderLayout.SOUTH); frame.setSize(300, 150); frame.setVisible(true); } } class CellHighlighterRenderer extends JLabel implements TableCellRenderer { /** * */ privat…
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25095175
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/39047373
tagged with: cell
has comment: http://stackoverflow.com/comment/39047329
downvote count: 0
has comment: http://stackoverflow.com/comment/39049431
favorite count: 0
tagged with: jtable
has comment: http://stackoverflow.com/comment/39063849
has comment: http://stackoverflow.com/comment/39049591
has answer: http://stackoverflow.com/a/25094472
accepted answer: http://stackoverflow.com/a/25094472
tagged with: highlight
answer count: 4
has answer: http://stackoverflow.com/a/41214430

http://stackoverflow.com/comment/39196287
score: 0
has text: More than 12 hours I am still confusing with this layout. mmm
type: AnswerComment
comment on: http://stackoverflow.com/a/25173777
type: Comment

identifier
tag name: identifier
tags question: http://stackoverflow.com/q/25087067
type: Tag

http://stackoverflow.com/comment/39286451
score: 0
type: QuestionComment
type: Comment
has text: no my phone with os 2.3.6
comment on: http://stackoverflow.com/q/25222415

http://stackoverflow.com/comment/39272158
type: AnswerComment
score: 0
has text: check your order of if else statements for that, try reversing the order
type: Comment
comment on: http://stackoverflow.com/a/25214667

http://stackoverflow.com/comment/39240729
type: AnswerComment
has text: Very well said. Thank you.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25196057

http://stackoverflow.com/comment/39017215
score: 0
type: Comment
has text: I do not know if it would work the same with the previous instructions of the file. Better properties by specifying the path to the folder that contains the log
type: AnswerComment
comment on: http://stackoverflow.com/a/25077293

http://stackoverflow.com/comment/39251497
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25203992
has text: I've tried using without AsyncTask or a Thread. My app simply hangs there when there is a while loop. So my thought was to either implement an AsyncTask or a class that extends Runnable

http://stackoverflow.com/q/25217154
has answer: http://stackoverflow.com/a/25217182
tagged with: java
tagged with: overriding
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25217582
downvote count: 0
has comment: http://stackoverflow.com/comment/39276797
tagged with: polymorphism
favorite count: 0
has comment: http://stackoverflow.com/comment/39276776
tagged with: abstract-class
type: Question
score: 3
has title: Method overriding vs abstract method
has comment: http://stackoverflow.com/comment/39276808
has body: We use abstract method to implement it in a different sub classes for different scenarios. Like abstract class Animal will have abstract method makeNoise(). Subclass Dog and Cat will implement this abstract method to print "bark" and "meow", respectively But I want to know that how is it different than method overriding where we can use two classes with its own method makeNoise() for itself? In both cases we instantiate the both sub classes to perform the actual task then how it would be efficient to use abstract method.
upvote count: 3
answer count: 2

http://stackoverflow.com/comment/39211729
type: Comment
comment on: http://stackoverflow.com/q/25182774
has text: even if i do that it wont work, kitkat just wont let me write to an external directory
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39155909
type: Comment
has text: [Here's the `String` class javadoc.](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html)
comment on: http://stackoverflow.com/q/25152325
score: 0
type: QuestionComment

http://stackoverflow.com/q/25104995
has title: GWT project doesn't build server side code
score: 0
answer count: 1
tagged with: tomcat
has answer: http://stackoverflow.com/a/25105587
has body: I'm novice in GWT and trying to build my first GWT application. I downloaded GWT 2.6.1 and created demo application ('mydemo') using webApplicationCreator. It works perferct on my developer machine. Then, I want to deploy this application to production server. I installed Apache Tomcat which requires war package. Well, I created war package. But it doesn't contain file mydemo.jar with server-side code (GreetingServiceImpl). So, I need to configure build.xml to create .jar file with server side of my GWT application. Please, help.
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: gwt
tagged with: ant

http://stackoverflow.com/a/25215552
has body: There is a method on javax.mail.Folder that allows you to retrieve messages from a start/end. You'd just need to keep track of the last position you retrieved from. public Message[] getMessages(int start, int end) throws MessagingException Get the Message objects for message numbers ranging from start through end, both start and end inclusive. Note that message numbers start at 1, not 0. Message objects are light-weight references to the actual message that get filled up on demand. Hence Folder implementations are expected to provide light-weight Message objects. This implementation uses getMessage(index) to obtain the required Message objects. Note that the returned array must contain (end-start+1) Message objects. Parameters: start - the number of the first message end - the number of the last message Returns: the Message objects Throws: FolderNotFoundException - if this folder does not exist. IllegalStateException - if this folder is not opened. java.lang.IndexOutOfBoundsException - if the start or end message numbers are out of range. MessagingException
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25215272
score: 6
type: Answer
accepted answer of: http://stackoverflow.com/q/25215272
upvote count: 6

http://stackoverflow.com/q/25085910
tagged with: java
has comment: http://stackoverflow.com/comment/39032923
tagged with: inputmismatchexception
has comment: http://stackoverflow.com/comment/39033103
score: 0
has comment: http://stackoverflow.com/comment/39032655
has comment: http://stackoverflow.com/comment/39033358
answer count: 1
tagged with: arrays
has body: I am trying to write an Inventory program for my Java class. This program needs to read initial Inventory data from a .txt file (iterating a set amount of times - defined by the 1st integer in the inv.txt file we are using). My text file is correct, Scanners, Arrays, and Loops seem to be correct, however I am getting an InputMismatchException. The .txt file is formatted as follows: XXXX - Count - # of times to iterate XXXX - Product Code XXXX -Quantity On Hand XXXX - Reorder Level Where the Product Code, QOH, and Reorder Level are repeated for each product, the COUNT is only in the file once. All values must be read, and each stored in their own respective array. import javax.swing.*; import java.util.*; import java.sql.*; import java.math.*; import java.*; import java.io.*; public class Lab7Test2 { public static void main (String [] args) throws IOException { int count = 0; //To hold Max Count (Max Iterations Expected) int countAt = 0; //To hold Current Count. int number = 0; //To hold a number. int number2 = 0; //To hold a 2nd Number. int index = 0; //Index Placeholder. int index2 = 0; int index3 = 0; int[] partNumb; int[] qoh; //Holds Product's Quantity On Hand (QOH) int[] reorder; //Minimum Reorder Level int[] transNumb; int[] transType; int[] transAmt; String[] status; //Holds Product's Inventory Status as String. String[] error; //Holds Error Messages associated with Transactions. String input; String output; //Holds output for transaction Log. Scanner keyboard = new Scanner(System.in); File openFile; Scanner scanFile; //----End of Variable Declaration--- ///////////////////////////////////////////// //----Begin Program Execution----//////////////////////////////////////////////////// System.out.println("Enter the Inventory File Name."); input = keyboard.nextLine(); if(!input.contains(".txt")) //If Input has no '.txt' extension, error message. { while(!input.contains(".txt")) //Repeat error if no '.txt' extension found. { System.out.println("Invalid Input"); S…
has comment: http://stackoverflow.com/comment/39033272
has title: Java InputMismatchException Errors
has comment: http://stackoverflow.com/comment/39032313
has comment: http://stackoverflow.com/comment/39033188
tagged with: file-io
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39033164
has answer: http://stackoverflow.com/a/25086568
has comment: http://stackoverflow.com/comment/39032310
has comment: http://stackoverflow.com/comment/39033265
has comment: http://stackoverflow.com/comment/39032351
tagged with: loops
has comment: http://stackoverflow.com/comment/39033088
has comment: http://stackoverflow.com/comment/39032865
type: Question

http://stackoverflow.com/comment/39708382
comment on: http://stackoverflow.com/a/25448374
type: Comment
has text: Thanks, i go the traditional AspectJ way, i never will imagined that i can embed an aspect in an interface :D
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39283271
type: QuestionComment
score: 2
has text: OK I see that I had an `if` in `onCreate` that could bypass the initialization of the adapter in certain situations. It's now fixed. Thanks everyone.
comment on: http://stackoverflow.com/q/25220522
type: Comment

http://stackoverflow.com/q/25076962
answer count: 0
type: UnansweredQuestion
tagged with: java
has title: How to solve connection time out in Apache Tomcat with application hosted in Microsoft Azure Ubuntu 64-bit instance?
type: Question
has comment: http://stackoverflow.com/comment/39016499
tagged with: apache
has body: I have deployed an application over Apache Tomcat 8.0.3 which takes some time to respond (say 3-4 minutes). I have set in the server.xml the following configuration &lt;Connector port="8084" protocol="HTTP/1.1" connectionTimeout="900000" redirectPort="8443" /&gt; But still the connection times out after like a minute or so. P.S. I am using the organizational network, hence there is a proxy, in which probably the time out actually happens (just guessing). Is there a way of adding some gifs which might act as response from the server and the connection wouldn't timeout? If so, how and where to add?
tagged with: tomcat
score: 0
tagged with: azure
has comment: http://stackoverflow.com/comment/39015255

http://stackoverflow.com/q/25177762
has comment: http://stackoverflow.com/comment/39202578
tagged with: wmi
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/25177843
favorite count: 0
type: UnansweredQuestion
has body: I would like to write a wmi and Java, or both, program that automatically finds and identifies display devices connected to my computer (Windows) is monitor or projector. Any ideas how this can be done?
has title: How to identify if your screen device is projector or monitor
downvote count: 0
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/39289352
comment on: http://stackoverflow.com/q/25223421
type: Comment
type: QuestionComment
score: 0
has text: @vanOekel First of all, you should make this an answer because it is extremely useful. Also, I have a follow-up question: Assuming the thread is stuck, then ALL thread dumps prior to restarting Tomcat would still show it doing the same task, right? In other words, Tomcat never kills a stuck thread. If that's the case, I can take another thread dump now and see if it is still there :)

http://stackoverflow.com/q/25228843
type: AnsweredQuestion
tagged with: java
has body: I want mouse cursor changing when mouse is on a static text (not clicking on it,only changing on the area of static text). I found these java cods in undocumented-matlab: jb = javax.swing.JButton; jb.setCursor(java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); I copied these codes in CreareFcn and ButtonDownFcn of static text but nothing changed and everything was as default. How can I do this and where should I put these codes in static text? Thanks.
type: Question
has answer: http://stackoverflow.com/a/25231143
has title: Change mouse courser when mouse is passing the static text in MATLAB
score: 0
tagged with: user-interface
answer count: 1
accepted answer: http://stackoverflow.com/a/25231143
tagged with: matlab-guide
tagged with: matlab
tagged with: text

http://stackoverflow.com/comment/107333147
comment on: http://stackoverflow.com/a/59948076
score: 1
type: AnswerComment
has text: Perfect! 3Q~~~~~
type: Comment

http://stackoverflow.com/comment/39079136
type: Comment
comment on: http://stackoverflow.com/a/25110933
score: 0
type: AnswerComment
has text: if you put it inside the loop just remove double average; , double total, and average=total/x; from the loop and put it outside the for loop.

http://stackoverflow.com/q/25117501
tagged with: sql
has comment: http://stackoverflow.com/comment/39091195
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/25118152
has comment: http://stackoverflow.com/comment/39091169
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25118186
tagged with: mysql
has title: Update Data Records on MySQL using user input
has answer: http://stackoverflow.com/a/25118186
type: Question
has comment: http://stackoverflow.com/comment/39091563
answer count: 2
has body: Ok I have this issue. I need to update a record on my DB but I am having trouble because of my SQL syntax. By pressing the "Update Name" button, 2 messages pop up and the user selects the former name and the new name for the Table. But the statement is never executed and the names wont change. My main goal is to "resolve" the id from the 1st statement to a variable String name_1 = "SELECT id FROM consoles WHERE name LIKE ? "; and add it here String name = "UPDATE consoles SET name = ? WHERE id = ?"; Is it possible to resolve to a variable the id I get from my 1st statement? try { Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/test1?user=me&amp;password=12345"); String name_1 = "SELECT id FROM consoles WHERE name LIKE ? "; String name = "UPDATE consoles SET name = ? WHERE name LIKE ?"; PreparedStatement psname = conn.prepareStatement(name); PreparedStatement psname_1 = conn.prepareStatement(name_1); String strin = JOptionPane.showInputDialog(null,"Previous Name : "); String strout = JOptionPane.showInputDialog(null,"New Name : "); psname.setString(1,strin); psname.setString(2,"%" +strout+ "%"); psname_1.setString(1,"%"+strin+"%"); psname.executeUpdate(); Statement stmtname = conn.createStatement(); // show the updated table ResultSet rsname = stmtname.executeQuery("SELECT * FROM consoles INNER JOIN hardware ON consoles.id=hardware.id"); . . . ADDING THEM TO A JTABLE . . .
has answer: http://stackoverflow.com/a/25118152
score: 0
has comment: http://stackoverflow.com/comment/39092017
has comment: http://stackoverflow.com/comment/39091345
has comment: http://stackoverflow.com/comment/39091792

http://stackoverflow.com/comment/39045770
type: Comment
comment on: http://stackoverflow.com/q/25092384
type: QuestionComment
score: 0
has text: Do you mean you have a .doc with , let's say, 100 paragraphs, and you want to have 2 .doc files: the 1st will have paragraphs 21-30, and the second - all the paragraphs EXCEPT 21-30, which is 1-20 and 31-100. If you want to split like that, than it seems to me that `doc.getRange()` will not work, as it takes ALL the paragraphs. Can you precise, what is your criteria to SPLIT? Maybe you want to extract one specific **chapter** into another file?

http://stackoverflow.com/q/25196795
type: Question
has body: I want to execute an insertion query with some parameters in my android app. For example in php it is something like:- $query ="insert into inventoryproductrel(id, productid, sequence_no, quantity, listprice) values(?,?,?,?,?)"; $qparams = array($id,$prod['prod'],$counter,$prod['pcs'],$prod['price']); $productadded=$adb-&gt;pquery($query,$qparams); Here pquery is a function:- function pquery($sql, $params){ global $log, $default_charset; $log-&gt;debug('Prepared sql query being executed : '.$sql); $this-&gt;checkConnection(); $this-&gt;executeSetNamesUTF8SQL(); $sql_start_time = microtime(true); $params = $this-&gt;flatten_array($params); if (count($params) &gt; 0) { $log-&gt;debug('Prepared sql query parameters : [' . implode(",", $params) . ']'); } if($this-&gt;avoidPreparedSql || empty($params)) { $sql = $this-&gt;convert2Sql($sql, $params); $result = &amp;$this-&gt;database-&gt;Execute($sql); } else { $result = &amp;$this-&gt;database-&gt;Execute($sql, $params); } $sql_end_time = microtime(true); $this-&gt;logSqlTiming($sql_start_time, $sql_end_time, $sql, $params); $this-&gt;lastmysqlrow = -1; return $result; } I don't know how to do this i.e. executing a query with parameters in java/android.
has answer: http://stackoverflow.com/a/25197114
score: 0
answer count: 2
tagged with: sql
possible better answer: http://stackoverflow.com/a/25196904
has answer: http://stackoverflow.com/a/25196904
has title: How to send a query with parameters
has comment: http://stackoverflow.com/comment/39238420
accepted answer: http://stackoverflow.com/a/25197114
tagged with: android
tagged with: php
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39238511
tagged with: java

http://stackoverflow.com/comment/39102424
score: 1
comment on: http://stackoverflow.com/q/25117713
type: Comment
type: QuestionComment
has text: @biziclop I was using the House to create an example that shows the *principle, nothing more* of retrieving elements from a `Set`. The data I'm dealing with is completely different, both their identifying and their optional values are defined in RFCs. As I said: Two instances should be equal when they refer to the same real-world object. ...so now I'm curious: Would *you* include the comment in `equals()`? You contradicted yourself: The 2 Cookies should be considered equal while being distiguishable from each other.

http://stackoverflow.com/comment/39067349
comment on: http://stackoverflow.com/q/25104915
score: 0
type: QuestionComment
type: Comment
has text: try using a static function or pass the context via the class constructor...

transactional
tags question: http://stackoverflow.com/q/25076718
tags question: http://stackoverflow.com/q/25150270
tag name: transactional
tags question: http://stackoverflow.com/q/25165969
type: Tag

datetime-format
tags question: http://stackoverflow.com/q/25193686
tags question: http://stackoverflow.com/q/25229124
tag name: datetime-format
tags question: http://stackoverflow.com/q/25199644
tags question: http://stackoverflow.com/q/25202371
type: Tag

http://stackoverflow.com/a/25152689
score: 0
has comment: http://stackoverflow.com/comment/39156932
answers question: http://stackoverflow.com/q/25152109
type: Answer
has body: there seem to be a mismatch with your json string and the class. your json string [ { "total": 4 }, { "id": "93985", "v": "HDB Hougang", "a": "540 Hougang Avenue 8. (S)530540", "t": "1", "pid": "3522", "aid": "84527", "lid": "93985", "cat": "99", "x": "103.891085", "y": "1.377791", "bld": "1", "ad": "0", "tbiz": "1", "hsp": 1 }, { "id": "250286", "v": "SCDF Bomb Shelter @ 540 Hougang Avenue 8", "a": "540 Hougang Avenue 8. (S)530540", "t": "1", "pid": "49896", "aid": "84527", "lid": "250286", "cat": "1073", "x": "103.891085", "y": "1.377791", "bld": "0", "ad": "0", "tbiz": "1", "hsp": 1 }, { "id": "386730", "v": "Everhealth Medical Centre Pte Ltd", "a": "540 Hougang Avenue 8. (S)530540", "t": "2", "pid": "3522", "aid": "84527", "lid": "93985", "cat": "508", "cid": "189715", "b": "1", "tel": "63850815", "x": "103.891085", "y": "1.377791", "bld": "0", "ad": "0", "pcn": "HDB Hougang", "hsp": 1 }, { "id": "370197", "v": "Glory Centre Community Services Association", "a": "540 Hougang Avenue 8. (S)530540", "t": "2", "pid": "3522", "aid": "84527", "lid": "93985", "cat": "133", "cid": "179210", "b": "1", "tel": "63863039", "x": "103.891085", "y": "1.377791", "bld": "0", "ad": "0", "pcn": "HDB Hougang", "hsp": 1 } ] should be like this based in your class [ { "total": 4, "info" : [ { "id": "93985", "v": "HDB Hougang", "a": "540 Hougang Avenue 8. (S)530540", "t": "1", "pid": "3522", "aid": "84527", "lid": "93985", "cat": "99", "x": "103.891085", "y": "1.377791", "bld": "1", "ad": "0", "tbiz": "1", "hsp": 1 }, { "id": "250286", "v": "SCDF Bomb Shelter @ 540 Hougang Avenue 8", "a": "540 Hougang Avenue 8. (S)530540", "t": "1", "pid": "49896", "aid": "84527", "lid": "250286", "cat": "1073", "x": "103.891085", "y": "1.377791", "bld": "0", "ad": "0", "tbiz": "1", "hsp": 1 }, { "id": "386730", "v": "Everhealth Medical Centre Pte Ltd", "a": "540 Hougang Avenue 8. (S)530540", "t": "2", "pid": "3522", "aid": "84527", "lid": "93985", "cat": "508", "cid": "189715", "b": "1", "tel": "6385…

http://stackoverflow.com/q/25147384
has comment: http://stackoverflow.com/comment/39147864
type: Question
score: 0
has comment: http://stackoverflow.com/comment/39147664
has body: I am writing a stylish CLI in Java using Swing and the Graphics2d APIs but am having a problem reverse stacking the output of any given input. In other words, most layout managers seem to position from Left to Right or Top to Bottom and none of them seem to be able to insert into the middle or between two JComponents or move one component up and above after a new component been added/repainted/revalidated. Any help or direction is much appreciated, as I have tried searching and am unable to find an answer to this question. This is essentially what I'm looking for: User inputs command and presses enter, input is output along with whatever else that needs to follow, user can then type in next command.
has answer: http://stackoverflow.com/a/25151064
answer count: 1
has comment: http://stackoverflow.com/comment/39147829
has comment: http://stackoverflow.com/comment/39149155
has comment: http://stackoverflow.com/comment/39149649
has comment: http://stackoverflow.com/comment/39150304
linked to: http://stackoverflow.com/q/24725420
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/39148940
has comment: http://stackoverflow.com/comment/39146927
has title: Stacking/inserting JComponents from bottom up (similar to what a CLI does)
has comment: http://stackoverflow.com/comment/39148493
tagged with: java
has comment: http://stackoverflow.com/comment/39147307

http://stackoverflow.com/q/25211367
has comment: http://stackoverflow.com/comment/39265829
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39265982
upvote count: 1
type: Question
has title: Parsing xml content line by line and extracting some values from it
has comment: http://stackoverflow.com/comment/39265787
linked to: http://stackoverflow.com/q/1732348
has body: How can I elegantly extract these values from the following text content ? I have this long file that contains thousands of entries. I tried the XML Parser and Slurper approach, but I ran out of memory. I have only 1GB. So now I'm reading the file line by line and extract the values. But I think there should be a better in Java/Groovy to do this, maybe a cleaner and reusable way. (I read the content from Standard-In) 1 line of Content: &lt;sample t="336" lt="0" ts="1406036100481" s="true" lb="txt1016.pb" rc="" rm="" tn="Thread Group 1-9" dt="" by="0"/&gt; My Groovy Solution: Map&lt;String, List&lt;Integer&gt;&gt; requestSet = new HashMap&lt;String, List&lt;Integer&gt;&gt;(); String reqName; String[] tmpData; Integer reqTime; System.in.eachLine() { line -&gt; if (line.find("sample")){ tmpData = line.split(" "); reqTime = Integer.parseInt(tmpData[1].replaceAll('"', '').replaceAll("t=", "")); reqName = tmpData[5].replaceAll('"', '').replaceAll("lb=", ""); if (requestSet.containsKey(reqName)){ List&lt;Integer&gt; myList = requestSet.get(reqName); myList.add(reqTime); requestSet.put(reqName, myList); }else{ List&lt;Integer&gt; myList = new ArrayList&lt;Integer&gt;(); myList.add(reqTime); requestSet.put(reqName, myList); } } } Any suggestion or code snippets that improve this ?
tagged with: groovy
tagged with: xml-parsing
downvote count: 0
has comment: http://stackoverflow.com/comment/39266416
favorite count: 0
tagged with: parsing
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39265738
linked to: http://stackoverflow.com/q/3969713

http://stackoverflow.com/a/27804625
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25213145
has body: I had the same problem and tried almost every possible solution in the stackoverflow and almost whole internet but couldn't find the solution anywhere. But than somehow i realized that my project has some warnings that say "duplicate android support library on the projects". The messages say that the support libraries in my project and in a library project that i use inside my project has different versions of support libraries. So i tried to solve this problem as deleting the support library in my own project and voila! The "different versions of android support library" and "NoClassDefFoundError com.google.android.gms.ads.AdView" have gone! So my advice is to check the console and the android logs if there happens to be any warnings or errors in the project. The goolge_play_services-lib project must be included to your project only by the andorid settings inside properties. You mustn't add any jars externally. Also be sure to use the latest version of the google play services lib. I hope this will help you because i just worked nearly 2 days on this issue to solve, regards.

http://stackoverflow.com/q/25180446
has title: Interface is not allowed inside methods
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39207924
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/39207876
accepted answer: http://stackoverflow.com/a/25180501
type: Question
has comment: http://stackoverflow.com/comment/39207301
score: 5
has comment: http://stackoverflow.com/comment/39209065
has comment: http://stackoverflow.com/comment/39207756
answer count: 1
upvote count: 6
has comment: http://stackoverflow.com/comment/67724582
has comment: http://stackoverflow.com/comment/39208711
has comment: http://stackoverflow.com/comment/39208606
has answer: http://stackoverflow.com/a/25180501
favorite count: 0
has comment: http://stackoverflow.com/comment/39208823
has comment: http://stackoverflow.com/comment/39207253
tagged with: interface
downvote count: 1
has comment: http://stackoverflow.com/comment/39208507
has body: I have studied some books for OCPJP 7 certification and in the inner classes chapter there were some strange/incomplete informations. I've tried to create an interface inside a method, but it seems you can't do that, you can only create classes inside a method. Is there any reason why you can't do that or it's just a missing feature? Sample code: public class Outer { public void method() { class C {} // allowed interface I {} // interface not allowed here } }
tagged with: scjp

http://stackoverflow.com/comment/39293605
score: 0
type: Comment
type: QuestionComment
has text: Which jsp file you have in your application? index,default or hello world.jso
comment on: http://stackoverflow.com/q/25226308

http://stackoverflow.com/a/25227686
type: Answer
has body: First you have wrong calculation here. inF = inC + 1.8 + 32; here is working code. if (choice.equals("From Kelvin")) { inC = toConvert - 273.15; inF = (inC * 1.8) + 32; out.println("In degrees Celsius, " + toConvert + " degrees Kelvin would be " + inC + " degrees."); out.println("In degrees Fahrenheit, " + toConvert + " degrees Kelvin would be " + inF + " degrees."); } if (choice.equals("From Fahrenheit")) { inC = toConvert - 32 / 1.8; inK = (toConvert - 32 / 1.8) + 273.15; out.println("In degrees Celsius, " + toConvert + " degrees Fahrenheit would be " + inC + " degrees."); out.println("In degrees Kelvin, " + toConvert + " degrees Fahrenheit would be " + inK + " degrees."); }
answers question: http://stackoverflow.com/q/25227603
score: 0

http://stackoverflow.com/comment/40853745
comment on: http://stackoverflow.com/a/26053863
type: Comment
has text: Thank you for the answer. There is not much alternatives to ldap in java, I'm current using apache directory API. OpenDJ appear to be good, my first impression reading the examples is a little more verbose than apache, but the documentation is far more complete, because apache is relative new.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25192164
possible better answer: http://stackoverflow.com/a/25192382
has title: If I have multiple threads in my program, does each thread technically have it's own stack? Does each thread have it's own heap?
has answer: http://stackoverflow.com/a/25192382
has comment: http://stackoverflow.com/comment/39230028
has comment: http://stackoverflow.com/comment/39229961
tagged with: multithreading
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39229873
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39234701
type: Question
has answer: http://stackoverflow.com/a/25192189
has comment: http://stackoverflow.com/comment/39253826
has comment: http://stackoverflow.com/comment/39231361
accepted answer: http://stackoverflow.com/a/25192189
has comment: http://stackoverflow.com/comment/39230296
answer count: 2
has comment: http://stackoverflow.com/comment/39230958
has body: I have been trying to find the answer to this question in the API (and with Google) but I am not able to find anything that directly discusses the state of the call stack and heap in a multi-threaded program. Also, does a synchronised object get flip flopped between both stacks (assuming they are seperate stacks)
has comment: http://stackoverflow.com/comment/39253938

http://stackoverflow.com/a/26743626
answers question: http://stackoverflow.com/q/25198726
upvote count: 1
has body: I share my 100% score Java solution: class Solution { public int solution(int[] A) { final int size = A.length; long sumMin = (int)A[0]; long sumMax = 0; for (int i = 1; i &lt; size; i++) { sumMax += (int)A[i]; } int minDif = (int)Math.abs(sumMax - sumMin); for (int i = 1; i &lt; size; i++) { int dif = (int)Math.abs(sumMax - sumMin); if (dif &lt; minDif) { minDif = dif; } sumMin += A[i]; sumMax -= A[i]; } return minDif; } } The trick is that looping the array twice your complexity is 2N, which is O(N). Addition results should be 'long' in order not to have problems with big extremes.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/52630990
score: 1

http://stackoverflow.com/comment/39133158
score: 0
type: Comment
type: QuestionComment
has text: Ultimately I think you're looking for the [partial mocks capabilities of Mockito](http://docs.mockito.googlecode.com/hg/org/mockito/Mockito.html#16)
comment on: http://stackoverflow.com/q/25139369

http://stackoverflow.com/comment/39170497
type: QuestionComment
comment on: http://stackoverflow.com/q/25156122
has text: @DanGetz Yes I think the root of the problem is that some of the files I'm piping in are not formatted correctly. However, in the live environment the files are produced by another processing system so I don't have control over their production. I need it to handle malformed files as well. Weirdly, if I de-compress by reading the compressed input stream into a `InflaterOutputStream` the malformed files de-compress correctly.
score: 0
type: Comment

http://stackoverflow.com/comment/39222140
has text: Yes, instead of implementing Runnable you implement Callable<T>. You will have rename your run() method to call() and make it return T for it to work.
type: Comment
comment on: http://stackoverflow.com/a/25119376
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39020813
type: Comment
has text: @TheLostMind if you have 5 values (not in list or array) the only way is to compare all the values against each other. also the solution would be only good for 5 values , no more, no less.
type: AnswerComment
comment on: http://stackoverflow.com/a/25079576
score: 0

http://stackoverflow.com/q/25178211
tagged with: chain
has body: I have a certificate for a Glassfish server within a Java keystore. It has a 4part certificate chain, which I can see with the list command. Now one of the intermediate CA certificates has been revoked and I have to change the chain of my certificate, because it is now untrusted. In the Windows IIS I have added the new intermediate certificate to the certificate store and all was fine. For the Java keystore I have no idea how I could do that? Should I export the certificate incl. the chain as PEM and replace the text parts for the intermediate CA? The CA says, I don't have to use a new certificate, it is only necessary to correct the chain, so it makes no sense to generate a new certificate request. Any ideas?
answer count: 0
linked to: http://stackoverflow.com/q/31441070
type: UnansweredQuestion
tagged with: keystore
upvote count: 1
has title: Edit certificate chain in Java keystore
score: 1
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/39205121
favorite count: 0
tagged with: ca
has comment: http://stackoverflow.com/comment/50851479
has comment: http://stackoverflow.com/comment/39203395

http://stackoverflow.com/a/25199768
has comment: http://stackoverflow.com/comment/39243774
has body: In your first example Circle c is a member variable. You create an instance of this class when an instance of your class C is created. When you call the method in your static method there is no instance of Circle c. Your 2nd example works cause you create the instance in your method and call it in there. Your 3rd example works because it is a member variabel and a member method so java can be sure the is an instance of Circle c before your method2() is called. I hope I could help.
score: 0
answers question: http://stackoverflow.com/q/25199676
type: Answer

http://stackoverflow.com/comment/39217760
score: 0
comment on: http://stackoverflow.com/q/25182014
type: Comment
type: QuestionComment
has text: I had actually asked [a similar question](http://stackoverflow.com/questions/15147118/displaying-timeout-warning-within-jquery) that would certainly apply in your situation (since the main timeout logic is done in JQuery)

http://stackoverflow.com/comment/39258153
has text: After I modify `@JsonSerialize(include = Inclusion.NON_NULL)` to `@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)` it works great. Thank you!
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25203918
score: 0

http://stackoverflow.com/a/26668686
upvote count: 9
has comment: http://stackoverflow.com/comment/64405647
has comment: http://stackoverflow.com/comment/64142744
score: 8
has comment: http://stackoverflow.com/comment/41942523
type: Answer
answers question: http://stackoverflow.com/q/25113154
has comment: http://stackoverflow.com/comment/64405294
has body: You can use webContentInterceptor resource to allow static resource caching. &lt;mvc:interceptors&gt; &lt;mvc:interceptor&gt; &lt;mvc:mapping path="/static/*"/&gt; &lt;bean id="webContentInterceptor" class="org.springframework.web.servlet.mvc.WebContentInterceptor"&gt; &lt;property name="cacheSeconds" value="31556926"/&gt; &lt;property name="useExpiresHeader" value="true"/&gt; &lt;property name="useCacheControlHeader" value="true"/&gt; &lt;property name="useCacheControlNoStore" value="true"/&gt; &lt;/bean&gt; &lt;/mvc:interceptor&gt; &lt;/mvc:interceptors&gt; Using annotations to configure cache interceptors is done following way. In your web config class you can add a bean for WebContentInterceptor class and add it into interceptors list. @Bean public WebContentInterceptor webContentInterceptor() { WebContentInterceptor interceptor = new WebContentInterceptor(); interceptor.setCacheSeconds(31556926); interceptor.setUseExpiresHeader(true);; interceptor.setUseCacheControlHeader(true); interceptor.setUseCacheControlNoStore(true); return interceptor; } @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(webContentInterceptor()); } Refer this site to see how it's done.
downvote count: 1

http://stackoverflow.com/q/25156065
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26128269
tagged with: rxtx
type: Question
has body: I'm looking for serial communication library RXTX in Google and can't find theirs official site. Are they gone? Where is place I could download RXTX lib and get some tutorials?
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39162514
favorite count: 0
accepted answer: http://stackoverflow.com/a/26128269
tagged with: serial-port
tagged with: java
upvote count: 1
has title: Serial communication library RXTX

http://stackoverflow.com/a/25078640
has comment: http://stackoverflow.com/comment/39017998
has comment: http://stackoverflow.com/comment/39019241
type: Answer
has comment: http://stackoverflow.com/comment/39018832
has body: if you want to compile different java files using this a program , you can try this method. public class Laj { private static void printLines(String name, InputStream ins) throws Exception { String line = null; BufferedReader in = new BufferedReader( new InputStreamReader(ins)); while ((line = in.readLine()) != null) { System.out.println(name + " " + line); } } private static void runProcess(String command) throws Exception { Process pro = Runtime.getRuntime().exec(command); printLines(command + " stdout:", pro.getInputStream()); printLines(command + " stderr:", pro.getErrorStream()); pro.waitFor(); System.out.println(command + " exitValue() " + pro.exitValue()); } public static void main(String[] args) { try { runProcess("javac YourDir/HelloWorld.java"); runProcess("java YourDir.HelloWorld"); } catch (Exception e) { e.printStackTrace(); } } } public class HelloWorld { public static void main(String[] args) { System.out.println("ok"); } }
answers question: http://stackoverflow.com/q/25078548
score: 0

http://stackoverflow.com/comment/39239959
comment on: http://stackoverflow.com/q/25196221
type: Comment
type: QuestionComment
has text: Sounds like this could be related to [floating point arithmetic](http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html).
score: 0

http://stackoverflow.com/q/25070289
has comment: http://stackoverflow.com/comment/39003233
tagged with: http://stackoverflow.com/tag/xml
has body: Could some PLEASE tell me where and how I fix this stupid namespace issue?! It should not be this hard to parse XML! JAXB unmarshalling exception; nested exception is javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"getRecordsResponse") Expected elements are: http://www.example.com/task}getRecords Here is the annotated class generated by JAXB2 and Maven. @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getRecordsResult" }) @XmlRootElement(name = "getRecordsResponse") public class GetRecordsResponse { How do I tell JAXB2 to add the correct namespace?
answer count: 0
tagged with: java
type: Question
has title: javax.xml.bind.UnmarshalException: unexpected element WTH?
score: 0
has comment: http://stackoverflow.com/comment/39003447
type: UnansweredQuestion

http://stackoverflow.com/q/25075921
has comment: http://stackoverflow.com/comment/39013655
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/39013481
score: 0
tagged with: sockets
tagged with: android
has comment: http://stackoverflow.com/comment/39014561
has body: I use a thread to test is socket connect every 5 second but sendUrgentData doesn't work this is my code class CheckSocketThread extends Thread { public void run() { boolean SocketConnect = true; while(SocketConnect){ try{ mSocket.sendUrgentData(0xFF); System.out.println("socket still connect"); Thread.sleep(5 * 1000); }catch(IOException e){ System.out.println("socket disconnect"); SocketConnect = false; break; } catch (InterruptedException e) { e.printStackTrace(); } } } } when I star the server activity and client activity logcat will show socket still connect every 5s but when I down the server, it still show socket still connect every 5s will not show socket disconnect , what's wrong on my code?
answer count: 0
has title: socket.sendUrgentData doesn't work in android
type: UnansweredQuestion

http://stackoverflow.com/comment/39219093
type: Comment
has text: OK you should configure your run configurations if the problem change to this :) Your maven goal should be something like : clean install
type: AnswerComment
comment on: http://stackoverflow.com/a/25186430
score: 0

http://stackoverflow.com/a/25159975
has body: You must put a UserData bean in a request attribute in your servlet before forwarding : UserData userinfo; userinfo.setFirstName(request.getParameter("firstName"); userinfo.setLastName(request.getParameter("lastName"); request.addAttribute("userinfo", userinfo); request.getRequestDispatcher("another.jsp").forward(request, response); If you want things to happen automatically, you will have to use a framework such as Struts2, Spring MVC, or ...
type: Answer
has comment: http://stackoverflow.com/comment/39170310
has comment: http://stackoverflow.com/comment/39170331
answers question: http://stackoverflow.com/q/25158481
accepted answer of: http://stackoverflow.com/q/25158481
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/25122538
downvote count: 0
has body: You are using double when you intend to do integer arithmetic. For example, when you write centena = nArms / 100; you are doing floating point division, (and centena is assigned the value 1.53) but you want to perform integer division. Use int, long (or BigInteger) instead.
accepted answer of: http://stackoverflow.com/q/25122452
type: Answer
answers question: http://stackoverflow.com/q/25122452
score: 2
has comment: http://stackoverflow.com/comment/39106105
has comment: http://stackoverflow.com/comment/39100874
upvote count: 2
has comment: http://stackoverflow.com/comment/39102778
type: AcceptedAnswer

http://stackoverflow.com/comment/39193302
score: 0
type: AnswerComment
has text: nothing is changed. I still can't get a result of a search.
type: Comment
comment on: http://stackoverflow.com/a/25172247

charts
tags question: http://stackoverflow.com/q/25186238
tags question: http://stackoverflow.com/q/25173177
type: Tag
tags question: http://stackoverflow.com/q/25162905
tag name: charts

http://stackoverflow.com/q/25109068
tagged with: jframe
type: UnansweredQuestion
has body: JButton is only appearing on MouseEnter I've tried multiple things but I can't seem to figure out how to get my JButton over the background graphics. . Does anybody know how I can paint over this background and have my button stay there? I would paste the code here but It would get a little messy, so heres some pastebin links! :) My Main class: http://pastebin.com/DvVfCU03 My MenuPanel class: http://pastebin.com/uht8cabX Here's a copy of the main class just in-case: public class Main { final static JFrame window = new JFrame(); final static ImageIcon imageIconOne = new ImageIcon(getConnectImage()); final static JButton connectB = new JButton(imageIconOne); public static void main(String[] args) throws IOException { window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setContentPane(new MenuPanel()); window.addKeyListener(new MenuPanel()); window.setMinimumSize(new Dimension(1024,640)); window.pack(); window.setTitle("Realm of Pixels"); window.setVisible(true); window.addMouseListener(new MouseHandler()); window.setVisible(true); window.add(connectB); connectB.setVisible(true); } public static Image getConnectImage(){ Image connectImage = null; try { connectImage = ImageIO.read(new File("Resources/Buttons/Connect.png")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return connectImage; } public static JFrame getWindow() { return window; } }
tagged with: swing
tagged with: jbutton
tagged with: graphics
tagged with: java
type: Question
score: 0
answer count: 1
has title: JButton is only appearing on MouseEnter
has answer: http://stackoverflow.com/a/25109127

http://stackoverflow.com/q/25156510
possible better answer: http://stackoverflow.com/a/25157060
has answer: http://stackoverflow.com/a/25157060
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: criteria-api
has answer: http://stackoverflow.com/a/25156781
score: 9
type: Question
answer count: 2
upvote count: 9
tagged with: jpa
has body: I'm trying to delete a bunch of objects with one query using the CriteriaBuilder API. I'm looking for something like this select: CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaQuery&lt;T&gt; query = criteriaBuilder.createQuery(entityClass); Root&lt;T&gt; root = query.from(entityClass); query.select(root).where(/*some condition*/); return entityManager.createQuery(query).getResultList(); but then a delete instead of a select. As far as I can see, there's no remove or delete method on CriteriaQuery. Is it possible using this API? I can of course execute the select, then call entityManager.remove(object) for each result, but that feels very inefficient.
accepted answer: http://stackoverflow.com/a/25156781
downvote count: 0
has title: Delete multiple objects at once using CriteriaBuilder
favorite count: 0

xmltype
tags question: http://stackoverflow.com/q/25208239
tag name: xmltype
type: Tag

http://stackoverflow.com/a/25187081
has body: You are declaring your balUser String within the first if statement, hence it is scoped locally. Declare it outside the first if statement and check for nulls in the second to make this go away.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25187040

http://stackoverflow.com/comment/39261058
type: Comment
type: QuestionComment
score: 0
has text: Try to import project using the war file in eclipse. If you have source code, your luck will work.
comment on: http://stackoverflow.com/q/25207610

http://stackoverflow.com/q/25119034
has body: I have a code like this : private void jTable4MouseClicked(java.awt.event.MouseEvent evt) { if (evt.getClickCount() == 1) { System.out.println("clicked"); int row = jTable4.getSelectedRow(); if (row != -1) { String firstColumnValue = jTable4.getModel().getValueAt(row, 0).toString(); String secondColumnValue = jTable4.getModel().getValueAt(row, 1).toString(); jTextAreaMainFileHighlight.setText(firstColumnValue); // just show name of a file jTextAreaComparingFileHighlighter.setText(secondColumnValue); // just show name of a file } You know, the jtabel is contains a name of file. How to read that file to and then show in jTextArea
has title: Read a file in a jtable
has answer: http://stackoverflow.com/a/25119154
type: UnansweredQuestion
tagged with: swing
tagged with: java
type: Question
tagged with: jtable
tagged with: jtextarea
answer count: 1
score: 0
tagged with: file-io

http://stackoverflow.com/comment/39212237
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25183046
has text: All I know is when the handler was not static, everything was working fine but Eclipse was warning me about leaks and said I had to make the handler static to avoid leaks. And the solution to that was dereferencing a WeakReference (whatever that means) and now my code is broken. But people who ask how to fix the leak with the non-static handler get told to do what I did, so I don't know what to do.

http://stackoverflow.com/q/25100724
has comment: http://stackoverflow.com/comment/39062726
tagged with: arrays
has title: JAVA changing from an array to a list and using the shuffle method
has body: I have an assignment to create a deck of cards and deal five random cards. I finally got it "working" but I need help with a couple things. One I just read that java now has a shuffle method to shuffle a list. We're on arrays right now so I think arrays were wanted is there a way to use the shuffle method with an array? If not can someone guide me in switching to a list? I think it will help with answer my next question. The only thing left for me to do is somehow state how many cards are left in the deck after the 5 random cards are dealt. However, seeing as how I'm using an array and you cannot remove items from an array because it's fixed (right?) I wanted to see if there was a way to simulate removing the cards from the array so that they aren't dealt again? Or would it just be easier to turn the arrays into a list/collection? Here is my code. Any help is greatly appreciated. Also, I'll take any suggestions on cleaning the code up too... public class CardGame { public static void main (String [] args) { DeckOfCards deck = new DeckOfCards(); //call shuffle deck.shuffle(1000); Card b; for (int i = 0; i &lt; 5; i++) { b = deck.deal(); System.out.println("Deal a card: " + b); } } } class Card { public static final int SPADE = 4; public static final int HEART = 3; public static final int CLUB = 2; public static final int DIAMOND = 1; private static final String[] Suit = {"*", "Hearts", "Clubs", "Spades", "Diamonds"}; private static final String[] Rank = {"*", "*", "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"}; private int cardSuit; private int cardRank; public Card( int suit, int rank ) { if ( rank == 1 ) cardRank = 14; // Give Ace the rank 14 else cardRank = (int) rank; cardSuit = (int) suit; } public int suit() { return ( this.cardSuit ); } public String suitStr() { return( this.Suit[ this.cardSuit ] ); } public int rank() { return ( this.cardRank ); } public String rankStr() { return ( Rank[ this.cardRank ] ); } public String toStri…
tagged with: list
type: UnansweredQuestion
tagged with: java
tagged with: methods
tagged with: collections
has answer: http://stackoverflow.com/a/25100933
type: Question
has answer: http://stackoverflow.com/a/25100846
has comment: http://stackoverflow.com/comment/39059807
linked to: http://stackoverflow.com/q/4228975
score: 0
answer count: 2

http://stackoverflow.com/a/54389241
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25198726
has body: TapeEquilibrium in Swift 4 public func solution(_ A : inout [Int]) -&gt; Int { let P = 1 var splitIndex = P var firstPartSum = A[splitIndex - 1] var secondPartSum = Array(A[splitIndex..&lt;A.count]).reduce(0, +) var minimalDifference = abs(firstPartSum - secondPartSum) if minimalDifference == 0 { return minimalDifference } splitIndex += 1 while splitIndex &lt; A.count { firstPartSum += A[splitIndex - 1] secondPartSum -= A[splitIndex - 1] let dif = abs(firstPartSum - secondPartSum) if dif == 0 { return dif } if dif &lt; minimalDifference { minimalDifference = dif } splitIndex += 1 } return minimalDifference }

http://stackoverflow.com/comment/39274187
comment on: http://stackoverflow.com/a/25215697
type: AnswerComment
type: Comment
score: 1
has text: Tried it. Scanner buffers the input as well :(

http://stackoverflow.com/comment/39057342
comment on: http://stackoverflow.com/q/25097768
type: Comment
type: QuestionComment
has text: Should it work, right?
score: 0

http://stackoverflow.com/comment/127707768
type: Comment
comment on: http://stackoverflow.com/a/64682790
type: AnswerComment
has text: If my server domain is amazon then what should be written into "your server domain"? www.amazon.com or amazon.com or amazon.in or secure.amazon.com? what?
score: 0

http://stackoverflow.com/comment/39263670
comment on: http://stackoverflow.com/a/25209766
score: 0
type: AnswerComment
has text: I answered your question you should accept the answer and make the corrections yourself. It is a good learning experience.
type: Comment

http://stackoverflow.com/q/25074846
has comment: http://stackoverflow.com/comment/39011437
type: UnansweredQuestion
has body: I'm newbie android. I have created an arraylist, ListView, and a CheckBox. I intend to take the text in the TextView, then I make a String (toString) on Checkbox. however I get a null pointer exception at Checkbox when be chosen. Help Me,,, Any help is appreciated :-) private ArrayList&lt;String&gt;simpan_makanan; private void SimpanMakanan() { LocalDate tanggal = new LocalDate(); ArrayList&lt;Gizi&gt; array = DataGizi.ambil(getActivity()).AmbilGizi(); for(String t_makanan : simpan_makanan){ AturVitamin vitamin = DataVitamin.get(t_makanan); AturMineral mineral = DataMineral.get(t_makanan); AturOther lain2 = DataLain2.get(t_makanan); for(Gizi g : array){ if(vitamin.ambilJumlahVitamin().containsKey(g.toString().toUpperCase()) &amp;&amp; vitamin.ambilJumlahVitamin().get(g.toString().toUpperCase()) !=0){ g.tambahnilai(vitamin.ambilJumlahVitamin().get(g.toString().toUpperCase()), tanggal); g.tambahsumbermakan(t_makanan); } else if (mineral.ambilJumlahMineral().containsKey(g.toString().toUpperCase()) &amp;&amp; mineral.ambilJumlahMineral().get(g.toString().toUpperCase()) !=0 ) { g.tambahnilai(mineral.ambilJumlahMineral().get(g.toString().toUpperCase()), tanggal); g.tambahsumbermakan(t_makanan); } else if (lain2.ambilJumlahJenisLain2().containsKey(g.toString().toUpperCase()) &amp;&amp; lain2.ambilJumlahJenisLain2().get(g.toString().toUpperCase()) !=0) { g.tambahnilai(lain2.ambilJumlahJenisLain2().get(g.toString().toUpperCase()), tanggal); g.tambahsumbermakan(t_makanan); } else { } } } DataGizi.ambil(getActivity()).aturGizi(array); } MyListAdapter private class MyListAdapter extends ArrayAdapter&lt;Makanan&gt; { public MyListAdapter(List&lt;Makanan&gt; a_makanan) { super(getActivity(),0, a_makanan); } @Override public View getView(int position, View convertView, ViewGroup parent) { View itemView = convertView; if (itemView == null) { itemView = getActivity().getLayoutInflater().inflate(R.layout.list_makanan, null); } Makanan makan = a_makanan.get(position); ImageView gambar…
tagged with: android
tagged with: checkbox
answer count: 0
has comment: http://stackoverflow.com/comment/39011044
type: Question
tagged with: java
tagged with: listview
score: 0
has comment: http://stackoverflow.com/comment/39012616
has title: Android : Null Pointer Exception Using CheckBox at ListView
has comment: http://stackoverflow.com/comment/39012471

http://stackoverflow.com/a/25135422
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/51865232
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/49604250
downvote count: 0
has body: I've found issue for my case. I checked version of Java in Lotus Notes and it was 1.5, once I up it to 1.6 it started work properly. Previously I was not able to change version of java, because it required to add variable to notes.ini: JavaCompilerTarget=1.6 Once you add this variable to notes.ini you can set any Java available in Designer.
accepted answer of: http://stackoverflow.com/q/25127757
score: 1
answers question: http://stackoverflow.com/q/25127757

http://stackoverflow.com/q/25080262
has comment: http://stackoverflow.com/comment/39021357
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25080394
has title: How to run a specific java file present in eclipse using batch file?
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39021107
upvote count: 2
has answer: http://stackoverflow.com/a/25080394
has comment: http://stackoverflow.com/comment/39021143
downvote count: 1
has body: I have to create a batch file such that it should call a specific java file present in eclipse.
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/615948

http://stackoverflow.com/a/25139186
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25126734
answers question: http://stackoverflow.com/q/25126734
type: Answer
has body: In order to make such Allure features like: attachments, steps and parameters work as expected you need to correctly specify -javaagent argument. Under Windows the following notation should work: org.apache.maven.plugins maven-surefire-plugin 2.16 -javaagent:"${settings.localRepository}\org\aspectj\aspectjweaver\${aspectj.version}\aspectjweaver-${aspectj.version}.jar" listener ru.yandex.qatools.allure.testng.AllureTestListener org.aspectj aspectjweaver ${aspectj.version} Note quotes around path. Without correct -javaagent specification your @Attachment, @Step and @Parameter annotations will be ignored by Allure.
upvote count: 3
has comment: http://stackoverflow.com/comment/39177204
has comment: http://stackoverflow.com/comment/39170333
score: 3

http://stackoverflow.com/q/25163067
accepted answer: http://stackoverflow.com/a/25163125
favorite count: 0
has answer: http://stackoverflow.com/a/25163125
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has body: This answer no doubt exists on SO, but I haven't found the right combination of search terms to come up with it. I have a method that I want to take a parameter that is of class A, but also implements interface B. How do I do it? e.g. public class MySubclassWithInterface extends MyClass implements MyInterface { } public class MySubclass extends MyClass { } public class MyInterfaceClass implements MyInterface { } public class MyOtherSubclassWithInterface extends MyClass implements MyInterface { } Out of the three classes above, I only want my method to accept an object that is MyClass and implements MyInterface, in other words, either MySubclassWithInterface or MyOthersubclassWithInterface but not MySubclass or MyIntefaceClass I very sheepishly tried the following which obviously failed: public void myMethod( (MyClass MyInterface) parameterName) { ... } Thanks for your help in advance.
answer count: 1
downvote count: 0
has title: Type check parameter is a (sub)class and also implements an interface

http://stackoverflow.com/comment/39253966
comment on: http://stackoverflow.com/a/25205156
type: AnswerComment
has text: Yes, I added all the tables at once, with a semicolon separating the create queries. I have not only tried uninstalling the app and reinstalling it, I've done a complete factory reset twice, uninstalling every single app and clearing it of all user generated data. I mentioned this in the original question, and the error still persists.
score: 0
type: Comment

http://stackoverflow.com/a/25093711
answers question: http://stackoverflow.com/q/25093512
downvote count: 0
score: 1
has body: From Your comment cells1 is ArrayList&lt;Cell&gt; so you are calling cells1.contains(s.getStringCellValue()); means finding String in ArrayList of Cells which will not do anything that's why it's going in to the else part. Ultimately you are trying to find String in Cells which is not possible directly. You have to compare String value of each cell (means cell's String value) of ArrayList&lt;Cell&gt; with your s.getStringCellValue() you have to override contains method or declare your own method. public boolean isThereAnyCellWithString(String str){ //Iterate over cells1 and compare //Use contains here if you want to or equals to find exact match for(HSSFCell cell : cells1){ if(cell.getStringCellValue().contains(str)) return true; } return false; }
type: Answer
upvote count: 1

http://stackoverflow.com/q/25137790
has title: Tomcat keep webapp api running
has body: I'm trying to create a web application for tomcat 7, but my problem is that I want to keep the whole backbone of the application running, so that my servlets can call the functions. Ex. I have my com.example.Main class which house all the instances to things like User managers and such. But instead of getting the main instance redefined on each servlet call, It would get defined once for all the servlets to use. Best Regards, - Roe
possible better answer: http://stackoverflow.com/a/25149050
has answer: http://stackoverflow.com/a/25137956
tagged with: servlets
answer count: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/70689
has comment: http://stackoverflow.com/comment/39128894
tagged with: tomcat
has comment: http://stackoverflow.com/comment/39128596
type: Question
accepted answer: http://stackoverflow.com/a/25137956
tagged with: tomcat7
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/137975
has answer: http://stackoverflow.com/a/25149050

http://stackoverflow.com/a/25094182
score: 2
has comment: http://stackoverflow.com/comment/39074796
upvote count: 2
has comment: http://stackoverflow.com/comment/39074678
answers question: http://stackoverflow.com/q/25087942
downvote count: 0
type: Answer
has body: Your should refer to dependencies already defined in your pom.xml. Have you done that under ? Like this: info.cukes cucumber-java 1.1.8 org.codehaus.mojo aspectj-maven-plugin 1.5 info.cukes cucumber-java See also AspectJ Maven plugin documentation.

http://stackoverflow.com/comment/39255750
comment on: http://stackoverflow.com/a/25205144
has text: @Bohemian from OP comment >preferably I would like to match "matching parenthesis" inside "(cmd:)" so it would help to match what he need but would not help with extra parances, which is imposible since java regexp doesnt support recurisve pattern (?R)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39062732
comment on: http://stackoverflow.com/q/25093088
type: Comment
has text: Post your full stacktrace here
score: 0
type: QuestionComment

http://stackoverflow.com/a/25221586
type: Answer
has comment: http://stackoverflow.com/comment/46794956
has comment: http://stackoverflow.com/comment/39285359
has comment: http://stackoverflow.com/comment/39286035
has body: I had similar situation, please check if: 1) You can run your sql script manualy (No SQL errors are shown when error occurs during import) 2) Please make sure that all sql statements are single-lined, eg: create table Table1{ column1, column2,etc.}; instead of create table Table1{ col1 .., col2 .., } I noticed these 2 issues when using import, hope this solves your problem too. [UPDATE] Thx to @vsapiha there is support for multiple lines sql: org.hibernate.tool.hbm2ddl.M‌​ultipleLinesSqlCommandExtractor
score: 5
upvote count: 5
accepted answer of: http://stackoverflow.com/q/25221332
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25221332

http://stackoverflow.com/q/25169490
has comment: http://stackoverflow.com/comment/39189617
type: UnansweredQuestion
tagged with: coding-style
tagged with: java
has comment: http://stackoverflow.com/comment/39189117
has comment: http://stackoverflow.com/comment/39188330
type: Question
has title: Why do we need CLASS_VERSION in java classes?
has body: I'm going through some legacy java code. In may classes I found a constant declared with name 'CLASS_VERSION'. I hope they got updated during build. And new build system doesn't even care this variable. I'd like to understand the significance of this variable? If this still valid, how do we use them? public static String CLASS_VERSION = "$Id: filename.java,v 1.17.2.1 2009/01/30 19:38:15 tims Exp $"; Appreciate your insights.
has comment: http://stackoverflow.com/comment/39189446
score: 0
has comment: http://stackoverflow.com/comment/39189222
has comment: http://stackoverflow.com/comment/39189235
answer count: 0

http://stackoverflow.com/comment/39153921
comment on: http://stackoverflow.com/q/25151097
has text: There's a much easier way to test this than to scrape the official status page - for each server you want to test, just try connecting to it!
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25224989
tagged with: tomcat
has body: I am using spring tcserver-2.9.5 (tomcat) as webserver. I want to access tomcat manager UI. I tried to access it by navigating to http://localhost:8080/manager/html but I get a blank page. I have added the below entry to my tomcat-users.xml &lt;user username="myadmin" password="adminPassword" roles="manager"/&gt; What I am missing here? Is 8080 not the right port for the tomcat manager UI?
type: UnansweredQuestion
score: 0
has title: How to access tomcat manager user interface?
has answer: http://stackoverflow.com/a/25225202
tagged with: java
type: Question
answer count: 1

http://stackoverflow.com/a/25214819
upvote count: 9
downvote count: 0
has body: In statistics (visualization) this is called a heat map. To compute the color for a given value, with MIN &lt;= value &lt; MAX, I would interpolate it onto the range Color.BLUE.getHue() - Color.RED.getHue(). i.e. double hue = Color.BLUE.getHue() + (Color.RED.getHue() - Color.BLUE.getHue()) * (value - MIN) / (MAX - MIN) ; Then use the hue to create the color with full saturation and brightness: Color color = Color.hsb(hue, 1.0, 1.0); To create the color scale image, create a WritableImage, grab the pixel writer, iterate over all pixels, and set the color of each pixel using the formula above with the value interpolated along the x axis from 0 to the width of the image. (If you want a vertical color scale, similarly interpolate along the y-axis.) Here's an example which draws the color scale. You can use the getColorForValue(...) method to compute the color for a given value, for displaying the matrix. import javafx.application.Application; import javafx.geometry.Orientation; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.image.PixelWriter; import javafx.scene.image.WritableImage; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.stage.Stage; public class HeatMap extends Application { private final static double MIN = 100 ; private final static double MAX = 1000 ; private final static double BLUE_HUE = Color.BLUE.getHue() ; private final static double RED_HUE = Color.RED.getHue() ; @Override public void start(Stage primaryStage) { Image colorScale = createColorScaleImage(600, 120, Orientation.HORIZONTAL); ImageView imageView = new ImageView(colorScale); StackPane root = new StackPane(imageView); Scene scene = new Scene(root, 800, 400); primaryStage.setScene(scene); primaryStage.show(); } private Color getColorForValue(double value) { if (value &lt; MIN || value &gt; MAX) { return Color.BLACK ; } double hue = BLUE_HUE + (RED_HUE - BLUE_HUE) * (value - MIN) / (MAX - …
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25214538
score: 9
type: Answer
answers question: http://stackoverflow.com/q/25214538
has comment: http://stackoverflow.com/comment/39283432

http://stackoverflow.com/comment/39007471
type: QuestionComment
comment on: http://stackoverflow.com/q/25072798
score: 0
type: Comment
has text: Step through it in the debugger - you'll learn more than getting other people to debug it for you.

http://stackoverflow.com/comment/39055582
has text: Is there a reason you are using Button instead of JButton?
comment on: http://stackoverflow.com/q/25098314
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25196203
favorite count: 0
has answer: http://stackoverflow.com/a/25196331
has body: I'm studying for my computer science final and am going back over some of the things that I never quite grasped when we went over them in class. The main thing being recursion. I think I've got the hang of the simple recursion example but am trying to work through one that was on a previous exam and am having trouble figuring out how it should be done. Here is the question: Texas numbers (Tx(n)) are defined as follows for non-negative numbers (assume true): Tx(n) = 10 if n is 0 Tx(n) = 5 if n is 1 Tx(n) = 2*(Tx(n-1) + Tx(n-2) if n &gt;= 2 We are then to write the recursion function for Texas numbers, after making some corrections after the test, here's what I've come up with, I think it's right, but not 100% sure. public int Tx(int n) { if(n == 0) return 10; else if (n == 1) return 5; else return 2*(Tx(n-1) + Tx(n-2)); } Then we are asked to computer the value of Tx(5). This is where I'm stuck. If the return statement for the else was simply n-1, I think I'd be able to figure it out, but the n-1 + n-2 is completely throwing me off. Can anyone explain how this would work, or share some links that have similar examples. I have tried looking this up online and in my textbook but the examples I've found are either so advanced that I have no clue what's going on, or they only deal with something like return n-1, which I already know how to do.
has title: Recursion and Recursive Methods
tagged with: recursion
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/25196286
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39237291
has comment: http://stackoverflow.com/comment/39237285
has answer: http://stackoverflow.com/a/25196665
accepted answer: http://stackoverflow.com/a/25196331
has answer: http://stackoverflow.com/a/25196286
downvote count: 1
has comment: http://stackoverflow.com/comment/39237193
has answer: http://stackoverflow.com/a/25196459
upvote count: 4
answer count: 4

http://stackoverflow.com/comment/39278318
type: QuestionComment
comment on: http://stackoverflow.com/q/25217996
score: 3
has text: Dude.. You've gotto check your design again.. So many loops?
type: Comment

http://stackoverflow.com/comment/39240966
comment on: http://stackoverflow.com/q/25197627
score: 1
has text: Can you clearAlternatives() before you write? If alternatives is null the tag won't be included.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39242022
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25198249
has text: Do you run the class or run it as a test case? The main method doesn't do anything with `@ContextConfiguration` or `@RunWith` it just runs the class and be done with it.

http://stackoverflow.com/a/25109565
answers question: http://stackoverflow.com/q/25109222
has comment: http://stackoverflow.com/comment/39077942
has body: I would recommend using the Window Builder add-on if you’re using Eclipse. This tool will help you with many aspects of Swing. Learn by doing. WindowBuilder Dowload Link
score: -1
has comment: http://stackoverflow.com/comment/39442087
downvote count: 1
upvote count: 0
type: Answer

http://stackoverflow.com/a/25227331
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25227306
has comment: http://stackoverflow.com/comment/39295774
downvote count: 0
has body: To get your desired result you have to pass an object of Animal class not the Animal class it self try : System.out.println(new Animal("Emu", "Australia")); instead of System.out.println(Animal); Your contructor method should be: public Animal(String name, String country){ this.commonNam=name; this.country=country; } And toString method: public String toString(){ return String.format("%s,%s",this.animal,this.country); }
has comment: http://stackoverflow.com/comment/39295740
has comment: http://stackoverflow.com/comment/39295533
type: Answer
has comment: http://stackoverflow.com/comment/39295397

http://stackoverflow.com/a/25115380
has comment: http://stackoverflow.com/comment/39101001
has comment: http://stackoverflow.com/comment/39087815
has comment: http://stackoverflow.com/comment/39087368
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39098130
type: Answer
has comment: http://stackoverflow.com/comment/39087342
accepted answer of: http://stackoverflow.com/q/25115104
has comment: http://stackoverflow.com/comment/39086906
has comment: http://stackoverflow.com/comment/39094766
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25115104
has body: If you see the docs of TabPanel's add() method. Convenience overload to allow IsWidget to be used directly. So any object of type IsWidget, you can add to it, weather it is a Chart, Graph etc .... Example

http://stackoverflow.com/comment/39118140
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25131473
type: Comment
has text: ok, but the number of field in "Update" is different in each json object, how to hande it??

http://stackoverflow.com/a/25200092
answers question: http://stackoverflow.com/q/25199764
type: Answer
downvote count: 0
score: 1
has body: DefaultCaret caret=(DefaultCaret)theJTextPaneInstance.getCaret(); caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); You can switch off the update policy.
upvote count: 1

http://stackoverflow.com/comment/39266954
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25211906
score: 0
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58993/discussion-between-user3218114-and-kevinn2065).

http://stackoverflow.com/q/25173184
type: Question
has comment: http://stackoverflow.com/comment/39194868
has comment: http://stackoverflow.com/comment/39195156
has title: How can I verify the date entered into DatePicker?
tagged with: date
score: 0
tagged with: javafx-8
answer count: 3
accepted answer: http://stackoverflow.com/a/25173419
has answer: http://stackoverflow.com/a/25173408
has body: I have problem with the code below: public DatePicker data = new DatePicker(); String date = "2014-08-15"; public void verify() { if (data.getValue().equals(date)) { System.out.println("Success!!!"); } } If date selected in the DatePicker (by mouse-click) is equal to the date of the String "date" variable, than I want that message to appear (actualy I want some coordinates to change but for you to understand I put a message).
tagged with: datepicker
has answer: http://stackoverflow.com/a/25173305
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25173305
tagged with: java
has answer: http://stackoverflow.com/a/25173419

http://stackoverflow.com/comment/63992434
type: Comment
comment on: http://stackoverflow.com/a/37298283
score: 3
type: AnswerComment
has text: This works good. Can you possibly tell me how to set the color of the background at runtime? Can't seem to figure it out. Thanks.

http://stackoverflow.com/comment/39202071
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25089160
has text: In distributed mode a trigger/hook can be executed on the node that get the request and/or all the nodes. That's the DistributedExecutionMode.
type: AnswerComment

http://stackoverflow.com/q/25090821
has answer: http://stackoverflow.com/a/26042203
favorite count: 0
has body: I'm having some problems with the ControlsFX progress bar dialog, could someone post a simple example of using one? I'm having a hard time figuring out how to update the progress bar and what type of Worker I should use. My Attempt: Dialogs dialogs = Dialogs.create(); dialogs.nativeTitleBar().title("Updating Population List").masthead("Updating the population table") .message("The population table is being updated, please be patient.") .owner(this.addNewPerson.getScene().getWindow()).showWorkerProgress(????);
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26042203
upvote count: 1
type: Question
score: 1
has title: SImple Progress Bar for ControlsFX
tagged with: java
tagged with: javafx
answer count: 1
tagged with: user-interface
downvote count: 0

http://stackoverflow.com/comment/39187452
comment on: http://stackoverflow.com/q/25169303
type: Comment
type: QuestionComment
score: 0
has text: Just updated with the code that receives the JSON

http://stackoverflow.com/comment/39224316
comment on: http://stackoverflow.com/a/25189124
has text: What do you mean my "forwarded my port"? You shouldn't have to do any port forwarding for this. Are you connecting from outside of AWS? If so, make sure you're using your public IP in the security group.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39117274
score: 0
has text: "the concept of a generic SQL query generator is quite common and has had several implementation" Can you please suggest some links for the same? That would really give me the cue to proceed further! Thanks
type: Comment
comment on: http://stackoverflow.com/a/25119592
type: AnswerComment

http://stackoverflow.com/q/25190073
tagged with: concurrency
has comment: http://stackoverflow.com/comment/39225924
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25196116
favorite count: 0
tagged with: synchronization
has comment: http://stackoverflow.com/comment/95817766
has title: Difference between condition variable and condition predicate in java synchronization
type: Question
score: 5
possible better answer: http://stackoverflow.com/a/25190158
upvote count: 6
has answer: http://stackoverflow.com/a/25196057
has answer: http://stackoverflow.com/a/25190158
has comment: http://stackoverflow.com/comment/39234372
tagged with: java
has comment: http://stackoverflow.com/comment/39235558
answer count: 3
downvote count: 1
has body: I am looking for an example with explanation to understand the difference between condition variable and condition predicate in java. This is in the context of synchronization. Also I would like to know whether these terms are actual java terms found in java documentations or other authors refer to these terms? To clarify the question further, consider this example (taken from Java Concurrency book): @ThreadSafe public class BoundedBuffer&lt;V&gt; extends BaseBoundedBuffer&lt;V&gt; { public BoundedBuffer(int size) { super(size); } // BLOCKS-UNTIL: not-full public synchronized void put(V v) throws InterruptedException { while (isFull()) wait(); doPut(v); notifyAll(); } // BLOCKS-UNTIL: not-empty public synchronized V take() throws InterruptedException { while (isEmpty()) wait(); V v = doTake(); notifyAll(); return v; } } What is condition variable, what is condition predicate? You may have a better and simpler example than this to explain the difference. I am confused as what exactly each one is referring to (condition variable vs predicate), whether they are the same thing or not. Someone understanding the low level of java concurrency is probably the best to answer this question.
accepted answer: http://stackoverflow.com/a/25196057

http://stackoverflow.com/comment/39109666
comment on: http://stackoverflow.com/q/25127339
type: Comment
has text: How *big* is the response? :>
type: QuestionComment
score: 1

try-with-resources
tags question: http://stackoverflow.com/q/25175882
tags question: http://stackoverflow.com/q/25190347
tag name: try-with-resources
type: Tag

http://stackoverflow.com/q/25199974
tagged with: oauth-2.0
type: Question
has answer: http://stackoverflow.com/a/25335366
has title: Scribe - restore access token with code (OAuth2 vs OAuth1)
score: 0
tagged with: scribe
answer count: 1
has body: In an OAuth1 process, I save my token and my secret and recreate my access token like the following: accessToken = new Token(token, secret); In an OAuth2 process, I only get a code. If I save this code and try to recreate the access token like following, the app crashes: Verifier v = new Verifier(code); accessToken = service.getAccessToken(null, v); The response: org.scribe.exceptions.OAuthException: Cannot extract an acces token. Response was: {"code": 400, "error_type": "OAuthException", "error_message": "No matching code found."} How do I recreate an access token in an OAuth2 process?
tagged with: android
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/39118168
comment on: http://stackoverflow.com/q/25131867
has text: @ajb this is my data class. if you find anything wrong or bad just tell me please as I am still new and will really appreciate advice. http://pastebin.com/7GSK7ARQ
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25176880
tagged with: arrays
tagged with: string
has comment: http://stackoverflow.com/comment/39274173
type: Question
has answer: http://stackoverflow.com/a/25177141
has answer: http://stackoverflow.com/a/25177180
has answer: http://stackoverflow.com/a/25176975
score: 0
has title: Comparing the reverse word of a string to the original string Java
has body: This is the solution I came up with: public void reverse(String str1, String str2){ int j = str2.length() - 1; if(str1.length() != str2.length()) { return false; } else { for(int i = 0; i &lt; str1.length(); i++) { if((str1.charAt(i) == str2.charAt(j)) &amp;&amp; j &gt;=0) { j--; } else { return false; } } } return true; } There were other solutions I saw such as 1. Uses toCharArray() and Arrays.sort(content) 2. Algorithm that counts how many times the character appears using two arrays (one for each string) &lt;-- I was thinking this solution is inaccurate because the reversed string could have the same amount of characters as the original string but is not the reverse of the original string. i.e. word =/= dorw Which of these solution has the best O-notation? And what does Arrays.sort(content) do?
has answer: http://stackoverflow.com/a/25177161
tagged with: java
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39274188
has comment: http://stackoverflow.com/comment/39201384
has comment: http://stackoverflow.com/comment/39273538
has answer: http://stackoverflow.com/a/25176963

http://stackoverflow.com/q/25221992
has title: Android Getting data from pre built SQLite Database
type: Question
accepted answer: http://stackoverflow.com/a/25222056
tagged with: sqlite
answer count: 1
has comment: http://stackoverflow.com/comment/39285822
has body: I try to get data from ready SQLite database and write it to TextView but I get this error. Here is my DataBaseHelperClass.java: package com.ehliyet; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class DataBaseHelperClass extends SQLiteOpenHelper{ //The Android's default system path of your application database. private static String DB_PATH = "/data/data/com.ehliyet/assets/"; // Data Base Name. private static final String DATABASE_NAME = "test.db"; // Data Base Version. private static final int DATABASE_VERSION = 1; // Table Names of Data Base. static final String TABLE_Name = "questions"; public Context context; static SQLiteDatabase sqliteDataBase; /** * Constructor * Takes and keeps a reference of the passed context in order to access to the application assets and resources. * @param context * Parameters of super() are 1. Context * 2. Data Base Name. * 3. Cursor Factory. * 4. Data Base Version. */ public DataBaseHelperClass(Context context) { super(context, DATABASE_NAME, null ,DATABASE_VERSION); this.context = context; } /** * Creates a empty database on the system and rewrites it with your own database. * By calling this method and empty database will be created into the default system path * of your application so we are gonna be able to overwrite that database with our database. * */ public void createDataBase() throws IOException{ //check if the database exists boolean databaseExist = checkDataBase(); if(databaseExist){ // Do Nothing. }else{ this.getWritableDatabase(); copyDataBase(); }// end if else dbExist } // end createDataBase(). /** * Check if the database already exist to avoid re-copying the file each time you open the application. * @return true if it exis…
tagged with: android
has answer: http://stackoverflow.com/a/25222056
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/a/25228123
answers question: http://stackoverflow.com/q/25090301
type: Answer
accepted answer of: http://stackoverflow.com/q/25090301
score: 0
has body: you can use Chain Of Responsibility pattern. you will need catching the exception UnhandledQuestionException . public abstract class QuestionHandler { protected QuestionHandler successor; public void setSuccessor(QuestionHandler successor) { this.successor = successor; } public abstract void handle(String question); } and implementors should be so public class HealthQuestionHandler extends QuestionHandler { private bool canHandle(String question) { return question.startsWith("How") &amp;&amp; question.endsWith("Josh"); } public void handle(String question) { if( canHandle(question) ) { String healthStatus = "I am fine"; System.out.println(healthStatus); } else { super.successor.handle(question); } } } public class MotherQuestionHandler extends QuestionHandler { private bool canHandle(String question) { return question.startsWith("Who") &amp;&amp; question.endsWith("Mother"); } public void handle(String question) { if( canHandle(question) ) { String mother = "..."; //name System.out.println(mother); } else { super.successor.handle(question); } } } the final handler, when question cannot be handled: public class UnhandledQuestionHandler extends QuestionHandler { public void handle(String question) { throw new UnhandledQuestionException("question not recognized"); } } you should create UnhandledQuestionException first, that extends Exception class. you should create QuestionHandlerFactory too. public class QuestionHandlerFactory { public static QuestionHandler create() { //if you can have several variants of this handler combinations, this method shouldn't be static QuestionHandler healthQuestionHandler = new HealthQuestionHandler(); QuestionHandler motherQuestionHandler = new MotherQuestionHandler(); QuestionHandler unhandledQuestionHandler = new UnhandledQuestionHandler()' motherQuestionHandler.setSuccessor(unhandledQuestionHandler); healthQuestionHandler.setSuccessor(motherQuestionHandler); return healthQuestionHandler; } } and in the user of this class will be: Que…
type: AcceptedAnswer

http://stackoverflow.com/comment/39133260
comment on: http://stackoverflow.com/q/25140246
score: 0
type: Comment
type: QuestionComment
has text: `private File propertiesRuleFile = new File("C:/user1/bwcPropertyRules.xml");` and he just changes that to: `private File propertiesRuleFile = new File( "C:/user2/bwcPropertyRules.xml");` StackTrace is showing old value for `propertiesRuleFile`

http://stackoverflow.com/q/25158221
answer count: 3
has comment: http://stackoverflow.com/comment/39166199
downvote count: 7
linked to: http://stackoverflow.com/q/2728793
possible better answer: http://stackoverflow.com/a/25158260
favorite count: 0
has body: While the contract for compareTo method specifies only the sign of return value, why almost the all method implementations return only -1, 0, 1?
has comment: http://stackoverflow.com/comment/39166191
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25158398
upvote count: 0
accepted answer: http://stackoverflow.com/a/25158398
tagged with: java
has answer: http://stackoverflow.com/a/25158313
has answer: http://stackoverflow.com/a/25158260
type: Question
has comment: http://stackoverflow.com/comment/39166197
has comment: http://stackoverflow.com/comment/39166230
has title: Is there the matter with the compareTo return value?
score: -7
has comment: http://stackoverflow.com/comment/39166245

http://stackoverflow.com/comment/39187657
type: Comment
type: QuestionComment
score: 0
has text: You do return the map in the @Provides method, right?
comment on: http://stackoverflow.com/q/25156824

http://stackoverflow.com/comment/77166070
has text: `asyncio` in python is single threaded, but you say threaded IO
score: 0
type: Comment
comment on: http://stackoverflow.com/a/40049018
type: AnswerComment

http://stackoverflow.com/comment/39056589
type: QuestionComment
comment on: http://stackoverflow.com/q/25098815
score: 0
has text: @meysam I did exactly what u said. look at `extView genderchoosed = (TextView) findViewById(genderselected.getCheckedRadioButtonId());` but I get error.
type: Comment

http://stackoverflow.com/comment/39276255
comment on: http://stackoverflow.com/a/25216821
type: Comment
score: 2
has text: Yes, the first run will be in `O(n*log(n) + log(n))` for one sorting and one binary search. But the ongoing searches will only add a `O(log(n))` binary search step. That way the end complexity is `O(n*log(n) + m*(log(n)))` with m beeing the total number of checks. For fixed `n` and propably big `m` this results in fewer steps than the iterative approach.
type: AnswerComment

http://stackoverflow.com/comment/39157612
has text: It was a bug reported in tomcat 7.0 but I am using tomcat 8.0.
type: Comment
comment on: http://stackoverflow.com/a/25147003
score: 0
type: AnswerComment

http://stackoverflow.com/q/25228008
type: AnsweredQuestion
has title: NullPointerException on CountDownTimer
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39296713
has answer: http://stackoverflow.com/a/25228121
accepted answer: http://stackoverflow.com/a/25228121
score: 0
tagged with: nullpointerexception
answer count: 1
has comment: http://stackoverflow.com/comment/39296677
tagged with: android
has body: in my CuntdownTimerProject I have a Problem with the NullPointerException. I can´t spot the mistake in my code. I also checked out different threads about NullPointerException, but they couldn´t help me at all. Here is my onCreate: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnStart.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startWorkoutTimer(0); } }); btnStop.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (workoutTimer!=null ){ workoutTimer.cancel(); } if (restTimer!=null ){ restTimer.cancel(); } } }); } I only used "null" here. The logcat also tells me that the NullPointerExeption Problem Comes from the onCreate method. Logcat: 08-10 13:01:58.254 20626-20626/com.stacktesttimer.app D/dalvikvm﹕ Late-enabling CheckJNI 08-10 13:01:58.314 20626-20626/com.stacktesttimer.app D/AndroidRuntime﹕ Shutting down VM 08-10 13:01:58.314 20626-20626/com.stacktesttimer.app W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41628ba8) 08-10 13:01:58.324 20626-20626/com.stacktesttimer.app E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.stacktesttimer.app, PID: 20626 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.stacktesttimer.app/com.stacktesttimer.app.MainActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5001) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.int…

http://stackoverflow.com/comment/39191605
has text: Perhaps if you show us some code and try to explain what is wrong with it. It is very unclear what you are trying to do.
comment on: http://stackoverflow.com/q/25171320
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39047384
has text: @webgenius you can use try/catch `try { str = (str.replace("km", ""); str = (str.replace("miles", ""); str = (str.replace("meters", ""); } catch (Exception e) { }` Then you will have your string without the km, miles or meters, as although it will not be able to do two of the three statements, it will be able to do the other one, and the try/catch stops the other two from causing errors.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25093691

http://stackoverflow.com/comment/39266397
score: 0
comment on: http://stackoverflow.com/a/25211694
has text: Sorry, copy-paste error on my side. I meant `myTimer` of course.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39221180
type: AnswerComment
comment on: http://stackoverflow.com/a/25185967
score: 0
has text: This tool packages your jar along with a virtual machine so you don't depend on the user or java version for your application. I'm not going to reproduce the instructions, which are available in the webpage.
type: Comment

http://stackoverflow.com/a/25253739
has comment: http://stackoverflow.com/comment/39346811
has comment: http://stackoverflow.com/comment/39352363
score: 0
has body: Your code has two methods mousePressed() one in PlayGround.java and the other in Wins.java. The application is clearly using the Playground.java Code. Adding the button detection code into the PlayGround.java may solve the problem. Other wise explicitly calling the mousePressed() method in Wins from PlayGround.java may work as well. Adding comments help. It can show your train of thought for a project, Helps others to try and see what you are doing. In fleshing out a complex method I comment excessively at first, weeding out obvious comments through iterations of debugging and code review. I also helps when others are viewing your code. Remember There are no stupid comments, only stupid people.
answers question: http://stackoverflow.com/q/25226694
type: Answer

http://stackoverflow.com/comment/39097897
score: 0
type: Comment
type: QuestionComment
has text: @Eran - Please write an Answer - so I can accept your advice :)
comment on: http://stackoverflow.com/q/25121116

ubuntu
tags question: http://stackoverflow.com/q/25129916
tags question: http://stackoverflow.com/q/25212700
tags question: http://stackoverflow.com/q/25149569
tags question: http://stackoverflow.com/q/25151324
tags question: http://stackoverflow.com/q/25116658
tags question: http://stackoverflow.com/q/25069980
tags question: http://stackoverflow.com/q/25190728
tag name: ubuntu
tags question: http://stackoverflow.com/q/25096189
tags question: http://stackoverflow.com/q/25196974
tags question: http://stackoverflow.com/q/25091099
type: Tag
tags question: http://stackoverflow.com/q/25123245

http://stackoverflow.com/q/25217815
has answer: http://stackoverflow.com/a/25236661
tagged with: java
has title: Java method params: var args vs array
type: Question
has answer: http://stackoverflow.com/a/25301173
has answer: http://stackoverflow.com/a/25218196
tagged with: arrays
has comment: http://stackoverflow.com/comment/39341340
linked to: http://stackoverflow.com/q/5405673
has body: Throughout the Google Guava library, I have noticed the tendency to use the "one (or two) plus var args" technique. Examples: void add(T value, T... moreValueArr) void add(T value, T value2, T... moreValueArr) It took me a while to figure out why: To prevent call with zero args (in first case) or one arg (in second case). Expanding further on this technique, if given the choice between scenarios A and B below, which is preferable? I am hoping someone with deep Java knowledge can provide insight. Scenario A: (two methods) void add(T... valueArr) void add(Iterable&lt;? extends T&gt; iterable) Scenario B: (three methods) void add(T value, T... moreValueArr) void add(T[] valueArr) void add(Iterable&lt;? extends T&gt; iterable) One idea why B might be better: I have noticed many Java programmers are not aware that arrays can be passed directly as var args. Thus, B might provide a hint about what is possible. Finally, I realize B has additional development, testing, and maintenance overhead. Please leave those considerations aside. This question is a subtle variation on my original question: Java varags method param list vs. array
has comment: http://stackoverflow.com/comment/39277997
has answer: http://stackoverflow.com/a/25253226
has answer: http://stackoverflow.com/a/25218324
downvote count: 0
has comment: http://stackoverflow.com/comment/39277988
tagged with: variadic-functions
has comment: http://stackoverflow.com/comment/39278041
score: 8
favorite count: 0
upvote count: 8
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39278055
has comment: http://stackoverflow.com/comment/39278216
tagged with: guava

http://stackoverflow.com/a/75719523
score: 0
type: Answer
has body: FYI Java 16 introduces mapMulti, which is claimed to be faster than the flatMap answer in the Java docs, although at least one implementation internally calls flatMap, so I am somewhat dubious. I have not tested its performance, but being a one-liner at point of use is attractive. Stream.of(1, 2, 3, "Hallo", 4, 5, "Welt") .mapMulti(ofType(String.class)) .forEach(System.out::println); public static <T, U> BiConsumer<T, Consumer> ofType(final Class clazz) { return (obj, consumer) -> { if (clazz.isAssignableFrom(obj.getClass())) { consumer.accept(clazz.cast(obj)); } }; }
answers question: http://stackoverflow.com/q/25077270

http://stackoverflow.com/comment/39084797
comment on: http://stackoverflow.com/q/25113987
score: 0
type: Comment
type: QuestionComment
has text: Instead of iterating over the list, give the simple for loop a try: `for (int i = 0; i < yourList.size(); i++) { Object obj = yourList.get(i); // Do something woth your object }`

http://stackoverflow.com/comment/39268516
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25212778
type: Comment
has text: how do I do that? I wrote this program long time ago, and im just looking through stuff to review, and I tought I already had this one right, but I didnt, and I have forgotten a lot, do I just set it equal to each other or something?

http://stackoverflow.com/a/25100313
has body: What is "ball"? is it an Sprite, AnimatedSprite, Circle... Does it contain a Body? If the latter is true, you're probably forgetting to remove it from the physics world... Try this: final PhysicsConnector physicsConnector = physicsWorld.getPhysicsConnectorManager().findPhysicsConnectorByShape(shape); mEngine.runOnUpdateThread(new Runnable() { @Override public void run() { if (physicsConnector != null) { physicsWorld.unregisterPhysicsConnector(physicsConnector); body.setActive(false); physicsWorld.destroyBody(bbody); scene.detachChild(shape); } } });
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/39065647
answers question: http://stackoverflow.com/q/25100192

http://stackoverflow.com/comment/39194021
has text: @emory How does class retention help in the case of overriding an annotated method?
comment on: http://stackoverflow.com/q/25172655
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25199485
type: UnansweredQuestion
tagged with: web-services
answer count: 0
has body: I'm getting a ClientTransportException when try to access the webservice hosted in websphere (java 1.3), from a application deployed in a weblogic server (java 1.6). Webservice method has a return value of Date data type and generated sources in my application it is implemented as Calender datatype, how can I solve this. Thank you. In generated sources: @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar someDate; In hosted EJB: public Date someMethod(){ //return date; }
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39314799
has title: ClientTransportException: The server sent HTTP status code 500: Internal Server Error
type: Question
tagged with: weblogic
linked to: http://stackoverflow.com/q/5911027
has comment: http://stackoverflow.com/comment/39335336
tagged with: websphere
score: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/25135432
answers question: http://stackoverflow.com/q/25135267
accepted answer of: http://stackoverflow.com/q/25135267
type: AcceptedAnswer
score: 0
type: Answer
has body: Are you missing the while loop there that continuously checks for the size? It'll just call await() again. An element won't be added until it breaks out of the while loop.
has comment: http://stackoverflow.com/comment/39124355

http://stackoverflow.com/q/25229505
tagged with: preferredsize
answer count: 1
type: UnansweredQuestion
tagged with: swing
has title: how to set the size of JPanel in java
linked to: http://stackoverflow.com/q/23501706
tagged with: java
tagged with: jpanel
type: Question
has body: I have a JPanel in my java code and I want to set its size, I have used JPanel.setSize(500,500); and JPanel.setSize(new Dimension(500,500)); but both are not working. Please tell how I can set the size of JPanel?
score: 0
has answer: http://stackoverflow.com/a/25229513

http://stackoverflow.com/q/25117834
favorite count: 0
has comment: http://stackoverflow.com/comment/39091703
has comment: http://stackoverflow.com/comment/39091677
has body: I am trying to read an Ontology using Jena. I have a file Pizza.owl in the correct directory shown in the code, but I still get an error that the file is not found. public static void ReadOntology(){ OntModel onto = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null); String inputFileName = "C:\\Users\\najib\\studies\\pizza.owl"; try { Logger logger = Logger.getLogger(Operations.class); PropertyConfigurator.configure("C://Users//najib//Downloads//apache-jena-2.12.0//jena-log4j.properties"); //create the reasoning model using the base OntModel model = ModelFactory.createOntologyModel(); // use the FileManager to find the input file InputStream in = FileManager.get().open(inputFileName); if (in == null) { throw new IllegalArgumentException("File: " + inputFileName + " not found"); } model.read(in, ""); //to list classes ExtendedIterator&lt;OntClass&gt; classes = model.listClasses(); while (classes.hasNext()) { OntClass cls = (OntClass) classes.next(); System.out.println("Classes: " + cls.getLocalName()); for (ExtendedIterator&lt;OntClass&gt; i = cls.listSubClasses(true); i.hasNext();) { OntClass c = (OntClass) i.next(); System.out.print(" " + c.getLocalName() + "\n"); } // end for } } catch (Exception e) { System.out.println(e); } } } I get the following error: java.lang.IllegalArgumentException: File: C:\Users\najib\studies\pizza.owl not found
has comment: http://stackoverflow.com/comment/39091614
tagged with: exception
type: UnansweredQuestion
downvote count: 2
linked to: http://stackoverflow.com/q/18144131
has title: java.lang.IllegalArgumentException: File Not found
has comment: http://stackoverflow.com/comment/39091772
has comment: http://stackoverflow.com/comment/39091817
has comment: http://stackoverflow.com/comment/39091452
has comment: http://stackoverflow.com/comment/39091721
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/39091902
has comment: http://stackoverflow.com/comment/39091546
has comment: http://stackoverflow.com/comment/39091552
type: Question
tagged with: jena
score: -2
has answer: http://stackoverflow.com/a/25118076
has comment: http://stackoverflow.com/comment/39091618
has comment: http://stackoverflow.com/comment/39091521
has comment: http://stackoverflow.com/comment/39091627
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39091602

http://stackoverflow.com/a/25096465
downvote count: 0
has comment: http://stackoverflow.com/comment/39218296
has comment: http://stackoverflow.com/comment/39200803
type: Answer
has comment: http://stackoverflow.com/comment/39158764
has body: No there should be no problem using JQuery in your own project, so then what third party libraries are intended to be used in. I'm not quite familiar with websphere-portal thus not sure if it has some mechanism for resource injection, but I can tell you that the common location your static skin files and scripts should be in is under the webapp forlder of your project which should be WebContent as far as I know for Eclipse IDE. So the structure then can be: +- StockOnHandPortlet | +- ... // Other project artifacts | +- Webontent | | +- javascript | | | \- your-js-file-1.js | | | \- your-js-file-2.js | | | \- ... | | +- css | | | \- your-stylesheet-1.css | | | \- your-stylesheet-2.css | | | \- ...
score: 1
has comment: http://stackoverflow.com/comment/39165123
answers question: http://stackoverflow.com/q/25072331
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25072331
has comment: http://stackoverflow.com/comment/39207622
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39191490

http://stackoverflow.com/q/25113849
has comment: http://stackoverflow.com/comment/39086332
type: Question
has comment: http://stackoverflow.com/comment/39084134
has body: Im using java to move a pdf file from Unix machine to other machine with Windows NT. Im usin this code: try { client.connect(FTPHOST); client.user(FTPUSER); client.pass(FTPPASS); int reply = client.getReplyCode(); System.out.println("Respuesta recibida de conexión FTP:" + reply); if(FTPReply.isPositiveCompletion(reply)) { System.out.println("Conectado Satisfactoriamente"); }else{ System.out.println("Imposible conectarse al servidor"); } client.changeWorkingDirectory(FTPRUTA); //Activar que se envie cualquier tipo de archivo client.setFileType(FTP.BINARY_FILE_TYPE); BufferedInputStream buffIn = null; buffIn = new BufferedInputStream(new FileInputStream( ut.RUTA_OUTPUT + File.separator + rs.getString("X_MSISDN") + rs.getString("X_ID_ORDEN") + ficheroOut));//Ruta del archivo para enviar client.enterLocalPassiveMode(); client.storeFile(rs.getString("X_MSISDN") + rs.getString("X_ID_ORDEN") + ficheroOut, buffIn);//Ruta completa de alojamiento en el FTP buffIn.close(); //Cerrar envio de arcivos al FTP client.logout(); //Cerrar sesión client.disconnect();//Desconectarse del servidor }catch(Exception e){ System.out.println(e.getMessage()); System.out.println("Algo malo sucedió"); } I tryed this code from unix to unix and works OK, but when I try to conect to the Windows machine the FTP give me Error 530 Can anyone help me please?? Thanks and regards
has title: FTP UNIX to WINDOWS NT with Java
tagged with: unix
tagged with: ftp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39084258
answer count: 0
score: 0
tagged with: java

selenium-webdriver
tags question: http://stackoverflow.com/q/25222663
tags question: http://stackoverflow.com/q/25228615
tags question: http://stackoverflow.com/q/25134280
tags question: http://stackoverflow.com/q/25200352
tags question: http://stackoverflow.com/q/25178089
tags question: http://stackoverflow.com/q/25119284
tags question: http://stackoverflow.com/q/25130436
tags question: http://stackoverflow.com/q/25144489
tags question: http://stackoverflow.com/q/25175636
tags question: http://stackoverflow.com/q/25117060
tags question: http://stackoverflow.com/q/25176499
tags question: http://stackoverflow.com/q/25078321
tags question: http://stackoverflow.com/q/25119734
tags question: http://stackoverflow.com/q/25132539
tags question: http://stackoverflow.com/q/25178893
tags question: http://stackoverflow.com/q/25136870
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/25169067
tags question: http://stackoverflow.com/q/25077282
tags question: http://stackoverflow.com/q/25177674
tags question: http://stackoverflow.com/q/25178313
tags question: http://stackoverflow.com/q/25183478
tags question: http://stackoverflow.com/q/25175027
tags question: http://stackoverflow.com/q/25154230
tags question: http://stackoverflow.com/q/25088899
tags question: http://stackoverflow.com/q/25076797
type: Tag
tags question: http://stackoverflow.com/q/25204693
tags question: http://stackoverflow.com/q/25096306
tags question: http://stackoverflow.com/q/25205580
tags question: http://stackoverflow.com/q/25227223
tags question: http://stackoverflow.com/q/25200476
tags question: http://stackoverflow.com/q/25078991
tags question: http://stackoverflow.com/q/25081360
tags question: http://stackoverflow.com/q/25213638
tags question: http://stackoverflow.com/q/25133193

http://stackoverflow.com/a/25183826
downvote count: 0
has body: This seems perfectly legal to me Well it's not - a method call is never a constant expression. See JLS 15.28 for what constitutes a constant expression. And a case value always has to be a constant expression. The simplest fix would be to have a Friend.fromFullName static method, which perhaps looked the Friend up in a HashMap&lt;String, Friend&gt;. (You don't have to have that method in Friend of course... it's just that would be the most conventional place.) Then you could switch over the enum rather than the name. As a side note, your enum name should be in the singular and with ALL_CAPS members, so Friend.PETER etc.
type: Answer
answers question: http://stackoverflow.com/q/25183754
upvote count: 13
accepted answer of: http://stackoverflow.com/q/25183754
score: 13
type: AcceptedAnswer

http://stackoverflow.com/comment/39058375
score: 0
type: Comment
type: QuestionComment
has text: @TimtheEnchanter: See my answer below. It uses no static methods and can handle multiple documents, at the same time if needed.
comment on: http://stackoverflow.com/q/25099124

http://stackoverflow.com/comment/69763119
has text: Yet you might want to have a container of a List and in that case you might need to use the lambda (l->l.myList.stream()).
type: AnswerComment
comment on: http://stackoverflow.com/a/25147125
type: Comment
score: 3

http://stackoverflow.com/comment/39221051
score: 0
comment on: http://stackoverflow.com/q/25187513
type: Comment
type: QuestionComment
has text: Let me update the question.

http://stackoverflow.com/comment/39393309
type: Comment
has text: And I have set time out as, `props.put("com.sun.jndi.ldap.read.timeout", "0");` but nothing changed.
comment on: http://stackoverflow.com/a/25267674
score: 0
type: AnswerComment

http://stackoverflow.com/a/25084533
answers question: http://stackoverflow.com/q/25084453
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: when you put synchronized on a method you are synchronizing on this. Since there are two instances of the class each is able to get the lock on itself and therefore both run concurrently (no blocking). In the synchronize this.list both the instances have the same list instance reference, therefore they are both trying to get the lock on a single object and are therefore mutually exclusive.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25084453
score: 3

http://stackoverflow.com/comment/39234944
type: Comment
type: QuestionComment
has text: Where *exactly* are you stuck? Please post what you've tried, or perhaps try writing down on paper how you might do it.
score: 1
comment on: http://stackoverflow.com/q/25194992

http://stackoverflow.com/q/25196926
accepted answer: http://stackoverflow.com/a/25196973
has comment: http://stackoverflow.com/comment/39243180
tagged with: jsp
score: 0
has title: values being updated in wrong columns in mySql table
answer count: 1
has comment: http://stackoverflow.com/comment/39239835
has comment: http://stackoverflow.com/comment/39242017
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25196973
tagged with: java
tagged with: mysql
has body: The following is my code in a jsp page : AdminModifyGrocery3.jsp: int g_id = session.getAttribute("g_id") != null ? ((Integer) session.getAttribute("g_id")).intValue() : 0 ; String g_name=(String)request.getParameter("g_name"); String g_price_string=(String)request.getParameter("g_price"); int g_price = Integer.parseInt(g_price_string); PreparedStatement stmtUpdate = null; String strUpdate = "update ShopSystem.Grocery set g_name= ? where g_id = ?"; stmtUpdate = con.prepareStatement(strUpdate); stmtUpdate.setString(1,g_name); stmtUpdate.setInt(2,g_id); int c2 = stmtUpdate.executeUpdate(); PreparedStatement stmtUpdate1 = null; String strUpdate1 = "update ShopSystem.Grocery set g_price=? where g_id=?"; stmtUpdate1 = con.prepareStatement(strUpdate); stmtUpdate1.setInt(1,g_price); stmtUpdate1.setInt(2,g_id); int c1 = stmtUpdate1.executeUpdate(); if(c2&gt;0 &amp;&amp; c1&gt;0) { %&gt; &lt;br&gt; Data is modified successfully.&lt;br&gt; &lt;% } else { %&gt; &lt;br&gt; Sorry the action cannot be completed.&lt;br&gt; &lt;% } It is displaying the message "Data is modified successfully." But in the actual database it is setting the g_price value to g_name, and it is retaining the g_price original value as it is instead of modifying it! What could be going wrong!
type: Question
has comment: http://stackoverflow.com/comment/39239966

http://stackoverflow.com/comment/39214874
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25184447
has text: @matan7890 No problem :). It happens.

http://stackoverflow.com/a/25125199
answers question: http://stackoverflow.com/q/25125150
score: 0
has body: Hint: In example 1, where you have public static void main(String[] args) { for(int i = 0; i &lt; 4; i++) { for(int j = 9; j &gt;= 1; j--) { System.out.print(j); for(int k = 9; k &gt; 0; k--) { System.out.print(j); } } System.out.println(); } } You print out 8 9 times because the k variable starts at 9. Start it at a value that decreases as j goes down.
type: Answer

http://stackoverflow.com/comment/39004095
type: QuestionComment
has text: What was the question?
score: 1
comment on: http://stackoverflow.com/q/25070808
type: Comment

http://stackoverflow.com/q/25162352
linked to: http://stackoverflow.com/q/5104507
tagged with: netbeans
tagged with: jenkins
linked to: http://stackoverflow.com/q/25061162
accepted answer: http://stackoverflow.com/a/25177298
upvote count: 1
type: AnsweredQuestion
has title: How do I add a jar-file to Ant for a NetBeans Java Web App project so that it gets build on Jenkins?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25177298
type: Question
tagged with: restful-architecture
tagged with: ant
downvote count: 0
answer count: 1
has body: As I pointed out in my previous question, I am trying to set up an automatic build system with Jenkins CI for a NetBeans multitiered web application project. My Ant targets are clean and debug. Clean works, but debug fails when trying to compile the project. In the output of my Jenkins build I see the following command: [PGB Webapp] $ cmd.exe /C '""C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Ant_AntInstallation\Apache_Ant\bin\ant.bat" "-Dlibs.MySQLDriver.classpath=C:/Program Files (x86)/MySQL/MySQL Connector J/mysql-connector-java-5.1.31-bin.jar" "-Dlibs.CopyLibs.classpath=C:/Program Files/NetBeans 8.0/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar" "-Dj2ee.server.home=C:/Program Files/wildfly-8.1.0.Final" clean debug && exit %%ERRORLEVEL%%"' And this is the last part of my output: (the part that seems most important to me) library-inclusion-in-manifest: -do-compile: [mkdir] Created dir: C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\build\empty [mkdir] Created dir: C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\build\generated-sources\ap-source-output [javac] Compiling 2 source files to C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\build\web\WEB-INF\classes [javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\config\ApplicationConfig.java:6: error: package javax.ws.rs.core does not exist [javac] import javax.ws.rs.core.Application; [javac] ^ [javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\config\ApplicationConfig.java:8: error: cannot find symbol [javac] public class ApplicationConfig extends Application { [javac] ^ [javac] symbol: class Application [javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:12: error: package javax.ws.rs does not exist [javac] import javax.ws.rs.GET; [javac] ^ [javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\…
favorite count: 0

http://stackoverflow.com/a/25180986
score: 0
has body: You just do not have Spring (totally or partially) in your classpath at runtime. It seems that Log4jConfigListener is the first class referenced when you try to load your application. Take care on copying all needed jar files to your WEB-INF/lib directory.
answers question: http://stackoverflow.com/q/25180880
type: Answer

http://stackoverflow.com/comment/39075656
has text: I believe [GridBagLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/gridbag.html) will provide you with some approximation of your sample.
comment on: http://stackoverflow.com/q/25109222
score: 0
type: Comment
type: QuestionComment

spring-tool-suite
tags question: http://stackoverflow.com/q/25205031
type: Tag
tag name: spring-tool-suite

http://stackoverflow.com/comment/39177729
comment on: http://stackoverflow.com/q/25163969
has text: the example POST seems to imply that one still must manually encode any attr/val pair into a string: HttpEntity[] requestBodies = { new StringEntity( "This is the first test request", ContentType.create("text/plain", Consts.UTF_8)) as with most examples, it's too trivial and lacking, therefore this post.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25096189
type: AnsweredQuestion
tagged with: ant
tagged with: java
has comment: http://stackoverflow.com/comment/39064298
has comment: http://stackoverflow.com/comment/39051489
has comment: http://stackoverflow.com/comment/39054264
accepted answer: http://stackoverflow.com/a/25121030
type: Question
has title: Faing difficulty in building eucalyptus on ubuntu 12.04
has comment: http://stackoverflow.com/comment/39055602
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/39056979
has comment: http://stackoverflow.com/comment/39056652
score: 0
tagged with: groovy
answer count: 1
has answer: http://stackoverflow.com/a/25121030
tagged with: eucalyptus
has body: I installed Ubuntu 12.04(precise)64-bit alongside MacBookPro OS which its processor :Intel® Core™ i5-3210M CPU @ 2.50GHz × 4. Then I am trying for several days to install eucalyptus 3.2.0 by following this guide. When I reached the build phase, it failed due to this issue : BUILD FAILED /home/asma/eucalyptus-3.2.0/clc/build.xml:111: The following error occurred while executing this line: java.lang.UnsupportedClassVersionError: org/codehaus/groovy/ant/Groovy : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:643) at org.apache.tools.ant.AntClassLoader.defineClassFromData(AntClassLoader.java:1124) at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:1295) at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1351) at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1311) at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1064) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) at org.apache.tools.ant.AntTypeDefinition.innerGetTypeClass(AntTypeDefinition.java:194) at org.apache.tools.ant.AntTypeDefinition.getTypeClass(AntTypeDefinition.java:168) at org.apache.tools.ant.AntTypeDefinition.icreate(AntTypeDefinition.java:215) at org.apache.tools.ant.AntTypeDefinition.create(AntTypeDefinition.java:206) at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:286) at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:264) at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:417) at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163) at org.apache.tools.ant.Task.perform(Task.java:347) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.Delega…
has comment: http://stackoverflow.com/comment/39051401
has comment: http://stackoverflow.com/comment/39056873

http://stackoverflow.com/a/25078820
has comment: http://stackoverflow.com/comment/39054395
answers question: http://stackoverflow.com/q/25077431
has comment: http://stackoverflow.com/comment/39019798
score: 0
type: Answer
has body: EDIT Well if the error is from Jackson, regarding this post ou can correct the error first and see what happend next. After the authentification you can use the official code to upload videos with API YouTube V3 using Java /* * Copyright (c) 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package com.google.api.services.samples.youtube.cmdline.data; import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.googleapis.json.GoogleJsonResponseException; import com.google.api.client.googleapis.media.MediaHttpUploader; import com.google.api.client.googleapis.media.MediaHttpUploaderProgressListener; import com.google.api.client.http.InputStreamContent; import com.google.api.services.samples.youtube.cmdline.Auth; import com.google.api.services.youtube.YouTube; import com.google.api.services.youtube.model.Video; import com.google.api.services.youtube.model.VideoSnippet; import com.google.api.services.youtube.model.VideoStatus; import com.google.common.collect.Lists; import java.io.IOException; import java.util.ArrayList; import java.util.Calendar; import java.util.List; /** * Upload a video to the authenticated user's channel. Use OAuth 2.0 to * authorize the request. Note that you must add your video files to the * project folder to upload them with this application. * * @author Jeremy Walker */ public class UploadVideo { /** * Define a global instance of a Youtube object, which will be used * to make YouTube Data API requests. */ private static You…
has comment: http://stackoverflow.com/comment/39019816

http://stackoverflow.com/a/27866092
downvote count: 0
score: 8
upvote count: 8
type: Answer
has body: I able to do it this way: Session session = em().unwrap(Session.class); SQLQuery q = session.createSQLQuery("YOUR SQL HERE"); q.setResultTransformer( Transformers.aliasToBean( MyNotMappedPojoClassHere.class) ); List&lt;MyNotMappedPojoClassHere&gt; postList = q.list();
answers question: http://stackoverflow.com/q/25188939
has comment: http://stackoverflow.com/comment/46691402
has comment: http://stackoverflow.com/comment/107313454

http://stackoverflow.com/comment/39046887
type: AnswerComment
has text: I have added my stacktrace to the question
type: Comment
comment on: http://stackoverflow.com/a/25093415
score: 0

http://stackoverflow.com/comment/40495815
has text: Thanks @drewmoore for the +1. Btw, can you point me what the typo is?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25248763
type: Comment

http://stackoverflow.com/q/25157262
has title: Why is my image not filled with green?
tagged with: swing
has comment: http://stackoverflow.com/comment/39164807
has comment: http://stackoverflow.com/comment/39164924
tagged with: graphics
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25157516
has comment: http://stackoverflow.com/comment/39165302
has answer: http://stackoverflow.com/a/25157518
tagged with: java
linked to: http://stackoverflow.com/q/15544549
has comment: http://stackoverflow.com/comment/39164777
type: Question
possible better answer: http://stackoverflow.com/a/25157518
linked to: http://stackoverflow.com/q/20671551
has answer: http://stackoverflow.com/a/25157520
downvote count: 0
has comment: http://stackoverflow.com/comment/39164866
has comment: http://stackoverflow.com/comment/39164972
accepted answer: http://stackoverflow.com/a/25157516
favorite count: 0
has body: i've seen a similar question, but i didn't get a proper solution, so here's my problem: (Coloring an area of BufferedImage) i'm creating a BufferedImage, then i grab the graphics from this image, i'll paint a green rectangle on it and let it show within a JPanel... but surprise - it's not green, wo where is my error?? import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.image.BufferedImage; import javax.swing.JFrame; import javax.swing.JPanel; public class ViewPortTest { public static void main(String[] args) { new ViewPortTest().startUp(); } private void startUp() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.add(new TestPanel() ); frame.pack(); frame.setVisible(true); } private class TestPanel extends JPanel{ private static final long serialVersionUID = 1L; private int myWidth = 256; private int myHeight = 156; private BufferedImage img; public TestPanel() { super(); setPreferredSize(new Dimension(myWidth, myHeight) ); img = new BufferedImage(myWidth, myHeight, BufferedImage.TYPE_4BYTE_ABGR); img.createGraphics(); img.getGraphics().setColor(Color.GREEN); img.getGraphics().fillRect(0, 0, 256, 256); img.getGraphics().dispose(); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (img != null ){ g.drawImage(img, 0, 0, null); } } } } what comes out is this: so - where is my green rectangle???
answer count: 3
score: 2
upvote count: 2

http://stackoverflow.com/q/25112880
has answer: http://stackoverflow.com/a/25113607
answer count: 1
downvote count: 0
favorite count: 0
has title: What can I have as a Maven artifact and how can I use it?
upvote count: 2
type: UnansweredQuestion
tagged with: maven
score: 2
tagged with: build
tagged with: java
type: Question
has body: I know that it seems like a question that is already asked, but I have not found an answer that helps me a lot. I read a lot of times that it is preferable to generate an artifact per project. But my question is : what can I have as a Maven artifact? For example : I have a custom packaging "MyPack" with a custom lifecycle, can I have whole a directory "Mydirectory" as an artefact? Let's say that the structure of the directory is like this: MyDirectory -----|--jars -----|-----|--- client.jar -----|-----|--- server.jar -----|--jsps -----|-----|--- page1.jsp -----|-----|--- page2.jsp -----|--imgs -----|-----|--- img1.png -----|-----|--- img2.png Then, I want to create a new project that has the packaging "MyPack" and a dependency with the type "MyPack". In this project, my Java classes need client.jar and server.jar which are in the Maven repository to compile and I want to copy all jsps and imgs from the repository in my new project. can I do all that with a custom Maven plugin?

http://stackoverflow.com/a/25146794
downvote count: 0
score: 1
has body: You can check use bd.remainder(BigDecimal.ONE): BigDecimal fraction = bd.remainder(BigDecimal.ONE) BigDecimal whole = bd.subtract(fraction) This will work for positive big decimals. incidentally, I don't see how this is going to help you. How do you compute X^0.4? (That is, without resorting to logarithms)
has comment: http://stackoverflow.com/comment/39145773
answers question: http://stackoverflow.com/q/25146631
upvote count: 1
has comment: http://stackoverflow.com/comment/39146007
has comment: http://stackoverflow.com/comment/39145857
type: Answer

http://stackoverflow.com/a/75442934
has comment: http://stackoverflow.com/comment/133183082
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25126238
upvote count: 2
has body: I got the same issue. And after checking, I've got no scala version conflict issue, no library lacking issue, no sbt issue. I also tried to delete ~/.ivy/ and ~/.sbt, no miracle. What works for me is that, I simply deleted the scala.reflect library under ~/.m2 and reload the project. Everything works fine now. Hope it can help.

spring-security
tags question: http://stackoverflow.com/q/25164885
tags question: http://stackoverflow.com/q/25220468
tags question: http://stackoverflow.com/q/25180467
tags question: http://stackoverflow.com/q/25105610
tags question: http://stackoverflow.com/q/25097436
tags question: http://stackoverflow.com/q/25084111
tags question: http://stackoverflow.com/q/25160903
tags question: http://stackoverflow.com/q/25121054
tags question: http://stackoverflow.com/q/25126218
tags question: http://stackoverflow.com/q/25135507
type: Tag
tags question: http://stackoverflow.com/q/25073074
tags question: http://stackoverflow.com/q/25191918
tags question: http://stackoverflow.com/q/25189973
tags question: http://stackoverflow.com/q/25185578
tags question: http://stackoverflow.com/q/25205324
tags question: http://stackoverflow.com/q/25100500
tags question: http://stackoverflow.com/q/25082148
tags question: http://stackoverflow.com/q/25185696
tags question: http://stackoverflow.com/q/25141845
tags question: http://stackoverflow.com/q/25079356
tags question: http://stackoverflow.com/q/25205031
tags question: http://stackoverflow.com/q/25124968
tags question: http://stackoverflow.com/q/25113154
tags question: http://stackoverflow.com/q/25149757
tags question: http://stackoverflow.com/q/25078817
tag name: spring-security
tags question: http://stackoverflow.com/q/25097801
tags question: http://stackoverflow.com/q/25178696
tags question: http://stackoverflow.com/q/25162131

http://stackoverflow.com/comment/39230957
comment on: http://stackoverflow.com/q/25192583
has text: Since when is half the available system memory a limit? I don't ever remember having problems. However this question is more about advanced GC tuning, which involves much more than `-Xms` and `-Xmx`.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25073115
has answer: http://stackoverflow.com/a/25073309
has title: what is the use of "$" in out.format of toString() and how toString() works?
has comment: http://stackoverflow.com/comment/39008094
type: Question
has body: public String toString() { StringBuffer result = new StringBuffer(); Formatter out = new Formatter(result); out.format("$%.2f%n%d dollars%n%d quarters%n" +"%d dimes%n%d pennies%n", total, dollars, quarters, dimes, pennies); return result.toString(); } In this Snippet of code, Why StringBuffer, Formatter are used? And how toString() is called in a class automatically without making it to call in main() ?
downvote count: 5
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: -4
upvote count: 1
has comment: http://stackoverflow.com/comment/39007986
tagged with: tostring
tagged with: java

http://stackoverflow.com/a/25092157
type: Answer
has body: I usually just do public static final int FOO = 42 for my constants. If I have more than one class and the constants are in the Bar class, I can access them from any class with Bar.FOO (even from outside the package if I import or use the fully qualified name).
downvote count: 1
has comment: http://stackoverflow.com/comment/39043972
score: -1
answers question: http://stackoverflow.com/q/25092105
has comment: http://stackoverflow.com/comment/39044117
upvote count: 0
has comment: http://stackoverflow.com/comment/39043907

single-sign-on
tags question: http://stackoverflow.com/q/25090259
tags question: http://stackoverflow.com/q/25141845
type: Tag
tag name: single-sign-on

http://stackoverflow.com/a/25087997
has comment: http://stackoverflow.com/comment/39036458
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25087773
has body: There are probably many issues with the code you have posted but one of them, and perhaps this is why it is not working as you think it should, is the adding of a newline to the stringbuffer: stringBuffer.append(line); stringBuffer.append("\n"); This would make the password in the file "mySecretPassword\n" which will not evaluate to true when compared to "mySecretPassword" using Equals (assuming that is the password in the file and what the user entered in the password field). Your code would also not work if there is more than one line in the password file. If the assumption is that there will be only one line in the file and it is the password to verify against, then read only one line.
type: Answer
answers question: http://stackoverflow.com/q/25087773
upvote count: 2
score: 2

http://stackoverflow.com/a/25135715
type: Answer
has body: To start with, the field eyes is unused therefore unessecary. Also, if you want to call the repaint on the whole FollowingEyes from OtherPanel, use FollowingEyes.this.repaint(). What you currently have is repainting only OtherPanel.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25135560
answers question: http://stackoverflow.com/q/25135560
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/25098772
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25426293
type: Question
tagged with: java
has body: How do I implement an onClickListener for a CardFragment in Android Wear? There seems to be no methods such as setOnClickListener in either the CardFragment or the GridPagerAdapter.
score: 0
answer count: 1
has title: How do I implement an onClickListener for a CardFragment in Android Wear?
tagged with: android

http://stackoverflow.com/comment/39190795
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25170855
has text: How do y determine the size of "this"? Given the fact tat you seem to be using null layout sever else, I would suggest you don't understand how component sizes are actually calculated

http://stackoverflow.com/a/25156246
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/25154899
answers question: http://stackoverflow.com/q/25154899
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: There are many points not clear about the question. These are obvious things, like how you are running the timing test, how you are providing the input numbers, and what the size of the input numbers is. Also, when you say that storing 2*100000 Integer objects in Java 7 should only need 112KB, then there must be some magic compression involved, because the data itself will already take at least 800 KB, ignoring any further object overhead. Additionally, the sorting should not even take 373ms with the numbers that you mentioned, but maybe only 50ms on a modern PC. However, there have been some hints in the comments that I'll try to assemble here, hoping that it will be considered helpful (and maybe even answer your question). First of all, microbenchmarking is an art, and there are many things to consider. In order to obtain "reliable" results, you have to use a microbenchmarking toolkit like JMH or Caliper. But to quickly get a rough approximation of the results, you should at least repeat the actual test several times. For your case, this could roughly be done like this: import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; public class SortingSpeedTest { private static List&lt;Integer&gt; createList(int n, int offset, int range) { Random random = new Random(0); List&lt;Integer&gt; list = new ArrayList&lt;&gt;(n); for (int i = 0; i &lt; n; i++) { list.add(random.nextInt(range) + offset); } return list; } public static void main(String[] args) { for (int m = 1000; m &lt;= 1000000; m *= 10) { for (int n = 1000; n &lt;= 1000000; n *= 10) { runTest(m, n); } } } private static void runTest(int m, int n) { List&lt;Integer&gt; list1 = createList(m, 0, 100); List&lt;Integer&gt; list2 = createList(n, 100, 100); long before = System.nanoTime(); Collections.sort(list1); Collections.sort(list2, Collections.reverseOrder()); int max = Math.min(list1.size(), list2.size()); int a, b; long result = 0; for (int i = 0; i &lt; max; i…

http://stackoverflow.com/q/25096898
score: 0
answer count: 3
has title: How to access an inner enum classes overwritten methods?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25096912
has body: What code is needed for the main to access the getPrice() method ? I can access the public enum type with the built in values(); function but cant figure out how to print the prices , thanks public enum Drink { GUINNESS(Type.STOUT), COLA(Type.COLA); private Type type; private Drink(Type type) { this.type = type; } private enum Type { STOUT { @Override public double getPrice() { return 4.0; } }, COLA { @Override public double getPrice() { return 2.0; } }; public abstract double getPrice(); } }
tagged with: java
has comment: http://stackoverflow.com/comment/39052580
type: Question
tagged with: enums
has comment: http://stackoverflow.com/comment/39052666
has answer: http://stackoverflow.com/a/25096947
has answer: http://stackoverflow.com/a/25096922

http://stackoverflow.com/a/25218871
score: 0
accepted answer of: http://stackoverflow.com/q/25179381
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39357571
has comment: http://stackoverflow.com/comment/39358131
type: Answer
answers question: http://stackoverflow.com/q/25179381
has body: Disclaimer: This isn't a fully working example (I would need some sample files to verify in that case), but rather outlines the idea. First, open a stream to the file, and skip the proprietary header (your code assumes that you can always skip as many bytes you like, but that's not always the case): InputStream is = new FileInputStream(filePath); int toSkip = 252; int skipped = 0; while (toSkip &gt; 0 &amp;&amp; (skipped = is.skip(toSkip)) &gt;= 0) { toSkip -= skipped; } Then, re-create a valid, minimal TIFF header, according to the TIFF specification. This is actually not too hard: ByteArrayOutputStream bytes = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(bytes); dataOut.write('M'); dataOut.write('M'); // "Motorola" (network) byte order dataOut.writeShort(42); // TIFF magic identifier (42) dataOut.writeUnsignedInt(8); // Offset to 1st IFD // ... write IFD, containing minimal info as per the spec As your input data seems to be in bilevel or black/white fax format (ref. comments), see Section 3: Bilevel Images (page 17) in the spec for the required fields and allowed values. For normal RGB images, see Section 6: RGB Full Color Images (page 24). Note that SHORT in the spec is (unsigned) short in Java, but LONG is (unsigned) int. Also note that fields must be written in increasing tag order. RATIONAL can be written as two LONGs (i.e., two unsigned ints). For XResolution and YResolution, just write 72/1 as this is default 72 DPI. StripOffsets will be the length of the IFD + 8 for the bytes written before the IFD. If you don't have strips, set RowsPerStrip equal to ImageLength and StripByteCounts equal to the length of the entire (compressed) image data. When done encoding the header, merge the header and the image data, and read it: ByteArrayInputStream header = new ByteArrayInputStream(bytes.toByteArray()); InputStream stream = new SequenceInputStream(header, is); // Merge header and image data Now, you could read the image: BufferedImag…

http://stackoverflow.com/q/25096457
has body: I have written a small Java tool, but I still get the same error that a class can not be found Class "org.h2.fulltext.FullTextLucene" not found; SQL statement: CREATE ALIAS IF NOT EXISTS FTL_INIT FOR "org.h2.fulltext.FullTextLucene.init"; [ 90086-178] at org.h2.message.DbException.getJdbcSQLException(DbException.java:344) at org.h2.message.DbException.get(DbException.java:167) at org.h2.util.Utils.loadUserClass(Utils.java:676) at org.h2.engine.FunctionAlias.loadClass(FunctionAlias.java:146) at org.h2.engine.FunctionAlias.load(FunctionAlias.java:122) at org.h2.engine.FunctionAlias.init(FunctionAlias.java:107) at org.h2.engine.FunctionAlias.newInstance(FunctionAlias.java:78) at org.h2.command.ddl.CreateFunctionAlias.update(CreateFunctionAlias.java:50) at org.h2.command.CommandContainer.update(CommandContainer.java:79) at org.h2.command.Command.executeUpdate(Command.java:254) at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:186) at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:160) at database.main(database.java:30) Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/analysis/standard/StandardAnalyzer at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at org.h2.util.Utils.loadUserClass(Utils.java:665) ... 10 more Caused by: java.lang.ClassNotFoundException: org.apache.lucene.analysis.standard .StandardAnalyzer 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) ... 13 more Which version of Lucene Core works with H2 1.4.x? I thought that I need Lucene Core 4.x because: H2 1.2.x needs Lucene Core 2.x H2 1.3.x needs Lucene Core 3.x
upvote count: 1
has answer: http://stackoverflow.com/a/25096680
accepted answer: http://stackoverflow.com/a/25096680
answer count: 1
has title: Class "org.h2.fulltext.FullTextLucene" not found - H2 database 1.4.* does not work with Lucene Core 4.*
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: h2
type: Question
tagged with: classnotfound
tagged with: lucene
tagged with: classnotfoundexception

http://stackoverflow.com/comment/39085779
type: AnswerComment
comment on: http://stackoverflow.com/a/25114577
has text: Yes, you might be right (your EDIT), but either way works just fine. Problem is I don't want to do that, I'd rather getContent() returned data without empty spaces..or filter it before iterating.
type: Comment
score: 0

http://stackoverflow.com/comment/39224017
type: Comment
has text: Thanks, gotta do some experimentation JAI...
score: 0
comment on: http://stackoverflow.com/q/25187942
type: QuestionComment

http://stackoverflow.com/comment/39344928
has text: @DanielB Sorry, haven't been able to work out how to see the stacktrace. e.getMessage() is null in Watch, and LogCat reports:`08-11 22:44:52.648: E/InputEventReceiver(19907): Exception dispatching input event. 08-11 22:44:52.658: E/MessageQueue-JNI(19907): Exception in MessageQueue callback: handleReceiveCallback 08-11 22:44:52.803: E/MessageQueue-JNI(19907): java.lang.NullPointerException`
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25223963
type: QuestionComment

http://stackoverflow.com/comment/39141753
has text: I'd ignore `PdfPTable` completely if you want to position things absolutely. Instead, a `ColumnText` should do almost everything that you're looking for except perhaps borders. However, if you've got absolute positions and dimensions you can then just draw a rectangle at those positions after you draw the text. That's essentially what a `PdfPTable` does behind the scenes, too.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25127556
type: Comment

http://stackoverflow.com/comment/39168422
score: 1
comment on: http://stackoverflow.com/q/25159472
type: Comment
type: QuestionComment
has text: Embed it in an html page with the alert function called in the onLoad handler. And return that html page.

http://stackoverflow.com/a/25137797
accepted answer of: http://stackoverflow.com/q/25137079
answers question: http://stackoverflow.com/q/25137079
type: AcceptedAnswer
upvote count: 3
type: Answer
has body: Your data model is a bit incomplete and this is what Jackson is pointing out. To improve the situation you should map more fields. public class Response { @JsonProperty("id") private Integer id; @JsonProperty("name") private String name; // getter/setter... } public class Data { @JsonProperty("response") private List&lt;Response&gt; response; @JsonProperty("errorMsg") private String errorMsg; @JsonProperty("code") private int code; // getter/setter... }
downvote count: 0
score: 3

http://stackoverflow.com/comment/39257418
score: 1
comment on: http://stackoverflow.com/a/25206926
type: AnswerComment
type: Comment
has text: Also, it will depend on the support the JDBC driver provides.

http://stackoverflow.com/a/76986810
type: Answer
has body: I wrote a solution to your problem. I used an additional BlockingQueue with "freeWorkers" with the same capacity as the real worker thread pool. I just take the "freeWorker" before starting the next task and each task returns the "freeWorker" to the "freeWorkes" queue. Here is an example: package poc.concurrecy; import java.util.Random; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import static java.util.concurrent.TimeUnit.SECONDS; public class ThreadPoolQueueTest { public static final String WHITE = "\033[0;39m"; public static final Random RANDOM = new Random(); public static void main(String[] args) throws InterruptedException { int capacity = 5; LinkedBlockingQueue<Integer> freeWorkers = new LinkedBlockingQueue<>(capacity); for (int i = 1; i < capacity + 1; i++) freeWorkers.put(i); System.out.println(WHITE + freeWorkers); System.out.println(WHITE + "==========="); LinkedBlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<>(capacity); ExecutorService executor = new ThreadPoolExecutor(capacity, capacity, 0L, TimeUnit.MILLISECONDS, workQueue); try { for (int i = 0; i < 10; i++) { Integer freeWorker = freeWorkers.take(); String color = "\033[0;3" + freeWorker + "m"; System.out.println(WHITE + "take free worker " + freeWorker); System.out.println(WHITE + freeWorkers); executor.execute(() -> { System.out.println(color + "run " + freeWorker); delay(1 + RANDOM.nextInt(3)); System.out.println(color + "done " + freeWorker); try { System.out.println(color + "return free worker " + freeWorker); freeWorkers.put(freeWorker); } catch (InterruptedException e) { throw new RuntimeException(e); } }); System.out.println(WHITE + "put task " + freeWorker); } } finally { executor.shutdown(); executor.awaitTermination(5, TimeUnit.SECONDS); } System.out.println(WHITE + "=========="); System.out.println(WHITE + freeWorkers); } public static void d…
answers question: http://stackoverflow.com/q/25192142
score: 0

http://stackoverflow.com/q/25125413
linked to: http://stackoverflow.com/q/16956720
has answer: http://stackoverflow.com/a/25125498
has answer: http://stackoverflow.com/a/25125492
has body: I am tasked with making a program that interfaces with a multivalue database. I receive the entire record in a string with delimeters for the values and subvalues. From there I split the data into a 2d array. Here's a snippet of one (notice the varying lengths): 0 1 2 +------------------------------------+ 0 | 442 | | | 1 | C | | | 2 | | | | 3 | N | | | 4 | LAND | | | 5 | 05412300 | 05412307 | | 6 | BEARING | | | 7 | BRAND1 | BRAND2 | BRAND3 | 8 | 12 | | | +------------------------------------+ Now I've always used ArrayLists instead of Arrays because I knew it was best practice. Now I'm wondering if using a 2d ArrayList would be beneficial as well. I've looked at some examples and I don't quite understand how to get the values when I need them. If I were to do: String[][] cheese = { {"chedder", "swiss", "pepperjack"}, {"sliced", "cubed", "block"} }; String myFavorite = cheese[0][2]; myFavorite would be pepperjack, but how would I do that with a 2d ArrayList? The example's I've found haven't been too helpful for me. I do know the exact number of rows (but not columns) of data I'll be receiving and the row number will not change so maybe a regular 2d array would be best practice?
tagged with: arraylist
answer count: 4
type: AnsweredQuestion
score: 2
tagged with: arrays
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25125495
type: Question
tagged with: multidimensional-array
accepted answer: http://stackoverflow.com/a/25125495
upvote count: 2
has title: Java 2d Array or 2d ArrayList?
tagged with: java
possible better answer: http://stackoverflow.com/a/25125478
has answer: http://stackoverflow.com/a/25125478

http://stackoverflow.com/comment/39034478
comment on: http://stackoverflow.com/a/25086630
score: 0
type: AnswerComment
has text: It's not an annotation problem. I don't know if it depends of the version of hibernate (or JPA) but @Column annonations are not obligatory.
type: Comment

http://stackoverflow.com/q/25199307
has comment: http://stackoverflow.com/comment/57479268
tagged with: runtime.exec
has comment: http://stackoverflow.com/comment/39245176
has title: Unable using Runtime.exec() to execute shell command "echo" in Android Java code
type: Question
has comment: http://stackoverflow.com/comment/39243194
tagged with: echo
accepted answer: http://stackoverflow.com/a/35144372
tagged with: java
has answer: http://stackoverflow.com/a/35144372
has body: I can use Runtime.exec() to execute shell commands like "getprop" and "ls system" and they work fine. However, when I use "echo $BOOTCLASSPATH", "echo \\$BOOTCLASSPATH" or "echo HelloWorld", it won't show it in stdout. The logcat shows: I/AndroidRuntime( 4453): VM exiting with result code -1. Here's my code: try { java.lang.Process proc = Runtime.getRuntime().exec("echo -e \\$BOOTCLASSPATH"); String line = null; InputStream stderr = proc.getErrorStream(); InputStreamReader esr = new InputStreamReader (stderr); BufferedReader ebr = new BufferedReader (esr); while ( (line = ebr.readLine()) != null ) Log.e("FXN-BOOTCLASSPATH", line); InputStream stdout = proc.getInputStream(); InputStreamReader osr = new InputStreamReader (stdout); BufferedReader obr = new BufferedReader (osr); while ( (line = obr.readLine()) != null ) Log.i("FXN-BOOTCLASSPATH", line); int exitVal = proc.waitFor(); Log.d("FXN-BOOTCLASSPATH", "getprop exitValue: " + exitVal); } catch (Exception e) { e.printStackTrace(); }
downvote count: 1
score: 18
answer count: 1
tagged with: shell
upvote count: 19
favorite count: 0
has comment: http://stackoverflow.com/comment/39243241
tagged with: android
has comment: http://stackoverflow.com/comment/39243315
type: AnsweredQuestion

http://stackoverflow.com/comment/110426576
comment on: http://stackoverflow.com/a/27105045
type: AnswerComment
score: 0
type: Comment
has text: I forgot to note but you need to run those commands in the command line

http://stackoverflow.com/q/25126041
tagged with: hadoop
downvote count: 0
has comment: http://stackoverflow.com/comment/39130604
has body: I am using eclipse to build my hadoop job, running on Ubuntu. The problem is that when i make some mistake, like not inform a parameter to my job, the eclipse doesnt throw an exception. I am not using any plugin, and my files ares in local filesystem. I am running Hadoop 2.41. Getting job.getStatus().getFailureInfo(), just return NA. Is it better try MRUnit? EDIT: I run the job using the command line and now I see the exception: java.lang.Exception: java.lang.ClassCastException: org.apache.hadoop.io.NullWritable cannot be cast to identity.CPFPair at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462) at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:522) Caused by: java.lang.ClassCastException: org.apache.hadoop.io.NullWritable cannot be cast to identity.CPFPair But my problem still persists. Why can i not see this exception in eclipse console?
has title: Debugging Hadoop Job inside Eclipse
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/39041041
comment on: http://stackoverflow.com/q/25090447
score: 0
type: Comment
type: QuestionComment
has text: If you can't use `instanceof` you could use a `try{ E myE = (E)o;//Do something with your E}catch(Exception e){//Your object it's not of class E}`. If the code (the cast) inside the try succeds then your object it's of class E, else, you get a `ClassCastException` and enter on the catch.

http://stackoverflow.com/comment/39269642
type: Comment
score: 0
has text: Wow! That fixed it! I didn't know you needed a csrf token with all post requests. This has fixed the majority of the form posts. The only thing left now is that there is some oddity where it will not let me post a enctype="multipart/form-data" form.
type: AnswerComment
comment on: http://stackoverflow.com/a/25211326

http://stackoverflow.com/q/25161837
has body: My Neo4j server throws DeadlockDetectedExceptions when executing concurrent requests and I can not figure out why. The following code is called by the server plugin invoked by client REST requests and happens in a single transaction. Node nFollowing = loadUser(idFollowing); Node nFollowed = loadUser(idFollowed); // locking order to avoid deadlocks if (Long.valueOf(idFollowing) &lt; Long.valueOf(idFollowed)) { tx.acquireWriteLock(nFollowing); tx.acquireWriteLock(nFollowed); } else { tx.acquireWriteLock(nFollowed); tx.acquireWriteLock(nFollowing); } // create relationship if not present for (Relationship followship : nFollowing.getRelationships( EdgeType.FOLLOWS, Direction.OUTGOING)) { if (followship.getEndNode().equals(nFollowed)) { return; } } nFollowing.createRelationshipTo(nFollowed, EdgeType.FOLLOWS); Although I thought about deadlocks the following exception is thrown, indicating that a deadlock occurred when the relationship is being created. Exception (reduced slightly): "ForsetiClient[78] can't acquire ExclusiveLock{owner=ForsetiClient[73]} on RELATIONSHIP(49), because holders of that lock are waiting for ForsetiClient[78].\n Wait list:ExclusiveLock[ForsetiClient[73] waits for [73, 78, ]]", "exception" : "DeadlockDetectedException", "fullname" : "org.neo4j.kernel.DeadlockDetectedException", "stacktrace" : [ "org.neo4j.kernel.ha.lock.forseti.ForsetiClient.markAsWaitingFor(ForsetiClient.java:611)", "org.neo4j.kernel.ha.lock.forseti.ForsetiClient.acquireExclusive(ForsetiClient.java:190)", "org.neo4j.kernel.impl.nioneo.xa.TransactionalRelationshipLocker.getWriteLock(TransactionalRelationshipLocker.java:33)", "org.neo4j.kernel.impl.core.NodeProxy.createRelationshipTo(NodeProxy.java:455)", "de.uniko.sebschlicht.neo4j.graphity.WriteOptimizedGraphity.addFollowship(WriteOptimizedGraphity.java:40)", "de.uniko.sebschlicht.neo4j.graphity.Graphity.addFollowship(Graphity.java:115)", "de.uniko.sebschlicht.neo4j.GraphityBaselinePlugin.follow(GraphityBaselinePlugin.java:38)",…
favorite count: 0
tagged with: deadlock
upvote count: 3
tagged with: neo4j
downvote count: 0
type: UnansweredQuestion
score: 3
has title: Neo4j deadlock for relationship creation between nodes locked in same transaction
tagged with: transactions
tagged with: java
has answer: http://stackoverflow.com/a/25914699
type: Question
answer count: 1

http://stackoverflow.com/q/25182285
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39213757
possible better answer: http://stackoverflow.com/a/25183310
tagged with: java
has title: How to autocomplete lambdas in IntelliJ IDEA?
has answer: http://stackoverflow.com/a/25183310
has answer: http://stackoverflow.com/a/25442101
tagged with: intellij-idea
score: 29
answer count: 2
has comment: http://stackoverflow.com/comment/39216822
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/39215980
accepted answer: http://stackoverflow.com/a/25442101
has body: I'm using IntelliJ IDEA 13 with Java 8 and wonder how to autocomplete lambdas. Before Java 8 I used anonymous inner classes of course. I auto completed by typing "new" and hitting Ctrl+Space: and choosing the first option. Now with Java 8 I want to generate lambdas as well, inferring parameters and all, but I can't find autocompletion for it. Note, this above example is quite easy, but when you have multiple parameters with generic types, e.g. JavaFX Listeners and the like, autocompletion comes in handy.
type: Question
tagged with: lambda
tagged with: java-8
upvote count: 29

http://stackoverflow.com/comment/39136202
has text: is the gps getting fixed????
comment on: http://stackoverflow.com/q/25123655
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25181279
upvote count: 0
has title: PircBotX - Transfer String to User
answer count: 1
favorite count: 0
downvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25181408
tagged with: java
type: Question
score: -2
has body: Kind of baffled by this. Recently transferred over to PircBotX - coding a bot, etc. I have a command that basically requires you give a nick and it will grab the hostname. The nick is a String, but PircBotX requires it to be a User. Any idea how I'd switch a String to a User so I can then grab the hostmask? Thank you in advanced.
accepted answer: http://stackoverflow.com/a/25181408

http://stackoverflow.com/q/25193891
favorite count: 0
has title: expect4j not waiting for full output
tagged with: ssh
tagged with: blocking
has comment: http://stackoverflow.com/comment/39235750
downvote count: 0
type: UnansweredQuestion
has body: I've using expect4j with JSch to connect to a remote shell and pull a config file. The code I'm using to connect to the machine is as follows: Session session = jsch.getSession( host.getUser(), host.toString(), SSH_PORT); session.setPassword(host.getPass()); //If this line isn't present, every host must be in known_hosts session.setConfig("StrictHostKeyChecking", "no"); session.connect(); Channel channel = session.openChannel("shell"); channel.connect(); InputStream in = channel.getInputStream(); OutputStream out = channel.getOutputStream(); Expect4j expect = new Expect4j(in, out); for(String command : commands) { //List of commands int returnVal = expect.expect(prompts); //List of Match[] objects that correspond to different possible prompts if (returnVal != COMMAND_SUCCESS_OPCODE) { System.err.println("ERROR: tried to run " + command + " and got opcode " + returnVal); } expect.send(command); expect.send(ENTER_BUTTON); //Constant that corresponds to newline } When run, the code gives me the following messages: &lt;Current Date &amp; Time&gt; expect4j.BlockingConsumer run INFO: Stop Requested &lt;Current Date &amp; Time&gt; expect4j.BlockingConsumer run INFO: Found EOF to stop while loop I believe that the problem stems from that fact that it takes a second or two for the last command to complete. Is there a way to get expect4j to wait for the command to finish? Additionally, the commands each return a different returncode from the expect command (0,1,2,2). Is there a place where I can look up those codes? Do they have any significance?
has comment: http://stackoverflow.com/comment/39235776
has comment: http://stackoverflow.com/comment/39234487
has answer: http://stackoverflow.com/a/26900344
has answer: http://stackoverflow.com/a/25195508
score: 1
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39235755
upvote count: 1
has comment: http://stackoverflow.com/comment/39233878
tagged with: expect
has comment: http://stackoverflow.com/comment/39235743
tagged with: jsch

http://stackoverflow.com/a/25225850
has body: ans[0] will return the first(0 because the first element starts with 0, not 1) element of the array, ans[1] the second and so on..
answers question: http://stackoverflow.com/q/25225839
type: Answer
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/39099794
score: 0
type: Comment
type: QuestionComment
has text: No, I don't have that method. But now I'm stuck on finding the number of nodes between the root and specific node.
comment on: http://stackoverflow.com/q/25121668

http://stackoverflow.com/a/25150866
score: 1
type: Answer
has body: First of all, your toString() method is untypical. You want a Circle#toString() with no argument and produce a print representaton of yourself (i.e. this instead of object=). Your toString method can fail if: object is null object.center is null object.center.getCoordinateX() or getCoordinateY() itself throws exception. The later case would be visible in the stacktrace, the other two cases all show the same line number as the cause. It looks like the second case is your problem (as you fill a local variable and not the field of MyCircle). BTW: using a input scanner in a constructor is a horrible layering violation. You should seperate input/output/user interaction logic from the geometric (circly, point) classes.
upvote count: 1
answers question: http://stackoverflow.com/q/25150818
downvote count: 0

http://stackoverflow.com/q/25102058
upvote count: 2
downvote count: 3
type: Question
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/25102133
has title: Android - SetBackgroundColor keeps going to blue?
tagged with: rgb
has body: I was just programming away a new app on Android Studio, experimenting with code (I'm new to Java). I was experimenting with Dialogs, and had a Dialog to set the Color of the layout. I had a list of colors and I was using setBackgroundColor(Color.BLACK) For example, and even when i set it to use Black or a RGB value, it always just sets the layout color to blue, even when using Color.GREEN or Color.BLACK. Here is the code I am using. final Dialog dialog = new Dialog(MainActivity.this); //Create Alert Dialog AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setTitle("Choose background type"); builder.setItems(_options, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setTitle("Make your selection"); builder.setItems(colors, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //Change colors switch (which) { //Black case 0: middleLayout.setBackgroundColor(Color.BLACK); case 1: //Blue middleLayout.setBackgroundColor(Color.rgb(0,0,255)); case 2: //Brown middleLayout.setBackgroundColor(Color.rgb(102, 51, 0)); case 3: //Cyan middleLayout.setBackgroundColor(Color.CYAN); case 4: //Yellow middleLayout.setBackgroundColor(Color.YELLOW); case 5: //Orange middleLayout.setBackgroundColor(Color.rgb(255, 128, 0)); case 6: //Red middleLayout.setBackgroundColor(Color.RED); case 7: //Grey middleLayout.setBackgroundColor(Color.GRAY); case 8: //White middleLayout.setBackgroundColor(Color.WHITE); case 9: //Green middleLayout.setBackgroundColor(Color.GREEN); case 10: //Pink middleLayout.setBackgroundColor(Color.rgb(255,51,153)); case 11: //Cream middleLayout.setBackgroundColor(Color.rgb(255,204,153)); case 12: //Purple middleLayout.setBackgroundColor(Color.rgb(153,0,153)); case 13: //Sky Blue middleLayout.setBackgroundColor(Color.rgb(0,128,255)); case 14: //Dar…
answer count: 1
favorite count: 0
tagged with: colors
accepted answer: http://stackoverflow.com/a/25102133
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/comment/39016264
comment on: http://stackoverflow.com/q/25077423
type: Comment
type: QuestionComment
has text: Enver may only mean to have a `@Version`-Field. *_REV-Tables are more like "Hibernate Enver Auditions". Only Auditions are able to save old table-tuples. Anyway, this question is not related to Auditions or Enver i guess. I am happy to read that you use the technique anyway.
score: 0

http://stackoverflow.com/q/25221706
tagged with: java
has answer: http://stackoverflow.com/a/25221790
type: Question
has comment: http://stackoverflow.com/comment/39285128
answer count: 1
has comment: http://stackoverflow.com/comment/39285202
downvote count: 5
has body: Keep getting an error when i try to create a new object by pressing a button. Help and an Explanation would be appreciate my guess is that theres a rouge () somehere? or somthing else what is easy to spot but im not seeing it public class Main extends JFrame { int GWIDTH = 400; int GHEIGHT = 300; private Image dbImage; private Graphics dbg; int x,y; int rectX, rectY; int random; boolean mouseOnScreen; boolean mouseDragged; int click = 0; int Resource = 0; int ore = 100; int mx, my; public Main(){ setSize(GWIDTH, GHEIGHT); setTitle("Game"); setResizable(false); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); addMouseListener(new Mouse()); frame(dbg); x = 0; y = 0; random = 100; } private void frame(Graphics g) { JFrame f = new JFrame(); f.setVisible(true); f.setSize(400, 400); JPanel p = new JPanel(); JButton b1 = new JButton("New ore"); JButton b2 = new JButton("New worker"); JButton b3 = new JButton("Upgrade pick"); JButton b4 = new JButton("Turret"); JButton b5 = new JButton("Barrack"); b1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null,"Succses!"); System.out.println(Resource-=ore); Rectangle r3 = new Rectangle(300, 50, 50, 50); g.setColor(Color.RED); g.fillRect(r3.x, r3.y, r3.width, r3.height); } }); p.add(b1); p.add(b2); p.add(b3); p.add(b4); p.add(b5); f.add(p); } public class Mouse extends MouseAdapter implements MouseMotionListener { @Override public void mousePressed(MouseEvent e){ click += e.getClickCount(); rectX = e.getX(); rectY = e.getY(); y = rectY; x = rectX; Rectangle r1 = new Rectangle(rectX, rectY, 7, 7); Rectangle r2 = new Rectangle(175, 75, 50, 50); if(r1.intersects(r2)) Resource += e.getClickCount(); } @Override public void mouseReleased(MouseEvent e){ } @Override public void mouseEntered(MouseEvent e){ mouseOnScreen = true; rectX = e.getX(); rectY = e.getY(); } @Override public void mouseExited(MouseEvent e){ mouseOnScreen = false; rectX = e.ge…
favorite count: 0
has comment: http://stackoverflow.com/comment/39285145
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/39285162
has comment: http://stackoverflow.com/comment/39285214
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/39285532
upvote count: 1
tagged with: swing
has title: Getting an error and I can't see what
has comment: http://stackoverflow.com/comment/39285151

http://stackoverflow.com/comment/39032721
type: AnswerComment
comment on: http://stackoverflow.com/a/25086121
score: 0
type: Comment
has text: there must be another way to tell that images has been added

http://stackoverflow.com/comment/39042933
has text: which part of code are you using the log?? post the whole block of code
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25091615

http://stackoverflow.com/comment/39054677
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25097978
score: 0
has text: What does _static code_ mean? Do you mean a _static initialize block_ or a _static method_ or something else?

http://stackoverflow.com/comment/117102172
type: Comment
comment on: http://stackoverflow.com/a/25224517
score: 2
has text: @Karan Consider `Comparable<String> c = s -> 0`. It's clearly a Comparable and its implementation is a lambda. However, it's not a very good Comparable: `c.compareTo("x")` returns zero, whereas "x".compareTo(c) won't even compile. (And if you could compile it, calling it would throw ClassCastException.)
type: AnswerComment

http://stackoverflow.com/a/25079653
has body: Best way is to always use this this.width = a; So that we never confuse between the argument names and instance variables. One small example to confuse is public void set_volume_v2(int width) { width = width; } So when you write this.width we are making it clear that it's instance variable.
type: Answer
upvote count: 4
score: 3
answers question: http://stackoverflow.com/q/25079599
has comment: http://stackoverflow.com/comment/39020929
accepted answer of: http://stackoverflow.com/q/25079599
type: AcceptedAnswer
downvote count: 1

http://stackoverflow.com/q/25209549
answer count: 1
has answer: http://stackoverflow.com/a/25209766
has body: I am a beginner to Java programming, and I was trying to implement knapsack algorithm by dynamic programming and it works perfectly for few inputs, but for few inputs it throws an exception. The code is package knapsack3; import java.util.Scanner; /** Class Knapsack **/ public class knapsack3 { public void solve(int wt[], int val[], int M, int n) { int nob = 25; int i,j; int v[][]=new int[nob][nob]; for(i=0;i<=n;i++) { for(j=0;j<=M;j++) { if(i==0||j==0) { v[i][j]=0; } else if(j-wt[i]<0) { v[i][j]=v[i-1][j]; } else { v[i][j]=Math.max(v[i-1][j],val[i]+v[i-1][j-wt[i]]); } } } System.out.println("\n Final Profit(value)---> "+v[n-1][M]); } /** Main function **/ public static void main (String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Knapsack Algorithm Test\n"); knapsack3 ks = new knapsack3(); System.out.println("Enter number of elements "); int n = scan.nextInt(); int wt[] = new int[n + 1]; int val[] = new int[n + 1]; System.out.println("\nEnter weight for "+ n +" elements"); for (int i = 1; i <= n; i++) wt[i] = scan.nextInt(); System.out.println("\nEnter value for "+ n +" elements"); for (int i = 1; i <= n; i++) val[i] = scan.nextInt(); System.out.println("\nEnter knapsack weight "); int M = scan.nextInt(); ks.solve(wt, val, M, n); scan.close(); } } the exception is Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 25 at knapsack3.knapsack3.solve(knapsack3.java:22) at knapsack3.knapsack3.main(knapsack3.java:61)
accepted answer: http://stackoverflow.com/a/25209766
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
has title: Array out of bounds exception in Java while implementing the knapsack algorithm
tagged with: knapsack-problem

http://stackoverflow.com/comment/39262556
has text: Your best bet for us to help you is to give a simple test that illustrates what youre seeing.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25209599
score: 1

http://stackoverflow.com/comment/39056234
type: QuestionComment
has text: Known problem. See [JBoss seems to hang on startup at the command line](http://stackoverflow.com/a/22902077/3536342) for more information.
comment on: http://stackoverflow.com/q/25098829
score: 0
type: Comment

http://stackoverflow.com/q/25115108
type: Question
has answer: http://stackoverflow.com/a/25115162
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
answer count: 3
has answer: http://stackoverflow.com/a/25115169
has comment: http://stackoverflow.com/comment/39086314
has body: I have an array in Java. I need to remove the items that are smaller than 20 characters. Is this possible and how?
tagged with: arrays
has answer: http://stackoverflow.com/a/25115331
accepted answer: http://stackoverflow.com/a/25115331
favorite count: 0
possible better answer: http://stackoverflow.com/a/25115162
has comment: http://stackoverflow.com/comment/39086335
has comment: http://stackoverflow.com/comment/39086308
downvote count: 3
score: -3
has title: How to remove items from array that are smaller than 20 characters?
upvote count: 0

http://stackoverflow.com/q/25168332
has comment: http://stackoverflow.com/comment/39187633
accepted answer: http://stackoverflow.com/a/25171156
has answer: http://stackoverflow.com/a/25168333
tagged with: java
tagged with: jtextfield
type: Question
possible better answer: http://stackoverflow.com/a/25168333
answer count: 2
has comment: http://stackoverflow.com/comment/39199431
has title: How to make part of a JTextField uneditable
score: 0
has answer: http://stackoverflow.com/a/25171156
has body: I wanted to develop a console-like interface, similar to IDLE. That involved determining how to prevent a certain part of the text in a JTextField from being edited. For example: &gt;&gt;&gt; help Where the ">>> " is uneditable. The caret must never move behind a certain position, and the text behind that position cannot be edited in any way.
tagged with: swing
has comment: http://stackoverflow.com/comment/39190163
type: AnsweredQuestion

http://stackoverflow.com/q/25205809
has title: Default value syntax error with create table
score: 0
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25205978
has comment: http://stackoverflow.com/comment/39255240
tagged with: sqlite
answer count: 1
tagged with: android
has body: I've googled for answers and have had no luck thus far. I am trying to run a statement in SQLite on Android Kit Kat and am getting the following stack trace: 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): Error while trying to create table:settings 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): android.database.sqlite.SQLiteException: near "/": syntax error (code 1): , while compiling: CREATE TABLE settings ( 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): id CHAR(36) PRIMARY KEY, 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): row_id TINYINT(1) NOT NULL DEFAULT 1, 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): device_id CHAR(36) DEFAULT NULL, 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): username VARCHAR(100) NOT NULL, 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): password VARCHAR(45) NOT NULL, 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): timezone VARCHAR(64), 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): timezones_updated TINYINT(1) NOT NULL DEFAULT 0, 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): device_bluetooth_identifier VARCHAR(64), 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): log_debug TINYINT(1), 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): gps_interval INTEGER NOT NULL DEFAULT 3, 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): gps_threshold FLOAT NOT NULL DEFAULT 50, 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): gps_trigger_speed FLOAT NOT NULL DEFAULT 2, 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): checkin_interval INTEGER NOT NULL DEFAULT 2, 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseAdapter(32532): checkin_timeout LONG NOT NULL DEFAULT 20, 08-08 10:23:27.899: E/com.corrisoft.air.db.AirDatabaseA…
accepted answer: http://stackoverflow.com/a/25205978

http://stackoverflow.com/a/25112534
downvote count: 0
has comment: http://stackoverflow.com/comment/39081880
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/39082504
score: 2
answers question: http://stackoverflow.com/q/25112400
has body: I don't know what are you doing but I just noticed one thing with the state of cardflag. When the text field is empty and next button is clicked cardflag = 2 and now button is clicked then below action listener is called. private void buttonaction(ActionEvent e) { try { if (cardflag == 1) { text_2.append("" + e.getActionCommand()); } if (cardflag == 2) { text_3.append("" + e.getActionCommand()); ^^^ //This should be text_2 } } catch (Exception IOe) { } }
has comment: http://stackoverflow.com/comment/39082467
has comment: http://stackoverflow.com/comment/39082654
has comment: http://stackoverflow.com/comment/39082917

http://stackoverflow.com/a/25119170
answers question: http://stackoverflow.com/q/25119043
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25119043
has body: Try this out String new1 = "Some text"; PrintWriter outs; try { outs = new PrintWriter("D:/text123.txt"); outs.write(new1 + System.getProperty("line.separator")); outs.write(new1 + System.getProperty("line.separator")); outs.write(new1 + System.getProperty("line.separator")); outs.close(); } catch (FileNotFoundException ex) { System.out.println(ex.getMessage()); }

http://stackoverflow.com/q/25117528
favorite count: 0
type: UnansweredQuestion
tagged with: activiti
has body: I recently startet working with JBoss' Wildfly 8.1 and the activiti framework. I created two projects, one with my bpmn.xml file and the classes for the Service Tasks: Process: -src/main/ -impl.java -src/resources/ -diagrams -myprocess.bpmn.xml -config -activiti-context.xml The other one holds the servlet WebTest: -src/main -testServlet.java -lib -process.jar in my servlet i implemented the init method to get the Activiti processEngine: @Override public void init() throws ServletException{ super.init(); engine = ProcessEngines.getDefaultProcessEngine(); } I build the Webtest.war file and deploy it to D:/path/to/workingdir/wildfly-8.1.0.Final/**standalone/deployments**/Webtest.war Then i start up Widlfly using the provided standalone.bat, it starts up correctly and deploys to the context /Webtest, so far so good. if i now access localhos:8080/Webtest/servlet i get the Exception: org.activiti.engine.ActivitiException: couldn't initialize process engine from spring configuration resource vfs:/D:/path/to/workingdir/wildfly-8.1.0.Final/bin/content/TEST-1.war/WEB-INF/lib/process.jar/activiti-context.xml: null the error with :null at the end implies that the file could not be accessed. of course it cannot, there is no bin/content! my question now is: where does Widlfly get the idea to look at bin/content? it obviously was able to find the config file on itself, i never told spring or activiti to look in the process.jar, so the app finds the configuration in the classpath alright... then it proceeds to reading the file from an entirely different location that does not exist? I dont know if this is of interesst, but here is my activiti-context.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-3.1.xsd"&gt; &lt;bean id="processEngineConfigurati…
score: 3
answer count: 0
upvote count: 3
tagged with: java
type: Question
tagged with: wildfly-8
tagged with: jboss
has comment: http://stackoverflow.com/comment/39091355
has comment: http://stackoverflow.com/comment/39092474
has title: Wildfly looking in wrong directory
downvote count: 0

http://stackoverflow.com/comment/39086410
score: 1
comment on: http://stackoverflow.com/q/25115059
type: QuestionComment
type: Comment
has text: I think you need to set the project language level. Eclipse could do this too using a lower version compiler, so I'm fairly certain IntelliJ can do it too.

http://stackoverflow.com/comment/39250454
has text: Please brief your question.
score: 0
comment on: http://stackoverflow.com/q/25203501
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39070588
score: 0
comment on: http://stackoverflow.com/q/25106640
type: QuestionComment
type: Comment
has text: "Android Private Libraries" is a label, not a specific library.

http://stackoverflow.com/comment/39205656
type: Comment
type: QuestionComment
has text: javaHome shows none, says if none will pick up the version on the machine should be 1.8, java options just shows a date strangely. There doesn't seem to be any option for source level
score: 0
comment on: http://stackoverflow.com/q/25178675

http://stackoverflow.com/a/25106949
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: You are passing null to Integer.parseInt(). This means that br1.readLine() is returning null. The only way this happens is if the end of stream has been reached. This means that you have somehow managed to not initialise System.in properly. Try running the program from the command line with java RetailMarket in the same directory as the compiled class. This code works fine when I run it. Also, you should consider catching NumberFormatException and keep the program running if the input is invalid e.g. try { ch1 = Integer.parseInt(br1.readLine()); } catch (NumberFormatException e) { // invalid input }
type: Answer
accepted answer of: http://stackoverflow.com/q/25106756
answers question: http://stackoverflow.com/q/25106756
has comment: http://stackoverflow.com/comment/39072268

http://stackoverflow.com/q/25181937
linked to: http://stackoverflow.com/q/7655432
tagged with: java
linked to: http://stackoverflow.com/q/4945695
score: -1
type: Question
has body: Is there a possible way to do that? e.g In my application form a have a field for the user's name which is a String. But how can I disallow the user from giving for example "L3bron James" instead of giving "Lebron James"? String sql_name = name.getText(); // name is a JTextField if (sql_name.length() == 0) { //how to check if the name does not contain int digits JOptionPane.showMessageDialog(null,"Name is a string ,NOT an Integer, not a null value!!","Invalid Name",JOptionPane.ERROR_MESSAGE); }
possible better answer: http://stackoverflow.com/a/25182082
upvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/39211004
favorite count: 0
tagged with: int
accepted answer: http://stackoverflow.com/a/25182027
has comment: http://stackoverflow.com/comment/39210008
has comment: http://stackoverflow.com/comment/39209946
answer count: 4
has answer: http://stackoverflow.com/a/25182027
has answer: http://stackoverflow.com/a/25182082
has answer: http://stackoverflow.com/a/25183365
has comment: http://stackoverflow.com/comment/39209986
tagged with: swing
downvote count: 1
has title: Preventing a String from getting integer values in Java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25182191
has comment: http://stackoverflow.com/comment/39209952

http://stackoverflow.com/comment/39018971
type: Comment
has text: As far as I know a ReadWriteLock only allows 1 writer thread at a time, is this correct and if so what could I use to be able to write with multiple threads?
type: AnswerComment
comment on: http://stackoverflow.com/a/25079173
score: 0

http://stackoverflow.com/a/25096680
accepted answer of: http://stackoverflow.com/q/25096457
has comment: http://stackoverflow.com/comment/39052650
answers question: http://stackoverflow.com/q/25096457
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39052159
type: Answer
upvote count: 1
has body: H2 definitely doesn't support Lucene 4.x. Looking at the 1.4.178 source for org.h2.fulltext.FullTextLucene reveals a class definitely designed to work with Lucene 3.x (targeting Lucene 3.0 functionality, specifically).
score: 1

http://stackoverflow.com/q/25207689
type: UnansweredQuestion
has body: We have a web application in Java which calls progress procedures. Progress 4gl version is 10.x and is on AIX. Requirement is to implement the following functionality: Suppose that a progress procedure is called by the web application. This makes an appserver transaction to run. While the transaction is processing, if the user closes the browser window the appserver process needs to be identified and should be killed using its process id. Killing of process can be implemented by invoking a shell script. How to identify the appserver process id for a web application session which is about to be closed?
has answer: http://stackoverflow.com/a/25209379
has comment: http://stackoverflow.com/comment/39260067
tagged with: java
type: Question
tagged with: appserver
has answer: http://stackoverflow.com/a/25306983
score: 0
answer count: 3
tagged with: pid
has answer: http://stackoverflow.com/a/25247575
has title: Get process id for an appserver process invoked from browser
tagged with: progress-4gl

http://stackoverflow.com/comment/39042733
type: Comment
comment on: http://stackoverflow.com/a/25091402
score: 1
has text: @pez First result on googling `precedence hierarchy in c horowitz sahni` Check slide 31, 32 https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&sqi=2&ved=0CBsQFjAA&url=http%3A%2F%2Fwww.csie.ntu.edu.tw%2F~ds%2Fppt%2Fch3%2Fchapter3.PPT&ei=52HcU5qiDZOfugTv74LgAQ&usg=AFQjCNFiDp4wtb4Ddi7J-wyiq2YKxcVucQ&sig2=EBxUehu2juEXXSWHp9e1jA&bvm=bv.72197243,d.c2E
type: AnswerComment

timer
tag name: timer
tags question: http://stackoverflow.com/q/25087842
type: Tag
tags question: http://stackoverflow.com/q/25164177
tags question: http://stackoverflow.com/q/25191083
tags question: http://stackoverflow.com/q/25094746
tags question: http://stackoverflow.com/q/25120884
tags question: http://stackoverflow.com/q/25186631
tags question: http://stackoverflow.com/q/25211659

http://stackoverflow.com/q/25204725
tagged with: java
has comment: http://stackoverflow.com/comment/39253598
type: Question
has comment: http://stackoverflow.com/comment/39253735
has title: Separation of Spring MCV REST and Angular.js Single Page; Architecture
answer count: 1
has comment: http://stackoverflow.com/comment/39318957
score: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/39254434
tagged with: angularjs
type: UnansweredQuestion
has body: My Application is based on these technologies: Spring MVC with REST Services Angular.js. The Application is working fine but I'm now at a point where I thinking I am using the wrong architecture. What I want is to separate the backend and frontend functionalities at all. I started to build a menu in angular with different URL's. My Index.html looks like this: //all html stuff ... Home Search Contract ... ... //inport scripts At the backend I created UI Controller which returns my html pages. The pages getting rendered in the Index.html. The Url is also changing. IndexUIController.java import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping("/") public class IndexUIController { @RequestMapping public String getIndexPage() { return "index"; } } I created same Controller for home and searchContract. My HTML pages are in WEB-INF folder. My app.js looks like this var TestApp = {}; var App = angular.module('TestApp', ['ui.bootstrap','ngRoute','angular-table']); App.config(['$routeProvider', function ($routeProvider) { $routeProvider.when('/searchContract', { templateUrl: 'searchContract/searchContractLayout', controller: contractController }); $routeProvider.when('/home', { templateUrl: 'home/homeLayout', }); $routeProvider.otherwise({redirectTo: '/home'}); }]); I use Velocity as View Resolver: part of web.xml TestApp org.springframework.web.servlet.DispatcherServlet contextConfigLocation WEB-INF/spring/webmvc-config.xml 1 TestApp / part of webmvc-config.xml <mvc:resources mapping="/resources/**" location="/resources/" /> <context:component-scan base-package="at.testApp" /> <property name="resourceLoaderPath" value="/WEB-INF/html/"/> <property name="cache" value="true"/> <property name="prefix" value=""/> <property name="suffix" value=".html"/> <property name="exposeSpringMacroHelpers" value="true"/> I'm really unsure if this is the right architecture to build a single page application wi…
tagged with: spring
has comment: http://stackoverflow.com/comment/39253172
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/25206217

http://stackoverflow.com/a/25195508
has body: this is how I use it. notice that since jsch-0.1.50, I had to start using this to make it work Hashtable&lt;String,String&gt; config = new Hashtable&lt;String,String&gt;(); config.put("StrictHostKeyChecking", "no"); config.put("PreferredAuthentications", "publickey,keyboard-interactive,password");//makes kerberos happy session.setConfig(config); So basically I use the very same code provided by the tutorial except that my libraries are up to date expect4j-1.0.jar jakarta-oro-2.0.8.jar jsch-0.1.51.jar And since my user is not root, private static String[] linuxPromptRegEx = new String[]{"\\$"}; good luck ps. I'd give this alternative a try. Looks a very well made expect library.
downvote count: 0
answers question: http://stackoverflow.com/q/25193891
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/39110180
has text: @user3078335 ah, okay. I updated my answer to hopefully be what you want.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25127327

http://stackoverflow.com/a/25086264
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25086124
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25086124
type: Answer
has body: PDFs are mostly postscript, which is a language of its own... so 14MB of input can be anything from zero to infinite output. Your best bet is to just figure out how to handle running OOM well.

http://stackoverflow.com/comment/39252174
has text: Argh, forgot my number one question: why do you want to calculate the number of seconds for a period this long?
comment on: http://stackoverflow.com/q/25204043
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/25183113
tagged with: kerberos
answer count: 2
downvote count: 0
has body: i have some questions on using keytab for Authentication hope the kind people here can enlightend me Say, i have userA who is going to use a service running at port 1010. First, userA will login to Active Directory to authenticate himself. After login, userA will try to connect to the server to use its service 1010. In order for the server to verify that UserA is who he is, I need to use setspn to register SPN at the Active Directory. eg setspn -s service1010/mydomain.com serviceaccount1 Then need to generate ktab file at Active directory, eg ktab -a serviceprincal1010/server.domain.com@DOMAIN.COM -k mykeytab.keytab and then bring mykeytab.keytab to the server. At the server, I would use JAAS with a login config to query the KDC eg ServicePrincipalLoginContext { com.sun.security.auth.module.Krb5LoginModule required principal=serviceprincal1010/server.domain.com@DOMAIN.COM doNotPrompt=true useKeyTab=true keyTab=mykeytab.keytab storeKey=true; }; From this point on, I am confused. How does userA get verified (ie, userA is actually who he is? ).
favorite count: 0
upvote count: 8
tagged with: jaas
has comment: http://stackoverflow.com/comment/54357632
possible better answer: http://stackoverflow.com/a/25183268
has answer: http://stackoverflow.com/a/25183268
score: 8
has answer: http://stackoverflow.com/a/25274103
type: AnsweredQuestion
tagged with: authentication
type: Question
has title: How does keytab work exactly?
tagged with: java
tagged with: keytab
accepted answer: http://stackoverflow.com/a/25274103

http://stackoverflow.com/q/25100192
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39058744
has body: // playerBall extends Animate class //Even after entity becomes invisible,collision is detected Collision occurs at the point where entity was before getting detached. private void ballsR(){ registerUpdateHandler(new FPSLogger()); Random r = new Random(); int i= r.nextInt(7)+1; if(count&lt;1){ ballForColl[0] = ball; count++; System.out.println(count); } registerUpdateHandler(this.ballsDet = new TimerHandler(5.0f,true, new ITimerCallback() { @Override public void onTimePassed(TimerHandler pTimerHandler) { // TODO Auto-generated method stub /* ball.setVisible(false); ball.setIgnoreUpdate(true); ball.detachSelf(); ball.clearUpdateHandlers(); @override*/ resourcesManager.engine.runOnUpdateThread(new Runnable() { @Override public void run() { /* Now it is save to remove the entity! */ //pScene.detachChild(SpriteRemoveExample.this.mFaceToRemove); detachChild((ball)); ball.setIgnoreUpdate(true); } }); // detachChild(ball); // unregisterUpdateHandler(ball) ; } })); /************************************************************/ //my player ball class public playerBall(final float pX, final float pY, final TiledTextureRegion pTextureRegion,VertexBufferObjectManager vbom) { super(pX, pY, pTextureRegion,vbom); this.mPhysicsHandler= new PhysicsHandler(this); this.registerUpdateHandler(this.mPhysicsHandler); this.mPhysicsHandler.setVelocity(DEMO_VELOCITY, DEMO_VELOCITY); // System.out.println("this is srs1"); } @Override protected void onManagedUpdate(final float pSecondsElapsed) { if(this.mX &lt; 0) { // System.out.println("this is srs"); this.mPhysicsHandler.setVelocityX(DEMO_VELOCITY); } else if(this.mX + this.getWidth() &gt; 800) { this.mPhysicsHandler.setVelocityX(-DEMO_VELOCITY); } if(this.mY &lt; 0) { this.mPhysicsHandler.setVelocityY(DEMO_VELOCITY); } else if(this.mY + this.getHeight() &gt; 480) { this.mPhysicsHandler.setVelocityY(-DEMO_VELOCITY); } super.onManagedUpdate(pSecondsElapsed); } }
tagged with: java
has comment: http://stackoverflow.com/comment/39061701
tagged with: andengine
type: Question
has title: In andengine collision is getting fired on a detached Entity
score: -1
has comment: http://stackoverflow.com/comment/39058788
has comment: http://stackoverflow.com/comment/39058845
downvote count: 2
has answer: http://stackoverflow.com/a/25100313
upvote count: 1
answer count: 1

http://stackoverflow.com/a/25201498
upvote count: 4
answers question: http://stackoverflow.com/q/25201304
downvote count: 0
type: Answer
has body: If your input float values are in a defined range (for now let's assume they're in the range of -1..1, exclusive), you can multiply them to get a value whose fraction you'll throw away. Valid short range is: -32768..32767 so you can multiple with 32768 in this case (max short / max input value). For example: float f = 0.23451f; short s = (short) (f * 32768); To decode a short value to float: float f2 = s / 32768f;
score: 4

http://stackoverflow.com/a/25133143
accepted answer of: http://stackoverflow.com/q/25133037
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: You could use a Map&lt;Integer, TreeNode&gt; The key would be the deep index of the object and the TreeNode would be the last for that index. Then you can take index-1 as a parent. Root;;;;;;; --&gt; [{1,Root}] i=1 ;Cat1;;;;;; --&gt; [{1,Root},{2,Cat1}] --&gt; i=2 --&gt; Parent : Root ;;Sub1;;;;; --&gt; [{1,Root},{2,Cat1},{3,Sub1}] --&gt; i=3 --&gt; Parent : Cat1 ;;Sub2;;;;; --&gt; [{1,Root},{2,Cat1},{3,Sub2}] --&gt; i=3 --&gt; Parent : Cat1 ;;Sub3;;;;; --&gt; [{1,Root},{2,Cat1},{3,Sub3}] --&gt; i=3 --&gt; Parent : Cat1 ;Cat2;;;;;; --&gt; [{1,Root},{2,Cat2},{3,Sub2}] --&gt; i=2 --&gt; Parent : Root ;;Sub4;;;;; --&gt; [{1,Root},{2,Cat2},{3,Sub4}] --&gt; i=3 --&gt; Parent : Cat2 ;;;SSb1;;;; --&gt; [{1,Root},{2,Cat2},{3,Sub4},{4,SSb1}] --&gt; i=4 --&gt; Parent : Sub4
has comment: http://stackoverflow.com/comment/39120754
answers question: http://stackoverflow.com/q/25133037

http://stackoverflow.com/comment/39235989
type: Comment
has text: Using an `ArrayList` would make this trivial. All you would need to do is use `list.add(list.remove(0))`;
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25195112

http://stackoverflow.com/a/61890178
type: Answer
has body: Maybe this answers not your question about closing the batch after executing it, but I use files like this to set my CLASSPATH environment varible: call-java-class.bat :: :: %1 directory where all jars are located :: %2 main class :: %* program parameters :: :: JAVA_OPTS ... parameter before main class :: @echo off set libdir=%1 shift set main=%1 shift set JARS= set CLASSPATH= pushd %libdir% for %%i in (*.jar) do call cpappend.bat %libdir%\%%i set CLASSPATH=.%JARS% popd :: debug echo %CLASSPATH% echo %JAVA_HOME%\bin\java %main% %1 %2 %3 %4 %5 %6 %7 %8 %9 %JAVA_HOME%\bin\java %JAVA_OPTS% %main% %1 %2 %3 %4 %5 %6 %7 %8 %9 cpappend.bat @echo off set JARS=%JARS%;%1 The script expects all dependencies in a single directory and JAVA_HOME must be set. Then call your java program: call-java-class.bat path-to-lib-dir com.foo.bar.Main -help Most code is taken from https://alvinalexander.com/blog/post/page-1/thu-mar-9-2006-dynamically-build-environment-variables-in-dos-c/
answers question: http://stackoverflow.com/q/25176153
score: 0

http://stackoverflow.com/a/25087987
has comment: http://stackoverflow.com/comment/39038862
answers question: http://stackoverflow.com/q/25087878
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39037703
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/39037789
has body: I think you have to see if input string exist in the ArrayList, you have to use contains() method. if(classesList.contains(input)) { //Found in the arraylist. } But with you method, you can't compare strings using == operator. You should use equals() method for comparision List&lt;String&gt; classesList = new ArrayList&lt;String&gt;(); classesList.add("mage"); classesList.add("warrior"); classesList.add("thief"); Scanner input = new Scanner(System.in); String input = input.next(); boolean isExist = false; for (String item : classesList) { if (input.equals(classesList.get(counter))) { //Your logic if it's there. isExist = true; break; } } if(isExist) { //Found in the arraylist. } Also if you want to make this comparision with ingnoring the case, you shoudl consider using equlasIgnoreCase() method instead of equals() method.
accepted answer of: http://stackoverflow.com/q/25087878
upvote count: 3
has comment: http://stackoverflow.com/comment/39038324

http://stackoverflow.com/q/25226062
upvote count: 3
tagged with: java
type: Question
score: 3
has answer: http://stackoverflow.com/a/25268053
tagged with: statistics
has body: Somewhere between 2.6.x and 2.8.x ehcache seems to have completely changed their statistics API. Is there any documentation available for this change? A little background I'm trying to migrate metrics ehcache instrumentation to ehcache 2.8.3, which basically means fixing this class. I think I managed to guess many of the changes, but I'm totally lost how to replace the following calls in 2.8.x cache.setSampledStatisticsEnabled(true); cache.setStatisticsAccuracy(Statistics.STATISTICS_ACCURACY_NONE); cache.getStatistics().getStatisticsAccuracyDescription();
tagged with: migration
answer count: 1
downvote count: 0
favorite count: 0
tagged with: ehcache
accepted answer: http://stackoverflow.com/a/25268053
has title: Documentation of the ehcache statistics API in 2.8.x
type: AnsweredQuestion

http://stackoverflow.com/q/25193970
has answer: http://stackoverflow.com/a/25333946
type: Question
tagged with: maven
has body: I have a spring boot application. I use IntelliJ 13. I want to launch my application in debug mode and debug it. I'm on Windows and I'd like to use shared memory. I would like to just be able to click the debug icon, or a single maven goal, and the application launches in debug mode and the IDE attaches the debugger. This is how I am used to debugging most of my java apps. However, mixing spring-boot and IntelliJ seems to complicate things. IntelliJ seems to want to connect to the wrong process when I push the green "debug" button and I can't find a way to change the shared memory address that the green 'debug' button's functionality is determined to connect to. The closest I've come is to add jvmoptions to the maven goal in pom.xml, and then if I add a Remote run configuration, IntelliJ lets me specify a shared memory address that matches what I wrote in the pom. This requires multiple clicks to launch the application and then debug it. It works, in a similar way that using notepad.exe to write code also works. Hence my question. Is there a 1-step solution using shared memory? Variation of this question: Debugging jsp with spring-boot and IntelliJ However the question and answers are limited to using sockets.
score: 0
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/27029567
has answer: http://stackoverflow.com/a/27029567
accepted answer: http://stackoverflow.com/a/25333946
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/39239184
linked to: http://stackoverflow.com/q/23304921
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/39236215
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39250098
has title: IntelliJ 13: Shared Memory Debug Spring Boot application in 1 step

http://stackoverflow.com/comment/39129267
type: AnswerComment
type: Comment
has text: Added with the `list`, still same issue exists.
comment on: http://stackoverflow.com/a/25138240
score: 0

http://stackoverflow.com/comment/39190723
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25170869
score: 0
has text: you are most likely having overflow issues. 999! is an astronomical number

http://stackoverflow.com/comment/39262784
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25201033
has text: Why wouldn't the JVM invoke them? What's to stop EvilClass from calling `Ser.readObject(myInputStream)`?
type: Comment

http://stackoverflow.com/comment/39296098
comment on: http://stackoverflow.com/q/25227704
score: 0
type: Comment
type: QuestionComment
has text: So now you have me curious about the why!

http://stackoverflow.com/comment/39219052
has text: You use `shutdownNow` - That's why. " This implementation cancels tasks via Thread.interrupt(), " You should be using `shutdown`. See [JavaDoc](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html#shutdown())
comment on: http://stackoverflow.com/q/25186500
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/39287546
type: QuestionComment
has text: I need to make several rows from an array. Its for a directory and so the number of people could change.
comment on: http://stackoverflow.com/q/25222930
score: 0
type: Comment

http://stackoverflow.com/comment/134014179
has text: Unfortunately programming language semantics & reasoning about programming & programs is extremely poorly taught. Learning about a logical machine used to implement programs (eg the JVM) is not generally a good way to learn about those. What is appropriate is an abstract machine designed not for implementing programs but for describing the semantics (as with C & C++). Program design & debugging involves at the highest level state changes as that abstract machine is initialized & executes. Key to semantics are contracts & loop & module invariants.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25109942

http://stackoverflow.com/a/25259689
score: 0
has comment: http://stackoverflow.com/comment/39356889
type: Answer
has body: Here you need to add font type or font file in your application. you can find code here itextSharp - html to pdf some turkish characters are missing this question is also same as your question.. if this helps you then please give points.
answers question: http://stackoverflow.com/q/25178989

http://stackoverflow.com/comment/50964801
comment on: http://stackoverflow.com/a/28331980
type: AnswerComment
has text: I'd preferred a global fix, but it's better than all the other answers that enable restricted API globally. (I don't want to accidentally use sun.* in my javafx application).
score: 2
type: Comment

http://stackoverflow.com/comment/39047482
type: AnswerComment
has text: So the way I mapped is correct right? If not can you please tell me what should I change in the program to get rid of the error. I am quite new to hibernate so please help me.
type: Comment
comment on: http://stackoverflow.com/a/25093415
score: 0

http://stackoverflow.com/a/25163179
score: 0
has comment: http://stackoverflow.com/comment/39176342
answers question: http://stackoverflow.com/q/25162274
has comment: http://stackoverflow.com/comment/39175948
has body: The class with main method should be public class ClassA { int x = 0; int y = 1; public void methodA() { System.out.println( "x is " + x + " , and y is " + y) ; System.out.println( "I am an instance of: " + this.getClass().getName() ) ; } } public class ClassB extends ClassA { int z = 3; public static void main(String[] args) { ClassB obj1 = new ClassB(); obj1.methodA(); } } This works
has comment: http://stackoverflow.com/comment/39176215
has comment: http://stackoverflow.com/comment/39178256
type: Answer

http://stackoverflow.com/a/25076147
answers question: http://stackoverflow.com/q/25076030
type: Answer
accepted answer of: http://stackoverflow.com/q/25076030
downvote count: 0
score: 9
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/70852746
has comment: http://stackoverflow.com/comment/39013864
has body: The setter method will be called when converting json string into java object using ObjectMapper's readValue() method where you can check for value. Look at the setter method's signature that accepts String instead of Integer. sample code: class Student { private int age; public int getAge() { return age; } public void setAge(String ageString) { System.out.println("called"); try { age = Integer.parseInt(ageString); } catch (NumberFormatException e) { throw new IllegalArgumentException("age can't be in float"); } } } ... try { Student student = new ObjectMapper().readValue("{\"age\": 12.5}", Student.class); } catch (IllegalArgumentException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/39119400
upvote count: 9

http://stackoverflow.com/comment/39128430
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25137490
has text: I'm sorry, but shouldn't StackOverflow questions be about specific programming problems? How is this on-topic? Regardless of the last sentence, which kind-of asks for a specific answer, it is first and foremost a flamebaity kind of question.

http://stackoverflow.com/q/25173966
has comment: http://stackoverflow.com/comment/39196308
linked to: http://stackoverflow.com/q/23170058
tagged with: traits
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: scala
upvote count: 1
tagged with: maven
has comment: http://stackoverflow.com/comment/39238209
score: 1
tagged with: java
has body: I have a java maven project which has dependency to scala project. I try to implement scala trait in java. The trait is store in packge object, when I try to implement it project fallen with compile time error Here sources: scala source: package com.compile.error package object dummies { trait BaseDummy { def name: String } trait ChildDummy extends BaseDummy{ } } java source: //Uncoment for compile error public class WhantImplementScalaTrait /*implements com.compile.error.dummies.package$ChildDummy*/ { } So how implement scala trait as java interface if it in package object? Full sources you can download here. UPDATED The command javap package$ChildDummy.class Gets result: public interface com.compile.error.dummies.package$ChildDummy extends com.compile.error.dummies.package$BaseDummy { } Tried imports com.compile.error.dummies.package$.ChildDummy$Class com.compile.error.dummies.package$.ChildDummy com.compile.error.dummies.package$.MODULE$.ChildDummy$Class com.compile.error.dummies.package$.MODULE$.ChildDummy com.compile.error.dummies.package$ChildDummy com.compile.error.dummies.package$ChildDummy$Class
linked to: http://stackoverflow.com/q/9436074
type: Question
has title: How implement scala trait from package object as java interface?
downvote count: 0
linked to: http://stackoverflow.com/q/520328
has comment: http://stackoverflow.com/comment/39200888

http://stackoverflow.com/comment/39165144
has text: I set the httpClient object using `Client uut = new Client(); Field f = Client.class.getDeclaredField("httpClient"); f.setAccessible(true); f.set(uut, httpClient);` I've omitted it in the code above for the sake of brevity.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25150287

http://stackoverflow.com/q/25102149
has title: Returning only time using SpinnerDateModel
has answer: http://stackoverflow.com/a/25102170
answer count: 2
upvote count: 1
tagged with: swing
tagged with: jspinner
tagged with: java
accepted answer: http://stackoverflow.com/a/25102170
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25102230
downvote count: 0
has answer: http://stackoverflow.com/a/25102230
favorite count: 0
has comment: http://stackoverflow.com/comment/39062425
has comment: http://stackoverflow.com/comment/39062645
type: Question
score: 1
has body: I'm currently using a SpinnerDateModel with a JSpinner to set the time in my java swing app. Below is my code: shiftTime = new JSpinner(new SpinnerDateModel()); JSpinner.DateEditor de_shiftTime = new JSpinner.DateEditor(shiftTime, "HH:mm:ss"); shiftTime.setEditor(de_shiftTime); //shiftTime.setValue(new Date()); // will only show the current time shiftTime.setSize(108, 22); shiftTime.setLocation(436, 478); add(shiftTime); however, when I use the .getValue() method to add this selected time into my database (I'm using mySql), the time is being added with the date. I don't want the date, just the time, e.g. 13:59:16. However, what I'm getting now is "Thu Jan 01 13:59:16 SGT 1970". Is there a way to override the new SpinnerDateModel() or something to remove the date in my result? Any help is greatly appreciated! Thank you! :-)

drag-and-drop
tags question: http://stackoverflow.com/q/25177678
tags question: http://stackoverflow.com/q/25073571
tag name: drag-and-drop
tags question: http://stackoverflow.com/q/25107278
type: Tag

http://stackoverflow.com/comment/39220511
type: Comment
type: QuestionComment
has text: not sure how to edit the logcat is its more readable sorry. ill post my layout
comment on: http://stackoverflow.com/q/25187097
score: 0

http://stackoverflow.com/comment/39092782
has text: If i will develop Client by Java for my PC I can connect to 10.0.2.15:8080 (Emulator) server?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25118278

http://stackoverflow.com/q/25227463
type: Question
has title: accessing a series of controls inside for loop
has body: I have an array which contains some numbers: int[] IDs = new int[] { 2, 5, 6, 11, 15}; There are many TextViews in Layout Resource: TextView1; TextView2; TextView3; TextView4; TextView5; TextView6; and ... . How Is it Possible to Access These in a for loop to (for example) change Their Text like this: for(int i=0;i&lt;IDs.length;i++){ TextView[i].setText = "something"; } problem:Eclipse Doesn't Recognize "TextView[i]". Note:I want to change the text of those TextViews which their name ends with one of the numbers in the IDs array.
score: -2
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/25227517
has comment: http://stackoverflow.com/comment/39295701
favorite count: 0
has comment: http://stackoverflow.com/comment/39295710
has answer: http://stackoverflow.com/a/25227508
tagged with: android
upvote count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/39213652
type: Comment
type: QuestionComment
has text: same problem for URI.create(), it's only a wrapper for the constructor. For the other constructors I need to know the parts of the URL that I'm trying to parse.
score: 0
comment on: http://stackoverflow.com/q/25183405

http://stackoverflow.com/comment/39207691
type: AnswerComment
score: 0
type: Comment
has text: Look [here](http://stackoverflow.com/questions/10786042/java-url-encoding) how to do url encoding.
comment on: http://stackoverflow.com/a/25180439

http://stackoverflow.com/q/25227777
has comment: http://stackoverflow.com/comment/39296281
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/39296259
accepted answer: http://stackoverflow.com/a/25227906
possible better answer: http://stackoverflow.com/a/25227916
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25227916
upvote count: 2
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/39296305
type: Question
has title: Swing: create a CompoundBorder with 3 borders?
has answer: http://stackoverflow.com/a/25228617
has answer: http://stackoverflow.com/a/25227906
has body: I am creating a JFrame object with some JPanels next to each other side by side. I want the JPanels to have a 15px margin, etched border, and 15px padding. At first I thought that this would be something really intuitive just like the HTML box model, so I tried to create CompoundBorder inside a CompoundBorder but that wouldn't work. Here's my code: import java.awt.Dimension; import javax.swing.*; public class StackOverFlowExample extends JFrame { public static void main() { stackOverFlowExample window = new stackOverFlowExample(); window.setVisible(true); } public StackOverFlowExample() { // create buttons JButton foo = new JButton("foo"); JButton bar = new JButton("bar"); JButton foo2 = new JButton("foo2"); JButton bar2 = new JButton("bar2"); // create panels and add buttons to them JPanel left = new JPanel(); left.setBorder(BorderFactory.createEtchedBorder()); left.setLayout(new BoxLayout(left, BoxLayout.PAGE_AXIS)); left.add(foo); left.add(bar); JPanel right = new JPanel(); right.setBorder(BorderFactory.createEtchedBorder()); right.setLayout(new BoxLayout(right, BoxLayout.PAGE_AXIS)); right.add(foo2); right.add(bar2); // add panels to frame this.getContentPane().setLayout(new BoxLayout( getContentPane(), BoxLayout.LINE_AXIS)); this.getContentPane().add(left); this.getContentPane().add(right); // finalize layout this.setPreferredSize(new Dimension(150,150)); this.pack(); this.setVisible(true); } } I'm aware that I could have just used GridBagConstraints or JButton.setMargin() to create the padding, and then use CompoundBorder to create the etched border with an empty border. What if I don't want to make my code look messy with those techniques though?
tagged with: border
linked to: http://stackoverflow.com/q/7229226
answer count: 3
score: 2

http://stackoverflow.com/a/25230127
downvote count: 0
has comment: http://stackoverflow.com/comment/39300843
has body: Only a1 is eligible for GC. b1 is refered by the static member of Alpha (due to a1.b1 = b1;). b2 is refered by the non-static member of a2 (due to a2.b2 = b2;). a2 refernce is not set to null.
type: Answer
has comment: http://stackoverflow.com/comment/39300996
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25230092

http://stackoverflow.com/q/25081029
has comment: http://stackoverflow.com/comment/39022901
has comment: http://stackoverflow.com/comment/39022778
score: 0
has answer: http://stackoverflow.com/a/25081206
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
has title: Hibernate Criteria: nested exception is org.hibernate.QueryException: could not resolve property:
possible better answer: http://stackoverflow.com/a/25081253
has answer: http://stackoverflow.com/a/25081253
accepted answer: http://stackoverflow.com/a/25081206
has body: I'm trying get all data from isssue table that matches with projectname and Issue Id. I'm getting following error. please help me. Tables Project ProjectID ProjectName Issue issueID identifier sourceStatus title severity description Project.java @Entity @Table(name="project") public class Project implements Serializable { private static final long serialVersionUID = 2457316470957669814L; @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="ProjectId") private Integer projectId; @Column(name="projectname") private String projectName; @OneToMany(fetch=FetchType.EAGER,cascade=CascadeType.ALL,mappedBy = "project") private List&lt;Issue&gt; issue; //getters and setters } Issue.java @Entity @Table(name="issue") public class Issue implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="Id") private Integer Id; @Column(name="identifier") private String identifier; @Column(name="sourcestatus") private String sourceStatus; @Column(name="severity") private Integer severity; @Column(name="title") private String title; @Column(name="description") private String description; @ManyToOne @JoinColumn(name ="ProjectId") private Project project; //getters and setters } IssueDAOImpl.java public List&lt;Issue&gt; getAllIssue(String identifier,String projectName) { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Issue.class); criteria.createAlias("Project", "Prj"); criteria.add(Restrictions.eq("identifier",identifier)); criteria.add(Restrictions.eq("Prj.projectName",projectName)); List&lt;Issue&gt; list=criteria.list(); return list; } CONSOLE SEVERE: Servlet.service() for servlet [dcm] in context with path [/SearchTool] threw exception [Request processing failed; nested exception is org.hibernate.QueryException: could not resolve property: Project of: com.dcm.search.bean.Issue] with root cause org.hibernate.QueryException: could not resolve property: Project of: com.dcm.sear…

http://stackoverflow.com/comment/39069805
type: QuestionComment
comment on: http://stackoverflow.com/q/25106118
type: Comment
score: 1
has text: If the developers want to shoot themselves in the foot by modifying data that they shouldn't modify, there is no way you can prevent them to do that. Even if your Address class is immutable, they can still use reflection to modify its field values if they want. As long as they have access to the classes, they do whatever they want with them.

http://stackoverflow.com/comment/39258089
comment on: http://stackoverflow.com/q/25195533
type: QuestionComment
type: Comment
has text: Did you try stepping through the code in a debugger?
score: 0

http://stackoverflow.com/q/25220468
has answer: http://stackoverflow.com/a/25226992
possible better answer: http://stackoverflow.com/a/52694481
has title: Spring-security - cannot access ServletException
answer count: 2
tagged with: spring
tagged with: spring-mvc
has body: I like to use spring-security module, but when I followed a tutorial (http://docs.spring.io/spring-security/site/docs/3.2.x/guides/helloworld.html) from spring project, a compiler return this: [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] \springframework\security\samples\config\SecurityWebApplicationInitializer.java:[5,7] error: cannot access ServletException [ERROR]\springframework\security\samples\config\SecurityConfig.java:[10,7] error: cannot access Filter [INFO] 2 errors Can you guide me what is wrong? <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" > 4.0.0 *** *** war 0.1 Spring MVC Application <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>${project.build.sourceEncoding}</project.reporting.outputEncoding> 1.7 <org.aspectj-version>1.7.4</org.aspectj-version> <org.slf4j-version>1.7.5</org.slf4j-version> <ch.qos.logback-version>1.0.13</ch.qos.logback-version> <org.thymeleaf-version>2.1.2.RELEASE</org.thymeleaf-version> <org.thymeleaf.extras.springsecurity3-version>2.1.1.RELEASE</org.thymeleaf.extras.springsecurity3-version> <springframework.org-version>4.0.6.RELELASE</springframework.org-version> java.net2 Repository hosting the jee6 artifacts http://download.java.net/maven/2 sonatype-oss-repository https://oss.sonatype.org/content/groups/public/ true true repository.spring.milestone Spring Milestone Repository http://repo.spring.io/milestone org.springframework 4.0.6.RELEASE spring-context commons-logging commons-logging 4.0.6.RELEASE org.springframework spring-webmvc 3.2.4.RELEASE org.springframework.security spring-security-config 3.2.4.RELEASE org.springframework.security spring-security-web org.thymeleaf thymeleaf ${org.thymeleaf-version} org.thymeleaf thymeleaf-spring4 org.thymeleaf.extras thym…
tagged with: java
accepted answer: http://stackoverflow.com/a/25226992
score: 11
type: AnsweredQuestion
downvote count: 0
tagged with: spring-security
favorite count: 0
tagged with: security
type: Question
has answer: http://stackoverflow.com/a/52694481
upvote count: 11

http://stackoverflow.com/q/25120357
accepted answer: http://stackoverflow.com/a/25120515
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39116684
tagged with: java
tagged with: javafx
has title: JavaFX: how to access UI thread components from other class
type: Question
tagged with: worker
score: 0
has answer: http://stackoverflow.com/a/25120515
has body: I am new to JavaFX and I am trying to do following: I have main class with UI, important part being public class Main extends Application { ... scene = new Scene(new Group()); final Label label = new Label("Device name"); label.setFont(new Font("Arial", 20)); label.setId("label"); DeviceConnector connector = new DeviceConnector(scene); } In class in other file I have some chained threads. Last of them if each successful (they connect to bluetooth) reads device name. This is what I want to display on the label from above. Unfortunately I have not found any other (rather ellegant) solution than this: public class DeviceConnector { Scene mScene; public DeviceConnector(Scene scene) { mScene = scene; } private void ReadDeviceName { this.deviceName = device.GetName(); Platform.runLater(new Runnable() { @Override public void run() { Label label = (Label) mScene.lookup("#label"); label.setText(deviceName); } }); } } Is there any proper way to access components in JavaFX GUI (something like Mediator pattern)? Thank you.
answer count: 1
linked to: http://stackoverflow.com/q/14187963
tagged with: multithreading

sqldatetime
tags question: http://stackoverflow.com/q/25210882
type: Tag
tag name: sqldatetime

http://stackoverflow.com/q/25094287
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39049388
has comment: http://stackoverflow.com/comment/39049406
has comment: http://stackoverflow.com/comment/39049578
has title: JSON Object NullPointerException from Google Books API
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
tagged with: barcode-scanner
has comment: http://stackoverflow.com/comment/39048313
tagged with: google-books
tagged with: android
has body: I am having some trouble retrieving information such as a book title from the Google Books API using a JSON Object. Below is the relevant code: //Retrieves scanned data from barcode reader public void onActivityResult(int requestCode, int resultCode, Intent intent) { IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent); if (scanningResult != null) { String scanContent = scanningResult.getContents(); String scanFormat = scanningResult.getFormatName(); if(scanContent!=null &amp;&amp; scanFormat!=null &amp;&amp; scanFormat.equalsIgnoreCase("EAN_13")){ String bookSearchString = "https://www.googleapis.com/books/v1/volumes?" + "q=isbn:"+scanContent+"&amp;key=564967988072"; //my key new GetBookInfo().execute(bookSearchString); String booktitle = booktitleText.getText().toString(); BookGenActivity.setBookTitle(booktitle); } else{ Toast toast = Toast.makeText(getApplicationContext(), "Not a valid scan!", Toast.LENGTH_SHORT); toast.show(); } } else{ Toast noData = Toast.makeText(getApplicationContext(), "No scan data received!", Toast.LENGTH_SHORT); noData.show(); } } And here is the class which fetches the book information: private class GetBookInfo extends AsyncTask&lt;String, Void, String&gt; { //fetch book info @Override protected String doInBackground(String... bookURLs) { //request book info StringBuilder bookBuilder = new StringBuilder(); for (String bookSearchURL : bookURLs) { //search urls HttpClient bookClient = new DefaultHttpClient(); try { //get the data HttpGet bookGet = new HttpGet(bookSearchURL); HttpResponse bookResponse = bookClient.execute(bookGet); StatusLine bookSearchStatus = bookResponse.getStatusLine(); if (bookSearchStatus.getStatusCode()==200) { //we have a result HttpEntity bookEntity = bookResponse.getEntity(); InputStream bookContent = bookEntity.getContent(); InputStreamReader bookInput = new InputStreamReader(bookContent); BufferedReader bookReader = new BufferedReader(bookInput); String lineIn; wh…
answer count: 0
has comment: http://stackoverflow.com/comment/39049595

http://stackoverflow.com/q/25096730
tagged with: servlets
downvote count: 1
answer count: 1
tagged with: jsp
favorite count: 0
has title: Troubleshooting GET vs POST
has comment: http://stackoverflow.com/comment/39052503
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25097120
has comment: http://stackoverflow.com/comment/39052615
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/39052746
tagged with: java
has comment: http://stackoverflow.com/comment/39052204
has body: There is a very basic confusion going in our project. We have a Servlet to which some parameters are passed in Query string and it constructs a JSON response for us. This works well. However if we pass the parameters in post, the response returned to us is different, the different being the order in which the results are returned. So Logically - using queryparameter the result is 1,2,3,4,5 Using post variables the result is 1,3,4,2,5 How do we troubleshoot this.
score: -1
has comment: http://stackoverflow.com/comment/39052310

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/25110085
tags question: http://stackoverflow.com/q/25136194
type: Tag

http://stackoverflow.com/comment/39154146
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25151314
has text: Can you put a single quote before the number, save, and try again? What happens if the number is `'2` instead of `2`?

http://stackoverflow.com/a/25222166
accepted answer of: http://stackoverflow.com/q/25222145
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/25222145
score: 3
has body: Java has an IntegerCache that caches all values stored between -128 and 127. 120 &lt; 127 so it is in the cache but 130 > 127 so it isn't in the cache and Java's AutoBoxing will create a new Integer instance for that

http://stackoverflow.com/comment/39238877
type: QuestionComment
comment on: http://stackoverflow.com/q/25196967
has text: Refer to link: this might help you. http://stackoverflow.com/questions/12491536/one-to-many-relation-using-mybatis-or-ibatis
score: 0
type: Comment

http://stackoverflow.com/comment/42172668
score: 0
type: AnswerComment
type: Comment
has text: @prashantthakre Correction: the shell file location is different in my case. It tries to start /usr/lib/<eclipse dir>/collectSupportInformation.sh, not in /opt/eclipse.
comment on: http://stackoverflow.com/a/25091845

http://stackoverflow.com/a/25151296
has comment: http://stackoverflow.com/comment/39154157
downvote count: 0
has comment: http://stackoverflow.com/comment/39154068
has body: The error is here: else if (root.left == null &amp;&amp; root.right != null) { // if left branch is empty value += "(" + root.data + ", empty, " + toString2(root.left) + ")"; } It should be... else if (root.left == null &amp;&amp; root.right != null) { // if left branch is empty value += "(" + root.data + ", empty, " + toString2(root.right) + ")"; } ..., passing root.right rather than root.left to toString2.
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/25151268
answers question: http://stackoverflow.com/q/25151268
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/39154090

http://stackoverflow.com/a/25194056
answers question: http://stackoverflow.com/q/25193635
accepted answer of: http://stackoverflow.com/q/25193635
has body: Try salt = base64.b16decode(salt.upper()). I did and I got the hash in your initial example, albeit uppercased B69139F5... Explanation: The hash and salt are both being stored in Base16 (hex) in your initial example. So you decode the salt to use it and then encode the resulting hash to compare it with the stored one. The upper() is because python's b16decode is strict about uppercase Base16. It will error if you give it the lowercase one.
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/39233315
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/a/25523681
has body: Both Collections.singleton() and Collections.EMPTY_LIST implement Collection (and extend Object for that matter). No type conversions are necessary to return the result of the ternary operator as a Collection or an Object. The java compiler finds the most specific type that matches both parts. It gets tricky with primitive types, but only void is flatly forbidden. See the Java Language Specification on the conditional operator.
answers question: http://stackoverflow.com/q/25190374
type: Answer
score: 0

http://stackoverflow.com/comment/39080365
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25100852
has text: @Pshemo, what problems would arise from closing the writer in the loop? Please explain in the comments, direct me to a question, an article, or some material that explains this.
score: 0

http://stackoverflow.com/comment/39034167
comment on: http://stackoverflow.com/a/25086400
type: Comment
type: AnswerComment
has text: I found the problem. It is due to a missing bean for EclipseLink in the Java Config as suggested [here](http://stackoverflow.com/questions/23319864/spring-jpa-eclipselink-config-with-java-throws-cannot-perform-exception-translat?rq=1). But I still got an exception for type mismatch between the `segmentID` field in my `Segment` class and the data field in my PostgreSQL table `segmentID` which is defined as a `segmentID serial`. What Java type should I give to `segmentID` to match the `serial` type in PostgreSQL?
score: 0

http://stackoverflow.com/q/25192604
has comment: http://stackoverflow.com/comment/39332857
has body: I have a long operation that cannot be moved from the SWT UI thread. I know, it's gross, but that's how it is. I would like to display a progress bar of some sort for said long operation. I have tinkered around with org.eclipse.jface.dialogs.ProgressMonitorDialog. I'm not giving it an IRunnableWithProgress because, like I said, the long op is in the UI thread. And thus, we have something like... Shell shell = new Shell(); ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(shell); progressDialog.open(); IProgressMonitor progressMonitor = progressDialog.getProgressMonitor(); int workLoad = 10; progressMonitor.beginTask(message, workLoad); for(int i = 0; i &lt; workLoad; ++i) { progressMonitor.worked(1); progressMonitor.subTask("Subtask " + (i+1) + " of "+ workLoad + "..."); if(progressMonitor.isCanceled()) { break; } // Do some work. try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } } progressMonitor.done(); progressDialog.close(); This works, but obviously does not update smoothly and at times is laggy to moving and clicking cancel. I thought maybe I could manually update the UI in this instance by creating a thread containing the requisite... while(!shell.isDisposed()) { if(!display.readAndDispatch()) { display.sleep(); } } ...in the run method, but much to my chagrin I bumped into... Exception in thread "Thread-16" org.eclipse.swt.SWTException: Invalid thread access Turns out you can't do that in just any old thread, those calls have to originate in the UI thread. Back to square one. Does anyone know if I can trick the system? Like make my little thread appear to be the UI thread? Or just any other suggestions would be cool. Thanks, jb
has comment: http://stackoverflow.com/comment/39257473
has comment: http://stackoverflow.com/comment/39268031
downvote count: 0
tagged with: multithreading
tagged with: swt
has comment: http://stackoverflow.com/comment/39253878
has comment: http://stackoverflow.com/comment/39255909
has comment: http://stackoverflow.com/comment/39267774
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39240426
score: 1
tagged with: java
tagged with: ui-thread
type: Question
has answer: http://stackoverflow.com/a/25221490
accepted answer: http://stackoverflow.com/a/25221490
has title: SWT progress dialog while performing a long operation in the UI thread?
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/39253754
tagged with: eclipse-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/39231543

http://stackoverflow.com/a/25157626
type: Answer
has body: This should do what you want according to your description String patternStr = "(?:^|,)[A-Z]+=([A-Za-z0-9]+)(?:,|$)"; Match starts at a begin of line/string or comma, and ends at a comma or end of line/string.
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25157553
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25157553
downvote count: 0

http://stackoverflow.com/comment/39132377
comment on: http://stackoverflow.com/q/25139753
type: QuestionComment
has text: @Djon as I said its fine as long as you know what you are doing :). of course for someone inexperience that could lead to some disaster that's why netbeans 'warning'(not stoping) you.
score: 0
type: Comment

http://stackoverflow.com/q/25075503
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39012241
has body: Want to know what could be the best possible way to retrieve the images stored from database in javascript or jquery. Currently i am retrieving the image from database and storing into one temp folder into server side and in the javascript with the help of i am retrieving that particular image. But i am looking for some other way to retrieving the image directly from db without storing into temp folder. Tried my best to brief the problem.If unable to get Let me know i will try in some other way.
possible better answer: http://stackoverflow.com/a/25075671
has answer: http://stackoverflow.com/a/25075671
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/25075755
tagged with: javascript
tagged with: jquery
has answer: http://stackoverflow.com/a/25075645
answer count: 3
has title: Best Possible Way to retrieve image from database in javascript or jquery
has comment: http://stackoverflow.com/comment/39012526
favorite count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/25075645
downvote count: 1

http://stackoverflow.com/a/37832190
answers question: http://stackoverflow.com/q/25212511
has body: If you are creating the jar from your own project then while creating the jar use the package/classes you want to be available in the jar. If you are not creating the jar from your own project, let say you are using ODBC jar. In java build path, we include the complete jar which will be vailable in the classpath. So that we can import the resources when required. Hope this answer your questions.
score: 0
type: Answer

http://stackoverflow.com/q/25215386
has comment: http://stackoverflow.com/comment/39273381
tagged with: java
type: Question
has body: I have the following code: public ArrayList[] username = new ArrayList[1]; public ArrayList[] password = new ArrayList[1]; public void save(String username, String password){ String uname = userField.getText(); String pword = passField.getText(); username.add(uname); password.add(pword); } I am trying to make an ArrayList of usernames and passwords (using Window Builder) and add to it when someone wants to create a new user/pass. However I get an error saying "The method add(String) is undefined for the type String." How do I fix and how do I make it so that the size of my array list can grow as new users are added?
has comment: http://stackoverflow.com/comment/39274913
tagged with: arraylist
score: 0
answer count: 3
tagged with: user-interface
has answer: http://stackoverflow.com/a/42785845
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25215392
tagged with: swing
has answer: http://stackoverflow.com/a/25215632
has title: How to add user input to ArrayList?

http://stackoverflow.com/q/25215417
type: AnsweredQuestion
type: Question
has title: Incrementing time by a specified interval using joda library
has answer: http://stackoverflow.com/a/25215483
tagged with: java
tagged with: jodatime
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25215483
has body: public Map&lt;Integer , String&gt; Timeinterval(int value) { int i = 1440/value ; Map&lt;Integer, String&gt; timeInt = new HashMap&lt;Integer, String&gt;() ; DateTimeFormatter formatter = null ; for(int a=0 ; a&lt; i ; a++) { formatter = DateTimeFormat.forPattern("HH:mm"); LocalTime time = formatter.parseLocalTime("09:00"); time = time.plusMinutes(value); timeInt.put(a,time.toString() ); } return timeInt; } The argument value gets it value from JSP at runtime The moment the control reaches at formatter = DateTimeFormat.forPattern("HH:mm") it could not go beyond this. I executed this part DateTimeFormat.forPattern("HH:mm") by pressing cntrl+shift+I and got this message: could not resolve type: org.joda.time.format.DateTimeFormat Let me know if anything else is wrong with the code Basically what I want to do is increment time for eg: if time is 09:00 and I want to increment it by 30 then it should become 09:30 and this goes on till the time loop condition is satisfied. When I researched on net, I found out that Joda library is easier to work with for such tasks.

http://stackoverflow.com/q/25131827
upvote count: 3
has comment: http://stackoverflow.com/comment/39117698
has comment: http://stackoverflow.com/comment/39118839
tagged with: android
has comment: http://stackoverflow.com/comment/39117908
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39118802
downvote count: 0
has comment: http://stackoverflow.com/comment/39117656
has comment: http://stackoverflow.com/comment/39117786
type: Question
score: 3
has answer: http://stackoverflow.com/a/25131925
accepted answer: http://stackoverflow.com/a/25131925
tagged with: java
has title: Set focus to the EditText upon clicking a button
has body: int[] etColorId = new int[] {R.id.etColor1, R.id.etColor2, R.id.etColor3, R.id.etColor4, R.id.etColor5, R.id.etColor6, R.id.etColor7, R.id.etColor8, R.id.etColor9, R.id.etColor10, R.id.etColor11, R.id.etColor12, R.id.etColor13, R.id.etColor14, R.id.etColor15}; for (int editText : etColorId) { findViewById(editText).setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { // TODO Auto-generated method stub v.setEnabled(false); } }); } int[] btnEditId = new int[] {R.id.btnEdit1, R.id.btnEdit2, R.id.btnEdit3, R.id.btnEdit4, R.id.btnEdit5, R.id.btnEdit6, R.id.btnEdit7, R.id.btnEdit8, R.id.btnEdit9, R.id.btnEdit10, R.id.btnEdit11, R.id.btnEdit12, R.id.btnEdit13, R.id.btnEdit14, R.id.btnEdit15}; for (int button : btnEditId) { findViewById(button).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub v.setEnabled(true); v.requestFocus(); } }); } How can I gain focus to EditText upon clicking a button? I have a bunch of EditTexts and Buttons. Each button corresponds to a specific EditText. What I want is, for example: if I clicked the button1, the EditText1 will be focused. And then when I click other button, the EditText corresponds to that button will be focused and then the other EditTexts will be disabled.
answer count: 3
tagged with: user-interface
possible better answer: http://stackoverflow.com/a/25131841
has answer: http://stackoverflow.com/a/25131969
has comment: http://stackoverflow.com/comment/39118821
has answer: http://stackoverflow.com/a/25131841
favorite count: 0

http://stackoverflow.com/a/25098333
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/25097969
type: Answer
answers question: http://stackoverflow.com/q/25097969
has body: Hey Jake I have a button player on github that works pretty well. You might check out what I'm doing in that class. https://github.com/rbeltran/breathe/blob/master/src/com/jphat/Breathe/util/ButtonPlayer.java It could be the MediaPlayer.prepare() method that you need or release() that you might want to call.
has comment: http://stackoverflow.com/comment/39056415
has comment: http://stackoverflow.com/comment/39056694
has comment: http://stackoverflow.com/comment/39056795
has comment: http://stackoverflow.com/comment/39056624
has comment: http://stackoverflow.com/comment/39057525
has comment: http://stackoverflow.com/comment/39056853
has comment: http://stackoverflow.com/comment/39056559

http://stackoverflow.com/comment/39042382
type: AnswerComment
has text: But for some reason, he says he doesn't want to make any relation between the classes..
comment on: http://stackoverflow.com/a/25091308
type: Comment
score: 0

http://stackoverflow.com/q/25158570
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25165132
type: Question
has title: BigQuery Java API - QueryReponse.getSchema() gives null
has body: We use Java API for accessing BigQuery. At present we experience a lot of query failures when QueryResponse object has null schema info in it. Typically rerun of the same query passes. Questions: Javadoc says null is a sign of unsuccessful query. Why in this particular case BigQuery is not throwing GoogleJsonResponseException as it usually does in other cases to report error? Our read queries are very simple and table contains ~5m records why do we experience a lot of such faults? What is the reason for them? BQ bugs? Unavailability periods? Thanks for help.
tagged with: google-bigquery
upvote count: 2
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/39064289
comment on: http://stackoverflow.com/q/25102836
score: 0
type: Comment
type: QuestionComment
has text: Ok! So did I solve the issue the right way? By adding thread.setRunning(false)? It worked fine at least :)

http://stackoverflow.com/comment/39174323
has text: Unfortunately, the Map is not injected. Exception: Guice configuration errors: No implementation for java.util.Map<java.lang.String, my.package.name.SomeDataSource> was bound.
comment on: http://stackoverflow.com/q/25156824
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25144993
answers question: http://stackoverflow.com/q/25144904
score: 0
has body: In IntelliJ (for example), you can use the Inspections which can point out the unused methods. You will find some details there: How to use IntelliJ IDEA to find all unused code? If you want to scan a set of projects, you can also use Sonar, an open source platform for Continuous Inspection of code quality. It provides a few plugins for finding dead code, such as this one.
type: Answer

http://stackoverflow.com/q/25087216
downvote count: 0
favorite count: 0
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/25089331
tagged with: android
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25088501
linked to: http://stackoverflow.com/q/8040280
accepted answer: http://stackoverflow.com/a/25089331
has answer: http://stackoverflow.com/a/25088501
type: Question
score: 4
has body: I couldn't find any solution to this problem that satisfies all my requirements. In my application I use AsyncTasks to perform some operations like saving data to a memory or reading data from a database. I create a progress dialog in onPreExecute, update a progress value in onProgressUpdate and dismiss the dialog in onPostExecute. Recently I switched to the Fragment API (I use the Support Library to target older versions of Android), meaning that my activities subclass FragmentActivity and dialogs subclass DialogFragment. Switching to the Fragment API caused a well-known problem - sometimes I get the following exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState This happens, for instance, when a user starts a background operation (a progress dialog appears), uses the home button to minimize the application and the operation finishes when the activity is in background. The application then tries to dismiss the dialog and this fails since the state of the activity was saved. I understand the issue. It can be fixed by ensuring that changes to the UI are postponed until the activity is resumed as described in this post: How to handle Handler messages when activity/fragment is paused. However, this solution leads to another problem. What if the operation finishes when the activity is in background and later the activity is killed by Android? When a user navigates back to the application, it restores its state that was saved in onSaveInstanceState. Therefore, the progress dialog is still visible with the same progress value as when the activity was put into background. A message that should dismiss it, was never processed and it was lost when the activity was killed. What is the correct solution that handles all the described issues properly? How to allow for changing the UI when the activity is in background or, at least, allow for postponing UI changes and ensuring they won't be lost in case the activity is killed by Androi…
tagged with: android-fragmentactivity
upvote count: 4
has comment: http://stackoverflow.com/comment/39042219
answer count: 2
has title: How to perform background operations in Android that update the UI properly using Fragments?

http://stackoverflow.com/q/25185890
has answer: http://stackoverflow.com/a/25185967
accepted answer: http://stackoverflow.com/a/25188882
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/11033603
has answer: http://stackoverflow.com/a/25188882
has comment: http://stackoverflow.com/comment/39217793
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39217764
tagged with: java
has body: I've made a little snake game and exported it into a runnable JAR file through Eclipse. It works perfect in machines with JDK installed (with regards to the environment variables and all that.) But "normal" people don't have that installed, only the JRE that can be found here: http://java.com/en/download/index.jsp This is insufficient to execute the JAR apparently. I've tried numerous approaches: packeging libraries in Jar Extracting libraries in Jar Build with java 1.7 building with java 1.8 checked the build path to make sure the libraries is included. At best I get a "Java Exception occured" on the other PC (the one with JDK installed). I've then tried to run the JAR on my own machine through cmd with the command... java -jar fileName.jar ...in the hope that I would get an error log, but nope, it just runs the JAR like there's no problem. Any ideas on how to make the JAR run on a machine with JRE installed? Thanks in advance
tagged with: eclipse
has answer: http://stackoverflow.com/a/25188992
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/39217734
tagged with: jar
has comment: http://stackoverflow.com/comment/39217827
possible better answer: http://stackoverflow.com/a/25185967
has comment: http://stackoverflow.com/comment/39217784
favorite count: 0
has comment: http://stackoverflow.com/comment/39223035
has title: Runnable Jar made in Eclipse, Doesn't work on pc's without JDK installed
has comment: http://stackoverflow.com/comment/39220915

http://stackoverflow.com/a/25224171
answers question: http://stackoverflow.com/q/25224170
has body: The set returned from FXCollections.unmodifiableObservableSet() work in mysterious ways. You might think you add a listener to the backing set, but in reality, the listeners you add go straight to the wrapper, which has registered himself as a weak listener (WeakSetChangeListener) of the backing set. As long as the wrapper is alive and kicking, his personal listener will pick up events from the backing set and distribute those to the listeners I have registered with the wrapper. But as I never stored a strong reference to the wrapper, it was only a matter of time before the wrapper was picked up by the garbage collector and disposed thereof. All my trigger-happy listeners joined the ride. And here lie also the entire difference between my small test application and the desktop application that despite identical code, had two completely different results. My test application was executed from start to finish in no time. It took time though for my desktop application to go from registration of the listener to the actual event. It is during that time a GC kicked in and fucked me up. After spending my time reading source code only, I must, theoretically, conclude that the unmodifiable yet observable Map work the same. So lesson learned: save the reference to the unmodifiable wrapper or rework your client's API so that client's may pass listeners directly to the backing Set (which is the solution I picked). For more reading on how weak listeners work in JavaFX, see another answer I posted here.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25224170
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4

http://stackoverflow.com/q/25169798
has body: I am using these technologies to solve this task : Java, Spring, Hibernate For instance if I have 3 Entities: User, Company, Address as usually I should create a DaoImpl class and Dao interface: interface Dao{ void saveUser(User user); void saveCompany(Company company); void saveAddress(Address address); } @Repository public class DaoImpl extends HibernateDaoSupport implements Dao{ void SaveUser(User user){ getHibernateTemplate().save(user); } void SaveCompany(Company company){ getHibernateTemplate().save(company); } . . . } and here we go for every save() it should have its own method SaveCompany(), SaveUser(), SaveAddress().... but what if we have hundreds of them is it convenient to be writing a method for everyone of them ? can we just write such method instead ? void save(Object obj){ getHibernateTemplate().save(obj); }
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39443510
accepted answer: http://stackoverflow.com/a/25169883
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring
has title: Spring Java Hibernate managing save() of multiple entities
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39188488
has answer: http://stackoverflow.com/a/25169883
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/39271267
comment on: http://stackoverflow.com/a/25214028
score: 0
type: AnswerComment
has text: After doing it like this i outputted the entire map and noticed it was out of order; is this an issue?
type: Comment

http://stackoverflow.com/q/25189624
favorite count: 0
has answer: http://stackoverflow.com/a/25189794
has answer: http://stackoverflow.com/a/25189655
type: Question
upvote count: 2
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/25189655
tagged with: java
tagged with: thread-priority
answer count: 3
accepted answer: http://stackoverflow.com/a/25189794
has comment: http://stackoverflow.com/comment/39225182
has title: Java - Thread.setPriority() Error: cannot find symbol (the period between Thread and setPriority)
has answer: http://stackoverflow.com/a/25189843
has body: I'm taking a Java 2 class and our assignment is to show how multiple threads can be assigned different priorities. I'm trying to manipulate the example code in the book to see if it works and I'm getting a compiler error: cannot find symbol for lines in TaskExecutor.java: setPriority(task1.MIN_PRIORITY); setPriority(task2.MAX_PRIORITY); setPriority(task3.NORMAL_PRIORITY); PrintTask.java: import java.util.Random; import java.lang.*; public class PrintTask implements Runnable { private final int sleepTime; // random sleep time for thread private final String taskName; // name of task private final static Random generator = new Random(); // constructor public PrintTask( String name ) { taskName = name; // set task name // pick random sleep time between 0 and 5 seconds sleepTime = generator.nextInt( 5000 ); // milliseconds } // method run contains the code that a thread will execute public void run() { try { // put thread to sleep for sleepTime amount of time System.out.printf( "%s going to sleep for %d milliseconds.\n", taskName, sleepTime ); Thread.sleep( sleepTime ); // put thread to sleep } catch ( InterruptedException exception ) { System.out.printf( "%s %s\n", taskName, "terminated prematurely due to interruption" ); } // print task name System.out.printf( "%s done sleeping\n", taskName ); } // end method run } // end class PrintTask TaskExecutor.java: import java.util.concurrent.Executors; import java.util.concurrent.ExecutorService; import java.lang.*; public class TaskExecutor { public static void main( String[] args ) { // create and name each runnable PrintTask task1 = new PrintTask( "task1" ); PrintTask task2 = new PrintTask( "task2" ); PrintTask task3 = new PrintTask( "task3" ); // Set Priorities setPriority(task1.MIN_PRIORITY); setPriority(task2.MAX_PRIORITY); setPriority(task3.NORMAL_PRIORITY); /* compiler error: cannot find symbol setPriority(task_.---_PRIORITY);" ^ */ System.out.println( "Starting Executor" ); // create ExecutorService to manage threads…
score: 2
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/25201378
has title: Initialization/storing variabile for many functions
type: Question
has comment: http://stackoverflow.com/comment/39246688
has answer: http://stackoverflow.com/a/25201508
answer count: 1
has comment: http://stackoverflow.com/comment/39246693
has body: I have sample code. I need to get rid of arg2 from f1 and f2. public void initialize(int arg1) { //arg2 initialization int arg2 = 0; f1(arg1, arg2); f2(arg1, arg2); } f1(int arg1,int arg2){ //do sth } f2(int arg1, int arg2){ //do sth } I tried to initialize it in each function, but when you have, for example 15 functions and instead of integer you have big HashMap it's too expensive to initialize it every time. public void initialize(int arg1) { f1(arg1); f2(arg1); } f1(int arg1){ int arg2=0; //do sth } f2(int arg1){ int arg2=0; //do sth } I also want to avoid creating variable as static. Have you any ideas of storing that?
accepted answer: http://stackoverflow.com/a/25201508
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/a/25099485
score: 1
type: AcceptedAnswer
downvote count: 0
has body: It's not possible to display HTML to the client unless it's a modded client. You can only use what is provided by the Bukkit API or Minecraft server.
answers question: http://stackoverflow.com/q/25080554
type: Answer
accepted answer of: http://stackoverflow.com/q/25080554
upvote count: 1

http://stackoverflow.com/q/25150577
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25156088
answer count: 1
downvote count: 0
favorite count: 0
tagged with: ajax
has body: I'm new in rails. I want to send ajax request to rails server in java application.(no javascript, just java) So, I used 'urlconnection' to make request in java. It worked without error(complete 200), However, It didn't update view. So, I think that it need to set some header to send ajax request. If possible, please give some example. Thank you.. [In Java application] &gt;&gt; Send request String url = "http://127.0.0.1:3000/app/subaction" String param1 = "choi"; String param2 = "jun"; String charset = "UTF-8"; String query = String.format("param1=%s&amp;param2=%s",param1, param2); URLConnection urlConnection = new URL(url).openConnection(); urlConnection.setDoOutput(true); urlConnection.setRequestProperty("accept-charset", charset); urlConnection.setRequestProperty("Accept", "text/javascript"); urlConnection.setRequestProperty("X-Requestedasasd-With", "XMLHttpRequest"); urlConnection.connect(); OutputStreamWriter writer = null; writer = new OutputStreamWriter(urlConnection.getOutputStream(), charset); writer.write(query); if(writer != null){ writer.close(); } [app_controller.rb] def subaction @choi = params[:param1] @jun = params[:param2] respond_to do |format| format.js end [subaction.js.erb] $('#textcontainer').empty().append("&lt;%= j render 'textcontainer'%&gt;"); [_textcontainer.html.erb] choi : &lt;%= @choi %&gt; jun : &lt;%= @jun %&gt; [app.html.erb] &lt;div id=textcontainer&gt;&lt;/div&gt;
has answer: http://stackoverflow.com/a/25156088
upvote count: 1
tagged with: ruby-on-rails
has title: Send Ajax request to Rails server in java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39152783

http://stackoverflow.com/q/25197946
has comment: http://stackoverflow.com/comment/39241219
tagged with: java
tagged with: document
tagged with: jtextarea
tagged with: awt
has title: How to provide LineNumbers to the given text in wrapped mode
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39243133
tagged with: swing
type: Question
has body: I had wrote LineNumbers logic for text in JTextArea. It is working fine whenever enter some text and enable the Viewlinenumbers. But, I enter some long line of text with multiple lines then I enable wordwrap action first, then I enable ViewLineNumbers, It's not working correctly. Please check it once. Here is code: public class ViewLineNumbers extends javax.swing.JFrame { int i=0; JTextArea textArea,lnNum; JScrollPane scrollPane; public ViewLineNumbers() { initComponents(); viewLineNumbers.setSelected(false); wordWrap.setSelected(false); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { tabbedPane = new javax.swing.JTabbedPane(); menuBar = new javax.swing.JMenuBar(); file = new javax.swing.JMenu(); newAction = new javax.swing.JMenuItem(); viewLineNumbers = new javax.swing.JCheckBoxMenuItem(); wordWrap = new javax.swing.JCheckBoxMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); file.setText("File"); newAction.setText("New"); newAction.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newActionActionPerformed(evt); } }); file.add(newAction); viewLineNumbers.setSelected(true); viewLineNumbers.setText("ViewLineNumbers"); viewLineNumbers.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { viewLineNumbersActionPerformed(evt); } }); file.add(viewLineNumbers); wordWrap.setSelected(true); wordWrap.setText("WordWrap"); wordWrap.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { wordWrapActionPerformed(evt); } }); file.add(wordWrap); menuBar.add(file); setJMenuBar(menuBar); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.A…

http://stackoverflow.com/comment/39131688
has text: Use two different cameras. The physics debugging camera should use viewport size / PIXEL_PER_METER. The Sprite camera has the standard viewport size.
type: Comment
comment on: http://stackoverflow.com/q/25139318
type: QuestionComment
score: 1

http://stackoverflow.com/q/25223175
has comment: http://stackoverflow.com/comment/39287795
has title: Can't upload picture from client to server using jsp/servlets
type: UnansweredQuestion
answer count: 0
has body: I'm trying to upload a picture from a client to the server with jsp/java servlets, but I'm having some difficulties... It seems like the process is completed but I can't find the copied file anywhere... Here's what I have so far: index.jsp Insert title here FileUploadServlet.java (only relevant part) protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletFileUpload upload=new ServletFileUpload(new DiskFileItemFactory()); try { FileItemStream item=upload.getItemIterator(request).next(); String pictureOnServer=getServletContext().getRealPath("/"); // pictureOnServer: /home/****/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/TestProject/ File fileOnServer=new File(pictureOnServer+File.separator+"pics"+File.separator+"fileNameOnServer"); FileOutputStream fos=new FileOutputStream(fileOnServer); InputStream is=item.openStream(); byte[] buffer=new byte[8*1024]; int length; while ((length=is.read())>0) { fos.write(buffer, 0, length); } fos.flush(); fos.close(); } catch (FileUploadException e) { e.printStackTrace(); } response.sendRedirect("index.jsp"); } When I run index.jsp, I get: I then click "Browse..." and choose some picture named "picture.jpg", and click "Upload", but the file will not get copied: There's nothing in the "pics" folder as you can see... (even after refreshing) Does anyone know what went wrong?
tagged with: java
has comment: http://stackoverflow.com/comment/39287876
type: Question
tagged with: jsp
tagged with: servlets
has comment: http://stackoverflow.com/comment/39287702
has comment: http://stackoverflow.com/comment/39287870
score: 0

http://stackoverflow.com/comment/39064766
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25103495
has text: There is not a whole lot of J2SE support for Windows mobiles. [Mysaifu](http://www2s.biglobe.ne.jp/~dat/java/project/jvm/index_en.html) is one such JVM that supports Windows mobile 5.0. However, I am not sure if it would work if you are using JDK1.7 specific functionalities.

http://stackoverflow.com/comment/39270594
type: QuestionComment
comment on: http://stackoverflow.com/q/25210901
has text: Can you post your code?
score: 0
type: Comment

http://stackoverflow.com/a/25150692
has comment: http://stackoverflow.com/comment/39153438
upvote count: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25150648
answers question: http://stackoverflow.com/q/25150648
score: 5
type: Answer
has body: When you call removeAll() java will remove entries from the list that are equal to any entry in the list you pass as an argument. The trouble is, two arrays are never equal unless they are exactly the same array instance, which in your code they are not. You could use a wrapper class to contain your int arrays, which overrides the equals() method and uses Arrays.equals(array1, array2) to compare two arrays for equality.
has comment: http://stackoverflow.com/comment/39153294

http://stackoverflow.com/comment/39126043
type: Comment
has text: but are you doing this: org.hibernate.classic.Session session = HibernateUtil.getSessionFactory().openSession(); everytime?
comment on: http://stackoverflow.com/a/25132398
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39215803
type: Comment
comment on: http://stackoverflow.com/q/25184930
has text: use a `do`-`while`loop
score: 0
type: QuestionComment

http://stackoverflow.com/a/25186876
type: Answer
accepted answer of: http://stackoverflow.com/q/25185255
has body: Heres some psuedo code.. 1.Create a AcknowledgementManager which waits for acknowledgement of each request. 2.The acknowledgement manager posts a runnable which will run after TIME_OUT interval. public void startListeningForTimeOut(CallContext callContext) { TimeOutRunnable timeOutRunnable = new TimeOutRunnable(callContext); mMapRunnables.put(callContext, timeOutRunnable); mHandler.postDelayed(timeOutRunnable, TIMEOUT_DURATION); Slog.d(TAG, "started listening for timeout for token: " + callContext + " at: " + System.currentTimeMillis()); } 3.1 If the AcknowledgementManager receives acknowledgement for the data it cancels the runnable for that data and make necessary updates in database. public void stopListeningForTimeOut(CallContext callContext) { mHandler.removeCallbacks(mMapRunnables.get(callContext)); mMapRunnables.remove(callContext); Slog.d(TAG, "stopped listening for timeout for token: " + callContext + " at: " + System.currentTimeMillis()); } 3.2 If the acknowledgement is not received the runnable raises a "timeout" to the AcknowledgementManager.The AcknowledgementManager retries sending data. public class TimeOutRunnable implements Runnable { private static final String TAG = "TimeOutThread rupesh"; CallContext mToken; // String mCallback; public TimeOutRunnable(CallContext callContext) { mToken = callContext; // mCallback = callbackTBD; // FIXME send proper callback class } @Override public void run() { Slog.d(TAG, "timeout occured for data id: " + mToken + " at: " + System.currentTimeMillis()); mToken.onTimeOutOccurred(); } } Please note: 1.Before syncing the data please make the entry of data in db so that the data does not get lost between app restart. 2.Before you start the syncing process query the db to get the data which is not being transmitted.Based on the data size,make sure you keep the data to be transmitted in memory to avoid hitting the db everytime. 3.Once you get acknowledgement for a data item,make necessary changes for that entry in db. 4…
has comment: http://stackoverflow.com/comment/39241753
answers question: http://stackoverflow.com/q/25185255
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39249460

http://stackoverflow.com/a/25279454
has body: from your question i digged up only two questions How to do continuous development with grunt/bower + tomcat How to deploy for production 1 - Continuous development The solution i have chosen for that - since you already use api to communicate client <-> server- is to separate completely the two projects. So what does it mean? for me is to have two different repositories. One for client, One for Server one this way you get few benefits: Split the work on the projects (front-end/server-side) Easier to maintain In case you want to support "API only" For an example, mobile application, and etc.. But - How do they communicate while developing? This is a good question: One solution is to run two server on localhost in parallel, i.e mvn clean tomcat:run -P yourprofile; grunt server But - I'll get cross domain if I try to access server-side from client-side from different port? You are right. And here you get the help of grunt and its plugin. grab a copy of grunt-connect-proxy What is nice about this plugin that it acts as a middleware between grunt server and tomcat server so you ask grunt server for the API but actually grunt is asking tomcat server to answer on that (behind the scenes of course) 2 - Deploy for production I guess this is a matter of personal preference question. I find the war file extremely big to do upload again and again (even if are able to share lib between all of your tomcat app). The solution I came up with is to do deploy over git. OK, but I have one big war file. How can I do that? For me I use a deploy script I wrote in bash. This is what it does: Tag the current source Run mvn clean package war:exploded -P your-prod-profile (this will run test and integration test as well) With the above command you get all your complied project's file in one place, instead of one big war file. Copy all those files (and inner paths) into outside folder (I use another repository for maintenance deployment over git. So basically I have 3 repositories. One for se…
has comment: http://stackoverflow.com/comment/57967708
answers question: http://stackoverflow.com/q/25086853
downvote count: 0
score: 8
has comment: http://stackoverflow.com/comment/39714307
upvote count: 8
type: Answer

http://stackoverflow.com/a/25116802
downvote count: 1
score: 0
has body: you can just split like you did before once more (with > instead of #) and use the element [0] istead of [1]
answers question: http://stackoverflow.com/q/25116743
type: Answer
upvote count: 1

http://stackoverflow.com/q/25133950
has comment: http://stackoverflow.com/comment/39123775
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25134023
tagged with: android
has comment: http://stackoverflow.com/comment/39121476
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39121483
has title: Error in calculating speed using thread in Android
has body: package project.vtrac.tracker; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone; import android.app.Dialog; import android.content.Intent; import android.location.Criteria; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.loopj.android.http.AsyncHttpResponseHandler; import com.loopj.android.http.RequestParams; public class MapView extends FragmentActivity implements LocationListener { GoogleMap googleMap; private Double latitude; private Double longitude; private Double speed; private int curTime; private int lastTime; private Double lastLat; private Double lastLng; TextView msgArea; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mapview); checkGooglePlayService(); } public void checkGooglePlayService() { // Getting Google Play availability status int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext()); // Showing status if(status!=ConnectionResult.SUCCESS) // Google Play Services are not available { int requestCode = 10; Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, requestCode); dialog.show(); } else { createMap(); } } public void createMap() { // Getting reference to the SupportMapFragment of map.xml SupportMapFragment mapFrag = (SupportMapFragment) getSupportFragmentManager().findFragmen…
downvote count: 1
type: Question
tagged with: java
score: -1
tagged with: eclipse

http://stackoverflow.com/comment/39152109
type: AnswerComment
has text: Thanks again by your support.
score: 0
comment on: http://stackoverflow.com/a/25149573
type: Comment

http://stackoverflow.com/comment/39098367
has text: You can play with application server management API and try to unregister deployed EJBs from JNDI and register your mocks with same name. But this is absolutely vendor-specific task, so please describe what application server do you use.
comment on: http://stackoverflow.com/q/25121375
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39779483
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25210671
type: Comment
has text: Can you share the code where you add the Jokes to the JokeHolder class.

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/25106199
tags question: http://stackoverflow.com/q/25098872
tags question: http://stackoverflow.com/q/25075303
tags question: http://stackoverflow.com/q/25079760
tags question: http://stackoverflow.com/q/25216817
tags question: http://stackoverflow.com/q/25162215
tag name: android-actionbar
tags question: http://stackoverflow.com/q/25229194
tags question: http://stackoverflow.com/q/25089866

http://stackoverflow.com/a/51322579
has body: JasperReports offset can be set by JRXlsExporterParameter.OFFSET_X property. Below is the sample code: JRXlsxExporter exporter = new JRXlsxExporter(); exporter.setParameter(JRXlsExporterParameter.OFFSET_X, 500);
score: 0
answers question: http://stackoverflow.com/q/25087631
type: Answer

http://stackoverflow.com/q/25072736
has body: class Parent { private int var = 1; public int getVar() { return var; } public void setVar(int var) { this.var = var; } } class Child extends Parent { private int var = 2; public int getVar() { return var; } public void setVar(int var) { this.var = var; } } And now, when testing it, we get 2. Child child = new Child(); Parent parent = (Parent)child; System.out.println(parent.getVar()); I am casting the child object to a Parent explicitly and making my intentions clear why then when i do parent.getVar() i get 2 ?
has answer: http://stackoverflow.com/a/25072752
upvote count: 2
has comment: http://stackoverflow.com/comment/39007377
favorite count: 0
answer count: 5
downvote count: 4
has comment: http://stackoverflow.com/comment/39007489
tagged with: java
has answer: http://stackoverflow.com/a/25072775
accepted answer: http://stackoverflow.com/a/25072754
type: Question
type: AnsweredQuestion
has title: Why this in OOP
tagged with: oop
possible better answer: http://stackoverflow.com/a/25072775
score: -2
has answer: http://stackoverflow.com/a/25072776
has answer: http://stackoverflow.com/a/25072754
has answer: http://stackoverflow.com/a/25072778

http://stackoverflow.com/a/25193176
has body: Every time writeErrorsToSpreadSheet is called, it creates a new, blank workbook and creates a sheet. Then you write it to the file, overwriting the old file that was there. If you want this method to append to an existing workbook, then you must create the HSSFWorkbook object by loading the existing workbook. HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream("input.xls")); Then you can find the last populated row in the sheet with Sheet's getLastRowNum method, which you can use to add data to the next row. You may also want to consider using the common interface between the "HSSF" (.xls) and "XSSF" (.xlsx) world, in the org.apache.poi.ss.usermodel package, and you can use WorkbookFactory to get a new Workbook, which will work for .xls (HSSFWorkbook) and .xlsx (XSSFWorkbook) files.
has comment: http://stackoverflow.com/comment/39246332
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25193045
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39232042

http://stackoverflow.com/q/25129822
upvote count: 9
has answer: http://stackoverflow.com/a/25218593
accepted answer: http://stackoverflow.com/a/25130378
tagged with: bouncycastle
tagged with: android
has body: So I'm using Spongy Castle (Android) to generate a PEM encoded string for an RSA public key that will be uploaded to a server. This is what I'm currently doing: PublicKey publicKey = keyPair.getPublic(); StringWriter writer = new StringWriter(); PemWriter pemWriter = new PemWriter(writer); pemWriter.writeObject(new PemObject("RSA PUBLIC KEY", publicKey.getEncoded())); pemWriter.flush(); pemWriter.close(); return writer.toString(); Now as you can probably tell I'm not sure how to construct the PemObject or if there is an easier way to do this. When using Bouncy Case I used to do this like this StringWriter writer = new StringWriter(); PEMWriter pemWriter = new PEMWriter(writer); pemWriter.writeObject(keyPair.getPublic()); pemWriter.flush(); pemWriter.close(); return writer.toString(); But for some reason the PEMWriter class does not exist in Spongy Castle
possible better answer: http://stackoverflow.com/a/25218593
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25130378
has comment: http://stackoverflow.com/comment/105090798
downvote count: 0
tagged with: java
score: 9
type: Question
has comment: http://stackoverflow.com/comment/124920090
tagged with: spongycastle
answer count: 2
has title: Export RSA public key to PEM String using java
favorite count: 0

http://stackoverflow.com/comment/39154353
comment on: http://stackoverflow.com/q/25151314
score: 0
type: Comment
type: QuestionComment
has text: Then you parse it as a `double`, and convert that `double` to an `int` in your code.

http://stackoverflow.com/a/25211326
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39269642
score: 2
accepted answer of: http://stackoverflow.com/q/25210174
answers question: http://stackoverflow.com/q/25210174
has body: I'm not 100% sure, but I think it's this line of configuration that's causing the problem in the spring-security.xml: &lt;csrf/&gt; If you enable CSRF in the security, your post requests need to be updated to include some extra information. It explains why GET works, but POST doesn't. In your case, try removing it, and see if it fixes the problem.

http://stackoverflow.com/comment/39242216
comment on: http://stackoverflow.com/a/25198462
type: Comment
has text: strange, how are you running your code? If you simply execute it it will not start any spring context, you need to run it as a JUnit test.
score: 0
type: AnswerComment

http://stackoverflow.com/a/25226586
score: 2
has comment: http://stackoverflow.com/comment/42249619
upvote count: 3
has body: @BatchSize will fetch record from db based on your size. Think you have 100 records in your result and if you are defined batch size as 10 then it will fetch 10 records per db call. Logically it will increase performance.
downvote count: 1
answers question: http://stackoverflow.com/q/25210949
has comment: http://stackoverflow.com/comment/39389889
has comment: http://stackoverflow.com/comment/39378691
type: Answer
has comment: http://stackoverflow.com/comment/101561233

http://stackoverflow.com/q/25169381
score: 0
has title: Trouble understanding Genetic Algorithm - Java
upvote count: 1
downvote count: 1
answer count: 1
favorite count: 0
has body: I am currently working with a gaming code library and one of the parts uses a genetic algorithm for some of the AI. This concept is rather new to me and although I've looked up and read about how it works I am finding it hard how to link precisely what is being evolved, mutated etc. to the actual code. The actions are basically each of the possible options that the AI has to move. So it is trying to evolve a state and find out which is the best action to take. Can anyone help me understand it a bit clearer than that? private static double GAMMA = 0.90; private static long BREAK_MS = 35; private static int SIMULATION_DEPTH = 7; private static int POPULATION_SIZE = 5; private static double RECPROB = 0.1; private double MUT = (1.0 / SIMULATION_DEPTH); private final int N_ACTIONS; private ElapsedCpuTimer timer; private int genome[][][]; private final HashMap&lt;Integer, Types.ACTIONS&gt; action_mapping; private final HashMap&lt;Types.ACTIONS, Integer&gt; r_action_mapping; protected Random randomGenerator; private int numSimulations; /** * Public constructor with state observation and time due. * * @param stateObs state observation of the current game. * @param elapsedTimer Timer for the controller creation. */ public Agent(StateObservation stateObs, ElapsedCpuTimer elapsedTimer) { randomGenerator = new Random(); action_mapping = new HashMap&lt;Integer, Types.ACTIONS&gt;(); r_action_mapping = new HashMap&lt;Types.ACTIONS, Integer&gt;(); int i = 0; for (Types.ACTIONS action : stateObs.getAvailableActions()) { action_mapping.put(i, action); r_action_mapping.put(action, i); i++; } N_ACTIONS = stateObs.getAvailableActions().size(); initGenome(stateObs); } double microbial_tournament(int[][] actionGenome, StateObservation stateObs, StateHeuristic heuristic) throws TimeoutException { int a, b, c, W, L; int i; a = (int) ((POPULATION_SIZE - 1) * randomGenerator.nextDouble()); do { b = (int) ((POPULATION_SIZE - 1) * randomGenerator.nextDouble()); } while (a == b); double score_a …
type: UnansweredQuestion
tagged with: genetic-algorithm
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25307797

mit-scratch
tags question: http://stackoverflow.com/q/25100903
tag name: mit-scratch
type: Tag

http://stackoverflow.com/q/25166301
answer count: 2
downvote count: 0
tagged with: jackson
has answer: http://stackoverflow.com/a/25177090
has body: Im reading the Facebook Insights and trying to get Jackson to map the JSON to Object. If all the data comes in without empty, i have it working. But Im having a problem trying to deserialize empty array of key value. Even after trying this post: How to prevent null values inside a Map and null fields inside a bean from getting serialized through Jackson it did not resolve the problem :( This is the JSON : {"data":[{"id":"492640667465465\/insights\/page_fans_country\/lifetime","name":"page_fans_country","period":"lifetime","values":[{"value":{"MY":26315,"ID":311,"SG":77,"NP":63,"MM":56,"PH":51,"GB":44,"US":44,"KR":36,"TH":36,"IN":34,"BD":24,"PK":22,"BN":22,"AU":15,"TW":14,"VN":12,"KH":11,"YE":11,"CA":10,"JP":10,"EG":8,"ZA":7,"SA":6,"ES":6,"HK":6,"FR":6,"IT":5,"IL":5,"IR":5,"NG":5,"LK":5,"BR":5,"IQ":4,"AF":4,"AE":4,"GT":4,"RO":4,"LR":4,"RU":4,"PS":4,"DE":4,"CN":4,"LY":3,"JO":3},"end_time":"2014-08-02T07:00:00+0000"},{"value":{"MY":26326,"ID":315,"SG":77,"NP":63,"MM":56,"PH":54,"GB":44,"US":43,"TH":38,"KR":36,"IN":33,"BD":23,"BN":22,"PK":21,"AU":16,"TW":14,"VN":12,"KH":11,"YE":11,"CA":10,"JP":10,"EG":8,"ZA":7,"SA":7,"ES":6,"HK":6,"FR":6,"IT":5,"IL":5,"IR":5,"NG":5,"LK":5,"BR":5,"IQ":4,"RU":4,"CN":4,"GT":4,"RO":4,"LR":4,"AF":4,"PS":4,"DE":4,"AE":4,"LY":3,"CH":3},"end_time":"2014-08-03T07:00:00+0000"},{"value":{"MY":26338,"ID":312,"SG":79,"NP":63,"MM":55,"PH":52,"US":45,"GB":44,"TH":39,"KR":34,"IN":32,"BD":24,"BN":22,"PK":21,"AU":16,"TW":14,"KH":12,"VN":12,"CA":11,"YE":11,"JP":10,"EG":8,"ZA":7,"SA":7,"ES":6,"HK":6,"FR":6,"IT":5,"CN":5,"IR":5,"NG":5,"LK":5,"BR":5,"IL":5,"IQ":4,"AF":4,"AE":4,"GT":4,"RO":4,"LR":4,"RU":4,"PS":4,"DE":4,"NZ":3,"TR":3},"end_time":"2014-08-04T07:00:00+0000"}],"title":"Lifetime Likes by Country","description":"Lifetime: Aggregated Facebook location data, sorted by country, about the people who like your Page. (Unique Users)"},{"id":"492640667465465\/insights\/page_storytellers_by_country\/day","name":"page_storytellers_by_country","period":"day",…
tagged with: serialization
has comment: http://stackoverflow.com/comment/39184330
has title: Jackson Can not deserialize empty array
possible better answer: http://stackoverflow.com/a/39432818
favorite count: 0
has answer: http://stackoverflow.com/a/39432818
score: 9
accepted answer: http://stackoverflow.com/a/25177090
type: AnsweredQuestion
upvote count: 9
has comment: http://stackoverflow.com/comment/39192321
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/11449211
type: Question

http://stackoverflow.com/q/25140203
has answer: http://stackoverflow.com/a/25140390
has answer: http://stackoverflow.com/a/25140288
tagged with: java
has answer: http://stackoverflow.com/a/25140333
type: Question
tagged with: overriding
has body: I am a beginner at Java and as not as familiar with its syntax as compared to C. Specifically I have the follow code; there are 2 TextViews view1, view2, and I make the same Toast message pop up on clicking either TextViews public class MainActivity extends ActionBarActivity { private TextView view1, view2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); view1 = (TextView)findViewById(R.id.item_1a); view1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(v.getContext(),"button clicked",Toast.LENGTH_SHORT).show(); } }); view2 = (TextView)findViewById(R.id.item_1b); view2.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { Toast.makeText(v.getContext(),"button clicked",Toast.LENGTH_SHORT).show(); } }); } } I realised that if there are 100 TextViews, it will be inefficient if i keep overriding onClick 100 times. As such, is there a way to override onClick just once, and let all instances of setOnClickListener to refer back to the same onClick? Thanks!
has comment: http://stackoverflow.com/comment/39133069
score: 0
has answer: http://stackoverflow.com/a/25140359
has answer: http://stackoverflow.com/a/25140365
has comment: http://stackoverflow.com/comment/39133124
has title: Similar overrides on 2 different listeners
answer count: 5
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/39300617
comment on: http://stackoverflow.com/a/25127142
has text: Using the code u mentioned, am going allways a little bit farther than 32, so my x or y end up being exact rounded like 448.0 BUT thats not where player should be, i found out that doing the math on the speed makes that problem to happend or not to happend depending on the 'period', so i can tell theres something wrong calculating the speed math with those floats... or maybe the x = (float)Math.round(x);
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25190288
type: Question
tagged with: criteria
has title: Filtering entitys in Criteria list()
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25191089
has comment: http://stackoverflow.com/comment/39226856
type: AnsweredQuestion
has body: I have the following setting: A CallRegistry bean that has TrunkBean in it and TrunkBean has Operator bean. In my criteria Im adding: criteria.createAlias("callRegistry.trunk", "trunk"); criteria.createAlias("trunk.operator", "op"); I need to use GSON on the resulting list to populate a datatable but the problem is the resulting list always return the TrunkBean, OperatorBean and CallRegistry inside a Object. . resultadoQuery is the queryResult after list() troncoBean is trunk, operadora is operator, rlBean is callRegistry What can I do to maybe filter this and get only the CallRegistry bean to come in the result? Is this even possible? Is there other alternatives to this problem? This is also being done (and commenting these two lines solves the problem): total = (Number) criteria.setProjection(Projections.rowCount()).uniqueResult(); criteria.setProjection(null) Why is this breaking?
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25191089

http://stackoverflow.com/a/25112228
downvote count: 0
answers question: http://stackoverflow.com/q/25112193
has body: Arrays.asList(...) returns a new ArrayList. Here's the tricky part. The new ArrayList is not the one in the java.util package, it is actually a static inner class in Arrays class. Check this code. Arrays.java public static &lt;T&gt; List&lt;T&gt; asList(T... a) { return new ArrayList&lt;T&gt;(a); } // the static inner class is shown below. private static class ArrayList&lt;E&gt; extends AbstractList&lt;E&gt; implements RandomAccess, java.io.Serializable { private static final long serialVersionUID = -2764017481108945198L; private final E[] a; ArrayList(E[] array) { if (array==null) throw new NullPointerException(); a = array; } ... }
score: 4
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/39081371

http://stackoverflow.com/q/25218261
type: Question
tagged with: hibernate
score: 4
has body: I'm using hiberate 4.3.5 Final and encounter following warning org.hibernate.id.UUIDHexGenerator WARN - HHH000409: Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values; consider using org.hibernate.id.UUIDGenerator instead So i have change my mapping file unique id generator from generator class="uuid.hex" to generator class="uuid2" Coding wise i know this is just a warning but is there any other advantage using uuid2 over uuid.hex. Is it more effective way or standard way to use uuid2 or best coding practise? I'm trying to go for best coding practise in my application. Any guru's can help me on this? One additional thing i notice is that uuid2 key is having "-" compare to the uuid.hex. Any disadvantage?
answer count: 1
favorite count: 0
tagged with: hibernate-mapping
upvote count: 4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25218285
has title: Hibernate UUID.hex vs UUID2
tagged with: uuid
accepted answer: http://stackoverflow.com/a/25218285
tagged with: java
tagged with: annotations

http://stackoverflow.com/comment/39080420
comment on: http://stackoverflow.com/q/25100852
has text: If you disagree with the community, you can flag comments, edit your question so that it can be reviewed, and you can post on meta to discuss it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39068326
comment on: http://stackoverflow.com/a/25103630
type: Comment
has text: Yes, you are right. I updated the example to use javax.swing.Timer
type: AnswerComment
score: 2

http://stackoverflow.com/q/25127958
has comment: http://stackoverflow.com/comment/39111152
tagged with: arrays
tagged with: permutation
score: 0
has title: Is there a way to save output into an array after a program has been executed?
answer count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/39110963
tagged with: java
has comment: http://stackoverflow.com/comment/39111027
has body: I figured out how to generate permutations of a set using recursion, however I cannot figure out how to save the values it produces. Is there a way to re scan over data outputted by the program in order to save it? Or am I going the wrong direction here? Here is the code I've been working with: import java.util.Scanner; import java.util.Arrays; public class test { //Arrays.toString(int[]); &gt;&gt;Converts int array to string. //int foo = Integer.parseInt("1234"); public static void main() { String str; str = getStr(); // int n = str.length(); //Trying to use this to catch output!! int nf = 1; for(int i=n;i&gt;0;i--) {nf *= i;} int[][] array = new int[nf][n]; // char[] arr = str.toCharArray(); boolean[] visited = new boolean[n]; for(int i=0;i&lt;n;i++) {visited[i] = false;} char[] branch = new char[n]; generatePermutations(arr,n,branch,-1,visited); //The visited array keeps track of which nodes have been visited already. } public static void generatePermutations(char[] arr,int size,char[] branch,int level,boolean[] visited) { if(level &gt;= size-1) {System.out.println(branch); return; } for(int i=0;i&lt;size;i++) { if(!visited[i]) { branch[++level] = arr[i]; visited[i] = true; generatePermutations(arr,size,branch,level,visited); visited[i] = false; level--; } } } // public static String getStr() { Scanner kb = new Scanner(System.in); String str; int n; System.out.print("Enter the size (n): "); n = kb.nextInt(); int[] initialSet = new int[n]; for(int i=0;i&lt;n;i++) { initialSet[i] = (i+1); } str = Arrays.toString(initialSet).replace(", ", "").replace("[","").replace("]",""); return str; } }

http://stackoverflow.com/q/25165695
tagged with: email
has answer: http://stackoverflow.com/a/25167481
accepted answer: http://stackoverflow.com/a/25167481
has title: Button not creating a file and showing email provider option menu when pressed
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39181563
has comment: http://stackoverflow.com/comment/39181982
type: Question
upvote count: 2
answer count: 1
favorite count: 0
has body: I've created a button that creates a file then sends it as an attachment to an email, it grabs the text from one of the textviews, saves it to a .txt and sends it. A small email service option selector should show up too. The code is meant to create a file path if one is not already there. This code is above the onCreate method and in a regular activity. i keep getting this in the logcat (specific message marked by (-->)): --&gt;08-06 12:53:01.019 18432-18432/com.example.adrian.trucktracker W/System.err﹕ java.io.IOException: open failed: ENOENT (No such file or directory)&lt;--- 08-06 12:53:01.019 18432-18432/com.example.adrian.trucktracker W/System.err﹕ at java.io.File.createNewFile(File.java:946) 08-06 12:53:01.019 18432-18432/com.example.adrian.trucktracker W/System.err﹕ at com.example.adrian.trucktracker.Locator.clickedUpdate(Locator.java:76) 08-06 12:53:01.019 18432-18432/com.example.adrian.trucktracker W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method) 08-06 12:53:01.019 18432-18432/com.example.adrian.trucktracker W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:515) 08-06 12:53:01.029 18432-18432/com.example.adrian.trucktracker W/System.err﹕ at android.view.View$1.onClick(View.java:3860) 08-06 12:53:01.029 18432-18432/com.example.adrian.trucktracker W/System.err﹕ at android.view.View.performClick(View.java:4480) 08-06 12:53:01.029 18432-18432/com.example.adrian.trucktracker W/System.err﹕ at android.view.View$PerformClick.run(View.java:18686) 08-06 12:53:01.029 18432-18432/com.example.adrian.trucktracker W/System.err﹕ at android.os.Handler.handleCallback(Handler.java:733) 08-06 12:53:01.029 18432-18432/com.example.adrian.trucktracker W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:95) 08-06 12:53:01.029 18432-18432/com.example.adrian.trucktracker W/System.err﹕ at android.os.Looper.loop(Looper.java:157) 08-06 12:53:01.029 18432-18432/com.example.adrian.trucktracker W/System.err﹕ at android.app.ActivityThread.main(…
tagged with: android

xsd
tags question: http://stackoverflow.com/q/25176754
tags question: http://stackoverflow.com/q/25141724
tag name: xsd
tags question: http://stackoverflow.com/q/25134819
type: Tag
tags question: http://stackoverflow.com/q/25118451
tags question: http://stackoverflow.com/q/25123900
tags question: http://stackoverflow.com/q/25110783

http://stackoverflow.com/comment/39213210
has text: You are using the wrong indexes. Your are first checking `"-number".equals(arg)` and then try to pars arg (which is "-number") as a number. You have to move your index +1.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25183635

http://stackoverflow.com/q/25186216
tagged with: lambda
tagged with: method-reference
has comment: http://stackoverflow.com/comment/39219673
upvote count: 74
answer count: 2
has title: Java 8 pass method as parameter
tagged with: java-8
accepted answer: http://stackoverflow.com/a/25199262
tagged with: java
has body: Currently getting into Java 8 lambda expressions and method references. I want to pass a method with no args and no return value as argument to another method. This is how I am doing it: public void one() { System.out.println("one()"); } public void pass() { run(this::one); } public void run(final Function function) { function.call(); } @FunctionalInterface interface Function { void call(); } I know there is a set of predefined functional interfaces in java.util.function such as Function&lt;T,R&gt; but I didn't find one with no arguments and not producing a result.
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/32445915
has answer: http://stackoverflow.com/a/32445915
favorite count: 0
has answer: http://stackoverflow.com/a/25199262
type: Question
score: 74
has comment: http://stackoverflow.com/comment/39218776

http://stackoverflow.com/q/25151470
answer count: 1
favorite count: 0
has title: upload files to google drive from a java application without user interaction
tagged with: google-drive-api
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25152117
score: 2
tagged with: java
has body: I am developing a java application where I want the application to upload files to Google drive without any user interaction and after saving the files I want it to be viewed by a real person. Can you help me achieve the above? Issues I am facing, Authenticating using application owned accounts: In case of regular account: authenticated using API key but unable to insert files. In case of service accounts: successfully authenticated and inserted files into the drive but unable to be viewed by a real person. Using upload files: I am not sure where to obtain auth_code and how to set it to the header. A sample code would be helpful. It would be great if you can help me on this.
type: Question
tagged with: google-oauth
downvote count: 0

cachedrowset
type: Tag
tag name: cachedrowset
tags question: http://stackoverflow.com/q/25215100

http://stackoverflow.com/comment/39181691
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25166233
has text: You'd need to realize that you're trying to set to an `int` field, and use `Integer.parseInt` or something similar to parse the string to an integer before setting the field value - just as you would if you were trying to assign a value to the field in normal code.

http://stackoverflow.com/comment/39237960
type: QuestionComment
score: 1
has text: Your problem is much alike http://stackoverflow.com/questions/2279718/why-does-bitwise-and-of-two-short-values-result-in-an-int-value-in-java
comment on: http://stackoverflow.com/q/25196565
type: Comment

http://stackoverflow.com/comment/39174719
type: Comment
comment on: http://stackoverflow.com/q/25158266
type: QuestionComment
has text: I don't recommend using a public-read-write bucket - that would allow anyone on the Internet to upload data to your bucket, which could be abused in a variety of ways. Instead you might consider using signed URLs (https://developers.google.com/storage/docs/accesscontrol#Signed-URLs).
score: 4

http://stackoverflow.com/a/25143920
has body: I could find the answer to make it work with xml approach since it was easier than using annotated beans (I had no luck to make it work with @Configurable). I had to configure my aspect as: &lt;bean id="notificationAspect" factory-method="aspectOf" class="com.creditsesame.integration.core.aspect.NotificationAspect"&gt; &lt;/bean&gt; ^---Notice the factory-method with aspectOf() On spring documentation says: The majority of AspectJ aspects are singleton aspects. Configuration of these aspects is very easy: simply create a bean definition referencing the aspect type as normal, and include the bean attribute 'factory-method="aspectOf"'. This ensures that Spring obtains the aspect instance by asking AspectJ for it rather than trying to create an instance itself. More information can be found on section 7.8.1 and 7.8.3 on below link: http://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/aop.html#aop-aj-ltw Thanks Andrew Eisenberg for guide me on the right direction and Sotirios Delimanolis for provide some ideas.
type: Answer
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25129463
answers question: http://stackoverflow.com/q/25129463
score: 0

http://stackoverflow.com/q/25170315
has title: How to create X number of elements in an array?
type: UnansweredQuestion
downvote count: 2
type: Question
score: -2
tagged with: java
has body: For an assignment in school I need to create a class that extends a "Wallet" class that has already been created. The contructor needs to accept an argument of how many credit cards this instance of your new wallet class will have. How would I accomplish something like this in java using arrays?
upvote count: 0
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/39189495
favorite count: 0
has answer: http://stackoverflow.com/a/25170376

http://stackoverflow.com/a/25185911
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25162501
score: 3
upvote count: 3
has body: My changes to correct this were: @Captor private ArgumentCaptor&lt;ArrayList&lt;?&gt;&gt; aList; @Before public void setup() { MockitoAnnotations.initMocks(this); } //setup @Test public void test() { Foo foo = mock(Foo.class); String testString = "Hello Test"; Boolean testBoolean = true; List&lt;String&gt; stringList = new ArrayList&lt;String&gt;(); stringList.add(testString); List&lt;Boolean&gt; booleanList = new ArrayList&lt;Boolean&gt;(); booleanList = testBoolean; foo.doSomething(stringList); foo.doSomething(booleanList); //verify to capture and assertion that it happened twice verify(foo, times(2)).doSomething(aList.capture()); //Get all captured values from the verified invocation List&lt;ArrayList&lt;?&gt;&gt; args aList.getAllValues(); //verify first list, should be String assertEquals("TestString assertion wrong", testString, args.get(0).get(0)); //verify second list, should be Boolean assertEquals("TestBoolean assertion wrong", testBoolean, args.get(1).get(0)); } //test private static class Foo { public &lt;T&gt; void doSomething(List&lt;T&gt; list){} }

http://stackoverflow.com/comment/39268133
type: Comment
comment on: http://stackoverflow.com/q/25207419
score: 0
type: QuestionComment
has text: Does the book also say where `what` is coming from? Does it happen to be read from the keyboard?

http://stackoverflow.com/a/25081062
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25080307
has body: There are many issues with this code, but i'll try to name the issues. After pasting it into Eclipse, all errors are easily visible. First of all, your method calls are written wrong: Error Correction Lines 58, 89: Interger.parseInt(str[0]); --&gt; Integer.parseInt(str[0]); Line 64: str[1].length --&gt; str[1].length() Lines 67, 75, 79, 82: charAT --&gt; charAt Lines 67, 75: charAt(i).matches --&gt; charAt(i) == '1' || charAt(i) == '2' || ... (not recommended) Note: Try the following: char c = str[1].charAt(i); boolean b = Character.isLetter(c) &amp;&amp; Character.isUpperCase(c) || Character.isDigit(c); if(b) { ... } Furthermore, there is no String.concat() with char: Line 79: tempstring=tempstring.concat(str[1].charAt(i)); --&gt; tempstring += str[1].charAt(i) Line 87: Sytem.out.println --&gt; System.out.println After Line 91 there is a } missing, which is too much in Line 157. That's where your illegal start of expression comes from. Also you should redo your toString() method. After all this, your code should compile I think. Addendum : Please, please format your code properly. It is so hard to read. As a positive side-effect you will see problems, that cause your mentioned error, earlier.
score: 1

http://stackoverflow.com/q/25136412
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39129841
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39131975
tagged with: jsp
has comment: http://stackoverflow.com/comment/39126282
has comment: http://stackoverflow.com/comment/39127362
has title: Unable to import a class in a jsp page in eclipse
has comment: http://stackoverflow.com/comment/39127764
has comment: http://stackoverflow.com/comment/39127586
has comment: http://stackoverflow.com/comment/39129955
linked to: http://stackoverflow.com/q/3177733
has answer: http://stackoverflow.com/a/25136798
has answer: http://stackoverflow.com/a/25136708
has comment: http://stackoverflow.com/comment/39138418
favorite count: 0
has body: I am using eclipse luna and created a project on jsp but unable to call a class from "conect " package defined in src folder of my project ConnectionProviderForSql.java package connect; import java.sql.*; public class ConnectionProviderForSql { public static Connection con=null; public static Connection getCon(){ try{ String DRIVER="com.mysql.jdbc.Driver"; String CONNECTION_URL="jdbc:mysql://localhost:3306/abc"; String USERNAME="username"; String PASSWORD="password"; Class.forName(DRIVER); con=DriverManager.getConnection(CONNECTION_URL,USERNAME,PASSWORD); if(con!=null){ System.out.println("connected");} else{ System.out.println("not connected"); } }catch(Exception e){e.printStackTrace();} return con; } } my jsp file reseller.jsp &lt;%@page import="connect.ConnectionProviderForSql"%&gt; &lt;%@page import="java.sql.PreparedStatement"%&gt; &lt;%@page import="java.sql.ResultSet"%&gt; &lt;%@page import="java.sql.Statement"%&gt; &lt;%@page import="java.sql.Connection"%&gt; &lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&gt; &lt;% Connection con1=null; Statement stmt =null; ResultSet rs = null; PreparedStatement ps=null; String result="bla"; con1 = ConnectionProviderForSql.getCon(); %&gt; my browser output org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: [14] in the generated java file: [/root/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/Panel/org/apache/jsp/reseller_jsp.java] Only a type can be imported. connect.ConnectionProviderForSql resolves to a package An error occurred at line: 17 in the jsp file: /reseller.jsp ConnectionProviderForSql cannot be resolved 14: PreparedStatement ps=null; 15: String result="bla"; 16: 17: con1 = ConnectionProviderForSql.getCon(); 18: I had tried related question but it dint solve my problem Why it cannot resolve the class i have imported the package Please help trying this for hours. Thanks
type: UnansweredQuestion
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39125832
downvote count: 1
has comment: http://stackoverflow.com/comment/39125930
tagged with: java
has comment: http://stackoverflow.com/comment/39128016

http://stackoverflow.com/q/25198384
score: 2
upvote count: 2
has title: Elasticsearch score precision
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25388279
answer count: 1
downvote count: 0
tagged with: lucene
favorite count: 0
accepted answer: http://stackoverflow.com/a/25388279
tagged with: elasticsearch
has body: My problem is: There is an index in my Elasticsearch with a very sensitive field of the type double which I use for '_score' calculation. Firstly, when is store this value to an index, Elasticsearch cuts its value, but then I found an additional mapping parameter: precision_step, which resolves my problem with correct value storing. But I still have a problem with correct _score sensitivity, because Elasticsearch rounds it's value. So, my question is: How I can set some precision parameters (like precision_step) for result _score value? Thanks in advance!

http://stackoverflow.com/q/25104405
has comment: http://stackoverflow.com/comment/39066313
has comment: http://stackoverflow.com/comment/39068297
has body: I have written a Thread that is dedicated to take a screenshot and convert it to jpg. So my other thread can send this screenshot parallel to another computer while the next screenshot is being taken. So far so good. It did not work to take new screenshots until I added a System.out.println... screenshot_ready... That is really weird because a println should not affect the thread. Can you maybe explain why it only works with this system.out.println? public void run(){ while(continueLoop){ System.out.println("screenshot_ready: " + screenshot_ready + "\n"); if(!screenshot_ready){ try { temp = getImageAsJPEG(robot.createScreenCapture(rectangle)); screenshot_ready = true; System.out.println("screenshot created"); } catch (ImageFormatException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } } public byte[] returnJPG() { screenshot_ready = false; return temp; }
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39066626
has title: Very Strange Thread error with Java
duplicate of: http://stackoverflow.com/q/25425130
has comment: http://stackoverflow.com/comment/39066292
favorite count: 0
has comment: http://stackoverflow.com/comment/39068914
has comment: http://stackoverflow.com/comment/39066500
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39066583
has comment: http://stackoverflow.com/comment/39066457
has comment: http://stackoverflow.com/comment/39066398
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/25117770
downvote count: 1
has comment: http://stackoverflow.com/comment/39066352
type: Question
has comment: http://stackoverflow.com/comment/39066564
has comment: http://stackoverflow.com/comment/39066396
has comment: http://stackoverflow.com/comment/39068210
score: -1
has comment: http://stackoverflow.com/comment/39066473
has comment: http://stackoverflow.com/comment/39066514
has comment: http://stackoverflow.com/comment/39066477
linked to: http://stackoverflow.com/q/25425130

http://stackoverflow.com/q/25148562
has comment: http://stackoverflow.com/comment/39149236
has comment: http://stackoverflow.com/comment/39149232
has title: String font size smaller when calling repaint()
has answer: http://stackoverflow.com/a/25148649
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25148657
possible better answer: http://stackoverflow.com/a/25148649
favorite count: 0
tagged with: font-size
has comment: http://stackoverflow.com/comment/39149165
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/25148657
answer count: 2
has comment: http://stackoverflow.com/comment/39149257
tagged with: paint
tagged with: java
has body: When I draw a string with g.drawString() the resulting text is smaller than the set font. If you run the following code, you can see that the desired font size is displayed, then a smaller one shows up once the second thread calls repaint() I have tried SwingUtilities.invokeLater() before calling repaint but that did not help. Any ideas? import java.awt.Font; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; public class Test { static JPanel panel; public static void main(String[] args) { JFrame frame = new JFrame(); panel = new JPanel() { private static final long serialVersionUID = 1L; public void paint(Graphics g) { g.clearRect(0, 0, panel.getWidth(), panel.getHeight()); g.drawString("TEST", 20, 100);// Where I draw the string } }; panel.setFont(new Font("Arial", Font.BOLD, 30));// The desired font frame.add(panel); frame.setSize(500, 500); frame.setVisible(true); new Thread() {// This thread calls repaint() after two seconds public void run() { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } panel.repaint(); } }.start(); } }

http://stackoverflow.com/comment/39105199
comment on: http://stackoverflow.com/a/25124230
has text: It depends if you are using 64bits or 32bits. tessdll.dll should be found at C:\Windows\SysWOW64 or C:\Windows\System32
type: AnswerComment
score: 0
type: Comment

list
type: Tag
tags question: http://stackoverflow.com/q/25074893
tags question: http://stackoverflow.com/q/25157880
tags question: http://stackoverflow.com/q/25211426
tags question: http://stackoverflow.com/q/25091253
tags question: http://stackoverflow.com/q/25171798
tags question: http://stackoverflow.com/q/25173229
tag name: list
tags question: http://stackoverflow.com/q/25165849
tags question: http://stackoverflow.com/q/25137856
tags question: http://stackoverflow.com/q/25210019
tags question: http://stackoverflow.com/q/25083543
tags question: http://stackoverflow.com/q/25128155
tags question: http://stackoverflow.com/q/25074613
tags question: http://stackoverflow.com/q/25144703
tags question: http://stackoverflow.com/q/25114491
tags question: http://stackoverflow.com/q/25134222
tags question: http://stackoverflow.com/q/25084710
tags question: http://stackoverflow.com/q/25163514
tags question: http://stackoverflow.com/q/25134424
tags question: http://stackoverflow.com/q/25144788
tags question: http://stackoverflow.com/q/25090447
tags question: http://stackoverflow.com/q/25117839
tags question: http://stackoverflow.com/q/25100724
tags question: http://stackoverflow.com/q/25167823
tags question: http://stackoverflow.com/q/25088919
tags question: http://stackoverflow.com/q/25185766
tags question: http://stackoverflow.com/q/25156195
tags question: http://stackoverflow.com/q/25150648
tags question: http://stackoverflow.com/q/25177706

http://stackoverflow.com/comment/39054495
comment on: http://stackoverflow.com/q/25096718
has text: how did you create the project because the maven webapp layout is not the same as shown in your image
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25226415
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/39298935
has comment: http://stackoverflow.com/comment/39317404
has comment: http://stackoverflow.com/comment/39294013
tagged with: type-inference
tagged with: java-8
has answer: http://stackoverflow.com/a/25313246
accepted answer: http://stackoverflow.com/a/25313246
type: AnsweredQuestion
downvote count: 0
tagged with: ecj
tagged with: java
has comment: http://stackoverflow.com/comment/39400261
type: Question
has title: Java 8: generic type inference fails on method reference?
score: 5
has body: Can anyone tell me why the following code fails to compile but the lambda version does: Are there rules about the generic type inference? Anything I should avoid? Failed: EntityLayerManager.refreshLayerRenderables( wwd, this.networkNodeShapeLayer, nodeMap.values(), MissionDetailUIConst::createNetworkNodeRenderable, MissionDetailUIConst::updateNetworkNodeRenderable) // &lt;&lt;== FAILED Success (with normal lambda): EntityLayerManager.refreshLayerRenderables( wwd, this.networkNodeShapeLayer, nodeMap.values(), MissionDetailUIConst::createNetworkNodeRenderable, (e, coll) -&gt; MissionDetailUIConst.updateNetworkNodeRenderable(e, coll)); Success (with generic parameters specified): EntityLayerManager.&lt;EwmsVwNetworkNodeEntity, KolladaRoot&gt;refreshLayerRenderables( wwd, this.networkNodeShapeLayer, nodeMap.values(), MissionDetailUIConst::createNetworkNodeRenderable, MissionDetailUIConst::updateNetworkNodeRenderable) Referenced Methods: public static &lt;E, R extends Renderable&gt; int refreshLayerRenderables(WorldWindow wwd, RenderableLayer renderableLayer, Collection&lt;E&gt; entityList, Function&lt;E, ? extends Collection&lt;? extends R&gt;&gt; createRenderables, BiPredicate&lt;E, Collection&lt;R&gt;&gt; updateRenderables); public static Collection&lt;KolladaRoot&gt; createNetworkNodeRenderable(EwmsVwNetworkNodeEntity networkNode); public static boolean updateNetworkNodeRenderable(EwmsVwNetworkNodeEntity networkNode, Collection&lt;KolladaRoot&gt; colladaRootCollection);
answer count: 1
has comment: http://stackoverflow.com/comment/39300014
tagged with: generics

sql
tags question: http://stackoverflow.com/q/25083812
tags question: http://stackoverflow.com/q/25199272
tags question: http://stackoverflow.com/q/25210540
tags question: http://stackoverflow.com/q/25130179
tags question: http://stackoverflow.com/q/25096634
tags question: http://stackoverflow.com/q/25218086
tags question: http://stackoverflow.com/q/25165049
tags question: http://stackoverflow.com/q/25190342
tags question: http://stackoverflow.com/q/25205038
tags question: http://stackoverflow.com/q/25102319
tags question: http://stackoverflow.com/q/25115053
tags question: http://stackoverflow.com/q/25189257
tags question: http://stackoverflow.com/q/25200815
tags question: http://stackoverflow.com/q/25224852
tags question: http://stackoverflow.com/q/25214353
tags question: http://stackoverflow.com/q/25104784
tags question: http://stackoverflow.com/q/25205230
tags question: http://stackoverflow.com/q/25179180
tags question: http://stackoverflow.com/q/25119480
tags question: http://stackoverflow.com/q/25088081
tags question: http://stackoverflow.com/q/25122419
tags question: http://stackoverflow.com/q/25125619
tags question: http://stackoverflow.com/q/25074167
tags question: http://stackoverflow.com/q/25183948
tags question: http://stackoverflow.com/q/25117318
tags question: http://stackoverflow.com/q/25073541
tags question: http://stackoverflow.com/q/25135285
tag name: sql
tags question: http://stackoverflow.com/q/25177034
type: Tag
tags question: http://stackoverflow.com/q/25213935
tags question: http://stackoverflow.com/q/25227357
tags question: http://stackoverflow.com/q/25073122
tags question: http://stackoverflow.com/q/25173630
tags question: http://stackoverflow.com/q/25152211
tags question: http://stackoverflow.com/q/25210534
tags question: http://stackoverflow.com/q/25116783
tags question: http://stackoverflow.com/q/25143344
tags question: http://stackoverflow.com/q/25176860
tags question: http://stackoverflow.com/q/25108836
tags question: http://stackoverflow.com/q/25111422
tags question: http://stackoverflow.com/q/25212636
tags question: http://stackoverflow.com/q/25221332
tags question: http://stackoverflow.com/q/25155124
tags question: http://stackoverflow.com/q/25184184
tags question: http://stackoverflow.com/q/25204889
tags question: http://stackoverflow.com/q/25120751
tags question: http://stackoverflow.com/q/25088818
tags question: http://stackoverflow.com/q/25229597
tags question: http://stackoverflow.com/q/25134699
tags question: http://stackoverflow.com/q/25168036
tags question: http://stackoverflow.com/q/25131136
tags question: http://stackoverflow.com/q/25077196
tags question: http://stackoverflow.com/q/25228187
tags question: http://stackoverflow.com/q/25093329
tags question: http://stackoverflow.com/q/25095662
tags question: http://stackoverflow.com/q/25193560
tags question: http://stackoverflow.com/q/25125480
tags question: http://stackoverflow.com/q/25171562
tags question: http://stackoverflow.com/q/25183900
tags question: http://stackoverflow.com/q/25095430
tags question: http://stackoverflow.com/q/25122632
tags question: http://stackoverflow.com/q/25191199
tags question: http://stackoverflow.com/q/25091547
tags question: http://stackoverflow.com/q/25088752
tags question: http://stackoverflow.com/q/25208049
tags question: http://stackoverflow.com/q/25208493
tags question: http://stackoverflow.com/q/25071705
tags question: http://stackoverflow.com/q/25212777
tags question: http://stackoverflow.com/q/25117501
tags question: http://stackoverflow.com/q/25071068
tags question: http://stackoverflow.com/q/25223384
tags question: http://stackoverflow.com/q/25204160
tags question: http://stackoverflow.com/q/25210475
tags question: http://stackoverflow.com/q/25137332
tags question: http://stackoverflow.com/q/25120583
tags question: http://stackoverflow.com/q/25150521
tags question: http://stackoverflow.com/q/25196795
tags question: http://stackoverflow.com/q/25137180
tags question: http://stackoverflow.com/q/25177460

http://stackoverflow.com/a/25095116
score: 8
accepted answer of: http://stackoverflow.com/q/25095019
has comment: http://stackoverflow.com/comment/39092288
downvote count: 0
has comment: http://stackoverflow.com/comment/39094313
has comment: http://stackoverflow.com/comment/39092054
has body: It is possible to set an SSLSocketFactory on an HttpsUrlConnection. This is only possible with ssl and not with the "plain" HttpUrlConnection.
upvote count: 8
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25095019
type: Answer

lambda
tags question: http://stackoverflow.com/q/25172595
tags question: http://stackoverflow.com/q/25221114
tags question: http://stackoverflow.com/q/25186216
tags question: http://stackoverflow.com/q/25192108
tag name: lambda
tags question: http://stackoverflow.com/q/25222575
tags question: http://stackoverflow.com/q/25077270
type: Tag
tags question: http://stackoverflow.com/q/25075389
tags question: http://stackoverflow.com/q/25166337
tags question: http://stackoverflow.com/q/25228079
tags question: http://stackoverflow.com/q/25182285
tags question: http://stackoverflow.com/q/25139604

http://stackoverflow.com/comment/39318816
type: AnswerComment
has text: I asked the engineering team and it is hard to understand what you are doing wrong based on the info you posted here. Can you post a complete StackTrace? code snippet? We suggest that you post on our forum. We also have the ability to contact people offline and figure out a solution faster through faster interaction.
type: Comment
comment on: http://stackoverflow.com/a/25200908
score: 0

http://stackoverflow.com/comment/39278099
comment on: http://stackoverflow.com/a/25213888
score: 0
has text: Thanks, but the executor runs once, doesn't manage to run repeatedly
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39277478
comment on: http://stackoverflow.com/a/25217516
score: 0
type: AnswerComment
type: Comment
has text: :) Oki.. Does it mean to run the say() method each thread must keep the class key until a Thread is completed?

http://stackoverflow.com/q/25116423
has comment: http://stackoverflow.com/comment/39089089
has title: Duplication child JFrame on click
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/9554636
score: 0
answer count: 1
tagged with: multiple-instances
has body: I have a window, which is the main window in my app and it contains buttons. On clicking on one of them, a child JFrame appears and if I click again another frame appears and this can be continuous depending on how many clicks are made. What I want, is when I click on the JButton once only one frame should open and since this frame is open no other similar frames can be opened upon clicking on the button for the second time until the first child frame is closed.
has answer: http://stackoverflow.com/a/25116560
tagged with: jframe
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/comment/39281231
comment on: http://stackoverflow.com/a/25218900
has text: @SalimaLifri I'm sorry, I wrote `addAttribute` when I meant `setAttribute` - post edited
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39161168
type: AnswerComment
comment on: http://stackoverflow.com/a/25155304
score: 0
type: Comment
has text: Such a silly Question! guess i was so tired of looking at screen! Thank You ! :D

http://stackoverflow.com/comment/39241933
score: 0
type: Comment
has text: Installing for Eclipse 4.4(Luna) I am still getting the same error message during the installation?
type: AnswerComment
comment on: http://stackoverflow.com/a/25198578

http://stackoverflow.com/comment/39304061
comment on: http://stackoverflow.com/q/25223297
score: 0
type: Comment
type: QuestionComment
has text: Thanks, but what I meant was that what I did was easy to understand. Not that it's necessarily efficient or flexible, though I appreciate the suggestion

arraylist
tags question: http://stackoverflow.com/q/25189061
tags question: http://stackoverflow.com/q/25099406
tags question: http://stackoverflow.com/q/25155774
tags question: http://stackoverflow.com/q/25095989
tags question: http://stackoverflow.com/q/25073503
tags question: http://stackoverflow.com/q/25073312
tags question: http://stackoverflow.com/q/25091615
tags question: http://stackoverflow.com/q/25097018
tags question: http://stackoverflow.com/q/25163707
tags question: http://stackoverflow.com/q/25125413
tags question: http://stackoverflow.com/q/25144703
tags question: http://stackoverflow.com/q/25161925
tags question: http://stackoverflow.com/q/25095803
tags question: http://stackoverflow.com/q/25176033
tags question: http://stackoverflow.com/q/25143410
tags question: http://stackoverflow.com/q/25225107
tags question: http://stackoverflow.com/q/25167823
tags question: http://stackoverflow.com/q/25172928
tags question: http://stackoverflow.com/q/25194377
tags question: http://stackoverflow.com/q/25073015
tags question: http://stackoverflow.com/q/25109164
tags question: http://stackoverflow.com/q/25150648
tags question: http://stackoverflow.com/q/25188336
tags question: http://stackoverflow.com/q/25185737
tags question: http://stackoverflow.com/q/25197450
tags question: http://stackoverflow.com/q/25205751
tags question: http://stackoverflow.com/q/25133364
tags question: http://stackoverflow.com/q/25228385
tags question: http://stackoverflow.com/q/25161366
tags question: http://stackoverflow.com/q/25147799
tags question: http://stackoverflow.com/q/25144788
tags question: http://stackoverflow.com/q/25123940
tags question: http://stackoverflow.com/q/25084659
tags question: http://stackoverflow.com/q/25205894
tags question: http://stackoverflow.com/q/25074893
tags question: http://stackoverflow.com/q/25104989
tags question: http://stackoverflow.com/q/25112193
tags question: http://stackoverflow.com/q/25093596
tags question: http://stackoverflow.com/q/25116187
tags question: http://stackoverflow.com/q/25167207
tags question: http://stackoverflow.com/q/25209788
tags question: http://stackoverflow.com/q/25113820
tags question: http://stackoverflow.com/q/25220864
tags question: http://stackoverflow.com/q/25193648
tags question: http://stackoverflow.com/q/25145208
tags question: http://stackoverflow.com/q/25079323
tags question: http://stackoverflow.com/q/25159552
type: Tag
tags question: http://stackoverflow.com/q/25117544
tags question: http://stackoverflow.com/q/25087878
tags question: http://stackoverflow.com/q/25108069
tags question: http://stackoverflow.com/q/25165849
tags question: http://stackoverflow.com/q/25099279
tags question: http://stackoverflow.com/q/25212020
tags question: http://stackoverflow.com/q/25127203
tags question: http://stackoverflow.com/q/25215386
tag name: arraylist
tags question: http://stackoverflow.com/q/25157880
tags question: http://stackoverflow.com/q/25155932
tags question: http://stackoverflow.com/q/25218042
tags question: http://stackoverflow.com/q/25126033
tags question: http://stackoverflow.com/q/25210671

http://stackoverflow.com/comment/39160017
has text: have you installed python on your machine? In tutorial it is mentioned to install python
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25153715

rest
tags question: http://stackoverflow.com/q/25113978
tags question: http://stackoverflow.com/q/25139019
tags question: http://stackoverflow.com/q/25194535
tags question: http://stackoverflow.com/q/25104045
tags question: http://stackoverflow.com/q/25120337
tags question: http://stackoverflow.com/q/25132171
tags question: http://stackoverflow.com/q/25202137
tags question: http://stackoverflow.com/q/25078828
tags question: http://stackoverflow.com/q/25070491
tags question: http://stackoverflow.com/q/25119902
tags question: http://stackoverflow.com/q/25165704
tags question: http://stackoverflow.com/q/25091547
tags question: http://stackoverflow.com/q/25159472
tags question: http://stackoverflow.com/q/25122464
tags question: http://stackoverflow.com/q/25176061
tags question: http://stackoverflow.com/q/25229880
tags question: http://stackoverflow.com/q/25127339
tags question: http://stackoverflow.com/q/25132642
tags question: http://stackoverflow.com/q/25204725
tags question: http://stackoverflow.com/q/25157082
tags question: http://stackoverflow.com/q/25201986
tags question: http://stackoverflow.com/q/25214921
tags question: http://stackoverflow.com/q/25147030
tags question: http://stackoverflow.com/q/25126043
tags question: http://stackoverflow.com/q/25163678
tags question: http://stackoverflow.com/q/25202211
tags question: http://stackoverflow.com/q/25192648
tags question: http://stackoverflow.com/q/25164116
tags question: http://stackoverflow.com/q/25141487
tags question: http://stackoverflow.com/q/25169067
tags question: http://stackoverflow.com/q/25145216
tags question: http://stackoverflow.com/q/25197433
tags question: http://stackoverflow.com/q/25126787
tags question: http://stackoverflow.com/q/25214496
tags question: http://stackoverflow.com/q/25138374
tags question: http://stackoverflow.com/q/25083045
tags question: http://stackoverflow.com/q/25228713
tags question: http://stackoverflow.com/q/25170278
tags question: http://stackoverflow.com/q/25138354
tags question: http://stackoverflow.com/q/25084983
tags question: http://stackoverflow.com/q/25154214
tags question: http://stackoverflow.com/q/25174345
type: Tag
tags question: http://stackoverflow.com/q/25150370
tags question: http://stackoverflow.com/q/25090181
tags question: http://stackoverflow.com/q/25202134
tags question: http://stackoverflow.com/q/25180937
tags question: http://stackoverflow.com/q/25179159
tags question: http://stackoverflow.com/q/25201306
tags question: http://stackoverflow.com/q/25120513
tag name: rest
tags question: http://stackoverflow.com/q/25165777
tags question: http://stackoverflow.com/q/25097995
tags question: http://stackoverflow.com/q/25168078
tags question: http://stackoverflow.com/q/25092326

http://stackoverflow.com/comment/39086601
has text: yes, a slowdown factor of 10X tops. What if the execution counts are not stable after 10 executions? :) (Let me run the experiments first to reach a better number).
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25114512
score: 0

http://stackoverflow.com/a/25149671
upvote count: 35
type: Answer
has comment: http://stackoverflow.com/comment/60168211
has comment: http://stackoverflow.com/comment/39158562
has comment: http://stackoverflow.com/comment/60183770
has comment: http://stackoverflow.com/comment/39151440
has body: When starting from a SOAPMessage, the easiest way is to use the writeTo method : ByteArrayOutputStream stream = new ByteArrayOutputStream(); soapMessage.writeTo(stream); String message = new String(stream.toByteArray(), "utf-8") (Above, I assume your SAAJ implementation will use UTF-8, you'd probably want to check). If starting from a SOAPBody, then you probably should use XML APIs, seeing SOAPBody is a org.w3.dom.Element, the easiest way would probably be using TrAX : SOAPBody element = ... // Whatever DOMSource source = new DOMSource(element); StringWriter stringResult = new StringWriter(); TransformerFactory.newInstance().newTransformer().transform(source, new StreamResult(stringResult)); String message = stringResult.toString(); (Sorry I do not have my IDE right here, can not check if this compiles, but that should be pretty close). Please note : A serialized SOAPMessage may not be raw XML : it might be a MIME structure : if the SOAPMessage actually uses SwA (SOAP With Attachment) or MTOM. However, SOAPBody is definitely pure XML.
downvote count: 0
has comment: http://stackoverflow.com/comment/39152364
score: 35
answers question: http://stackoverflow.com/q/25149528

http://stackoverflow.com/comment/39140609
has text: you are using activity or fragment?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25142522

http://stackoverflow.com/comment/39043729
score: 0
type: Comment
has text: Alright lets back up a step. You are saying that each object, no matter what it is, can be tested against another object for equality right? I am not disagreeing with that. Now how do you propose I test the objects in my Tree List with the object I am looking up?
comment on: http://stackoverflow.com/a/25091901
type: AnswerComment

http://stackoverflow.com/q/25169291
has title: How to make a Thread that loads images?
tagged with: eclipse
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/39187442
has comment: http://stackoverflow.com/comment/39187568
score: 0
has comment: http://stackoverflow.com/comment/39189268
has comment: http://stackoverflow.com/comment/39187713
has body: I'am really new to programming and java and I'am developing a wallpaper app for android using eclipse and I can't add a lot of photos since the main thread can't handle all these stuff so I tired to make a new Thread so I can put photos but I can't I don't know what I should write in the run method. so if you can tell me what I should write and what to change and with an example if possible that would be great, Thanks. P.S: please don't suggest using AsyncTask because I don't know how to use it. and here is my code: public class SET2 extends Activity implements OnClickListener { ImageView display; int toPhone2; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.set2); toPhone2 = R.drawable.iv1; display = (ImageView) findViewById(R.id.ImageV1); ImageView image1 = (ImageView) findViewById(R.id.IView1); ImageView image2 = (ImageView) findViewById(R.id.IView2); ImageView image3 = (ImageView) findViewById(R.id.IView3); ImageView image4 = (ImageView) findViewById(R.id.IView4); ImageView image5 = (ImageView) findViewById(R.id.IView5); ImageView image6 = (ImageView) findViewById(R.id.IView6); Button setwall = (Button) findViewById(R.id.button5); image1.setOnClickListener(this); image2.setOnClickListener(this); image3.setOnClickListener(this); image4.setOnClickListener(this); image5.setOnClickListener(this); image6.setOnClickListener(this); setwall.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()){ case R.id.IView1: display.setImageResource(R.drawable.iv1); toPhone2 = R.drawable.iv1; break; case R.id.IView2: display.setImageResource(R.drawable.iv2); toPhone2 = R.drawable.iv2; break; case R.id.IView3: display.setImageResource(R.drawable.iv3); toP…
has comment: http://stackoverflow.com/comment/39188919
type: UnansweredQuestion
tagged with: multithreading
tagged with: android
has answer: http://stackoverflow.com/a/25169586
tagged with: java

http://stackoverflow.com/q/25177200
has body: Please help me to utilize the new Java 8 features. I have three arrays: String[] firstnames = {"Aaa", "Bbb", "Ccc"}; String[] lastnames = {"Zzz", "Yyy", "Xxx"}; String[] mailaddresses = {"aaa@zzz.com", "bbb@yyy.com", "ccc@xxx.com"}; And want to use the new stream API to format the values into following string: "firstname: %s\nlastname: %s\nmailaddress: %s\n"
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39201915
linked to: http://stackoverflow.com/q/24059837
has answer: http://stackoverflow.com/a/25177308
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25177308
type: Question
tagged with: java
has title: Java 8 stream's forEach with multiple arrays

http://stackoverflow.com/comment/39180503
type: Comment
type: QuestionComment
has text: @JoopEggen You were right on. Thanks for the answer.
score: 0
comment on: http://stackoverflow.com/q/25164601

http://stackoverflow.com/comment/39253586
comment on: http://stackoverflow.com/a/25204352
type: AnswerComment
score: 0
type: Comment
has text: Looking through the folder directory, I notice that Eclipse has kept a copy of test.html in the matching binaries folder for me anyway.

http://stackoverflow.com/a/51666111
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25129781
downvote count: 0
has body: I had something similar with Apache Camel: the following function was not working anymore String headerKey = exchange.getIn().getHeader("headerKey",String.class); because of the error-message: The type java.util.function.Supplier cannot be resolved. It is indirectly referenced from required .class files To solve the issue I change the casting and it worked afterwards: String headerKey = (String) exchange.getIn().getHeader("headerKey"); maybe it helps you or somebody else. One other point to mention here would be the Apache Camel version itself as stated on the official page linked here.
type: Answer

http://stackoverflow.com/q/25196963
has body: Can I use the Java swing API from a JSP or servlet outside of an applet context? e.g. Suppose I make a frame and I want this frame to popup when I click a button rendered by a JSP or servlet.
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/39240448
type: Question
tagged with: jsp
score: -3
has title: Can I call Java swing in JSP or servlet without using applet
has answer: http://stackoverflow.com/a/25197060
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/25197056
favorite count: 0
linked to: http://stackoverflow.com/q/241342
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39467081
has comment: http://stackoverflow.com/comment/39238646
tagged with: swing

http://stackoverflow.com/a/25129969
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25077694
has body: In version 2.4 or later. you can't combine jasper plugin because it is missing libraries from third part. It is very easy to resolve that problem. You only need copy these jars to your /lid org.apache.commons.collections.jar commons-beanutils-1.9.2.jar Sure 100% it work :-)
answers question: http://stackoverflow.com/q/25077694
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/40230887

http://stackoverflow.com/comment/39111263
has text: I use 1.7. I think that now I may try to find answer by myself in existing same questions. If I won't, I will get back there or create a new one. Thank you very much for help.
type: Comment
comment on: http://stackoverflow.com/a/25127465
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39152855
type: AnswerComment
comment on: http://stackoverflow.com/a/25150001
type: Comment
has text: Set on your style.xml file android:theme="@style/Theme.AppCompat".
score: 0

http://stackoverflow.com/a/25136545
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25136496
has body: Regex to remove the first 4 spaces would be, ^\s{4}(.*)$ Java regex would be, ^\\s{4}(.*)$ Replacement string: $1 Java code would be, String s = " XYX XYQ WQHY "; String m = s.replaceAll("^\\s{4}(.*)$", "$1"); System.out.println(m); //=&gt;XYX XYQ WQHY Like anubhava said in his comment, you could replaceFirst function. String s = " XYX XYQ WQHY "; String m = s.replaceFirst(" {4}", ""); System.out.println(m); It removes the exact four spaces at the start.
accepted answer of: http://stackoverflow.com/q/25136496
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/q/25147895
tagged with: java
has comment: http://stackoverflow.com/comment/39147943
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39147934
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/39148074
has body: So if i have a method where a string is entered and has a hyphen. like "cool*boy" if i want java to make a new string that starts out at the end of that string and prints each letter backward and continues until it reaches the asterisk and then goes forward and prints all the letters after the asterisk again so in the cool*boy example it's "yobboy" or high*school would be "loohcsschool" ... how would I do this. Thank you. to JUST get everything up to the asterisk sign (which isn't working) I put, int i; String newStr = ""; for(i=s.length()-1; i &gt;= s.charAt('*'); i--) newStr = newStr + s.charAt(i); I'm guessing you're not allowed to make that condition in the for loop. But I just don't get how you would do it. Please help thanks!
has answer: http://stackoverflow.com/a/25147948
has comment: http://stackoverflow.com/comment/39147965
has answer: http://stackoverflow.com/a/25147985
has answer: http://stackoverflow.com/a/25147930
favorite count: 0
has answer: http://stackoverflow.com/a/25148295
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39147963
answer count: 4
has title: How do I tell java to stop the loop at a certain character in a string?

http://stackoverflow.com/a/25177554
has comment: http://stackoverflow.com/comment/39202606
has comment: http://stackoverflow.com/comment/39202616
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25177372
has body: You could use the DiagnosticCollector, which will allow you to collect diagnostic information about the compilation process, you can find more details from the JavaDocs For example... File helloWorldJava = new File(...); DiagnosticCollector&lt;JavaFileObject&gt; diagnostics = new DiagnosticCollector&lt;JavaFileObject&gt;(); JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null); // This sets up the class path that the compiler will use. // I've added the .jar file that contains the DoStuff interface within in it... List&lt;String&gt; optionList = new ArrayList&lt;String&gt;(); optionList.add("-classpath"); optionList.add(System.getProperty("java.class.path")); Iterable&lt;? extends JavaFileObject&gt; compilationUnit = fileManager.getJavaFileObjectsFromFiles(Arrays.asList(helloWorldJava)); JavaCompiler.CompilationTask task = compiler.getTask( null, fileManager, diagnostics, optionList, null, compilationUnit); if (task.call()) { System.out.println("Yipe"); } else { // Opps compile failed... for (Diagnostic&lt;? extends JavaFileObject&gt; diagnostic : diagnostics.getDiagnostics()) { System.out.format("Error on line %d in %s%n", diagnostic.getLineNumber(), diagnostic.getSource().toUri()); } } fileManager.close(); Once compiled, you have two choices, you can either use a custom class loader to load the class and execute it, which will use your current stdout... // Create a new custom class loader, pointing to the directory that contains the compiled // classes, this should point to the top of the package structure! URLClassLoader classLoader = new URLClassLoader(new URL[]{new File("./").toURI().toURL()}); // Load the class from the classloader by name.... Class&lt;?&gt; loadedClass = classLoader.loadClass("testcompile.HelloWorld"); // Create a new instance... Object obj = loadedClass.newInstance(); // Santity check if (obj instanceof DoStuff) { // Cast to the DoStuff int…
answers question: http://stackoverflow.com/q/25177372
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/39090302
type: Comment
has text: There is no way to tell when the `Combo` drop-down is clicked.
type: QuestionComment
comment on: http://stackoverflow.com/q/25116232
score: 1

http://stackoverflow.com/comment/40025581
type: QuestionComment
comment on: http://stackoverflow.com/q/25120334
score: 0
has text: You need to post either the whole stack trace, or at least point to the line in your own code that it refers to. This stack overflow often happens when you have an object which contains another object that points back to the original object. In your code, you only use simple types (longs and strings) - is this really the full code of the class you're trying to persist?
type: Comment

http://stackoverflow.com/comment/39081856
comment on: http://stackoverflow.com/q/25112623
has text: What difference is there between such paths? Why do you need the `/`?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25222060
answers question: http://stackoverflow.com/q/25221948
score: 0
type: Answer
has body: You can run your method from multiple thread concurrently if you use database connection pooler. Concurrency can't be achieved within your function: only one thread can make query. And you can't access result set from multiple places as it's iterator.

http://stackoverflow.com/a/25084935
type: Answer
has body: Probably you will have to iterate the array one object at a time and right some logic to get object. get {"dog":1,"cat":2},create temp variable get "dog":1 add 1 to temp get "cat":2 add 2 to temp put temp in list. I dont see any api to do this
answers question: http://stackoverflow.com/q/25084710
score: 0

http://stackoverflow.com/q/25132499
tagged with: generics
answer count: 4
upvote count: 2
has title: Java generics casting
has body: How please works following generic casting? private &lt;T, N&gt; N send(final T request) { final String serviceUrl = "someUri" try { return (N) webServiceTemplate.marshalSendAndReceive(serviceUrl, request); } catch (final SoapFaultClientException e) { } } When I call this private method like this: MyReq request = new MyReq(); MyResp response = send(req); How this method casting this object into MyResp object? What mean this in return type: &lt; T, N>
has comment: http://stackoverflow.com/comment/39118965
has answer: http://stackoverflow.com/a/25132546
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25132556
has comment: http://stackoverflow.com/comment/39118855
possible better answer: http://stackoverflow.com/a/25132546
type: Question
has answer: http://stackoverflow.com/a/25132902
score: 2
has answer: http://stackoverflow.com/a/25132566
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/39118963
accepted answer: http://stackoverflow.com/a/25132556
has comment: http://stackoverflow.com/comment/39118960

http://stackoverflow.com/q/25152721
has body: I am pretty new to this language. I have an object and I want to pass it by value to another method: // Drawings class Drawings { // Has some variables Drawings() { } // Hass some methods } class History { ArrayList&lt;Drawings&gt; prevDrawings; History() { this.prevDrawings = new ArrayList&lt;Drawings&gt;(); } void add(Drawings newDrawing) {} } Now, say I have a Drawings myDrawing and History myHistory, and I want to pass myDrawing by value to myHistory. The following way passes it by reference: myHistory.add(myDrawing); How can I then pass this by value?
type: Question
accepted answer: http://stackoverflow.com/a/25161235
answer count: 1
has comment: http://stackoverflow.com/comment/39161926
score: 0
has title: Processing.org - Pass object by value
has comment: http://stackoverflow.com/comment/39157543
has comment: http://stackoverflow.com/comment/39156792
linked to: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/25161235
tagged with: processing
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/39023995
type: Comment
type: QuestionComment
has text: I'd be more inclined to change the way the way you write your data to an excel file. 400 000 records aren't that many. Have you taken a look at SXSSF?
comment on: http://stackoverflow.com/q/25081710
score: 0

http://stackoverflow.com/comment/39175392
comment on: http://stackoverflow.com/q/25162967
score: 1
has text: You haven't looked hard enough
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25112520
downvote count: 0
answers question: http://stackoverflow.com/q/25108304
type: Answer
score: 2
has body: The issue you are facing in GridPane is because of the columnContraints. Remove the columnContraints from your fxml and your buttons are placed next to each other Approach 2 If you flexible with using any layout for the , I would recommend replacing the GridPane with a HBox. As GridPanes should have column constraints !
upvote count: 2

http://stackoverflow.com/q/25097065
has comment: http://stackoverflow.com/comment/39053037
score: 0
has comment: http://stackoverflow.com/comment/39054256
has comment: http://stackoverflow.com/comment/39053178
linked to: http://stackoverflow.com/q/5215459
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39053215
has comment: http://stackoverflow.com/comment/51533992
has comment: http://stackoverflow.com/comment/39053306
answer count: 0
tagged with: java
has title: How can i change the volume of an mp3 in android?
tagged with: http://stackoverflow.com/tag/mp3
type: Question
has comment: http://stackoverflow.com/comment/39053157
has comment: http://stackoverflow.com/comment/39054103
has body: There are tools to increase the volume of mp3's. Is this possible to do in java on android devices? I could not find much information about this on the web. If it is not possible to write it in java directly, would it be possible to create a C program on the system level that does the mp3 processing and can be called from an android application?

http://stackoverflow.com/q/25145494
has body: I'm working on a particle system. It does a lot a LOT of calculations / calls on openGL Draw. So far I divided up the calculations so on every screen refresh it does a different part of the calculation it helps a lot but it is not enought. I have 2 other ideas to improve the preformance: 1, Native code I know it should help but I have no idea how much and if it would worth the effort. Setting up and learning something new takes a lot of time. 2, Create threads to calculate different parts. Synchronizing could be a problem but at this point the only thing I care about is speed. The problem again I have no idea if it would help or not My question is which method would be better or is there a better way that I didn't think about?
has comment: http://stackoverflow.com/comment/39145033
type: Question
has comment: http://stackoverflow.com/comment/39158112
has comment: http://stackoverflow.com/comment/39145210
has comment: http://stackoverflow.com/comment/39145641
has comment: http://stackoverflow.com/comment/39144844
score: 0
has comment: http://stackoverflow.com/comment/39143213
has comment: http://stackoverflow.com/comment/39513354
has comment: http://stackoverflow.com/comment/39144674
has comment: http://stackoverflow.com/comment/39144772
answer count: 0
type: UnansweredQuestion
tagged with: opengl-es-2.0
has comment: http://stackoverflow.com/comment/39144314
tagged with: android
has comment: http://stackoverflow.com/comment/39144645
has comment: http://stackoverflow.com/comment/39144184
has title: Optimalizing large amount of operations on Android
has comment: http://stackoverflow.com/comment/39143199
tagged with: performance
tagged with: java

http://stackoverflow.com/comment/39006170
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25072030
has text: This C/C++ is already done by other. He told me to convert to Android. =(

http://stackoverflow.com/a/25176891
answers question: http://stackoverflow.com/q/25176827
upvote count: 1
has body: Use the Apache POI library: http://poi.apache.org/ You can edit XLS AND XLSX documents
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/25152635
tagged with: design-patterns
linked to: http://stackoverflow.com/q/2698086
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/39157880
has comment: http://stackoverflow.com/comment/39157575
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39156320
has body: I have a doubt. Map.putAll(Map) method is implemented using composite pattern, I want to know , is it correct ? Because PutAll() method is present in all the decedents of Map irrespective of leaf or non leaf. My doubt is, in composite class add(Composite) will be present in non leaf classes, but in Map it is present at the interface level, that means even the leaf class have a aggregation link to the component , this contradicts the class diagram of composite design pattern as it shows the aggregation link from composite to component , not from leaf to component. Kindly help Thanks Praveen B
has answer: http://stackoverflow.com/a/25154694
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39156365
score: 0
tagged with: java
has title: composite design in Map.putAll(Map) method
upvote count: 1

http://stackoverflow.com/comment/39236901
comment on: http://stackoverflow.com/q/25195988
has text: Your listview is populated with data or not?
score: 0
type: Comment
type: QuestionComment

subclipse
type: Tag
tags question: http://stackoverflow.com/q/25112078
tag name: subclipse

http://stackoverflow.com/a/25101906
has comment: http://stackoverflow.com/comment/39062006
type: Answer
has comment: http://stackoverflow.com/comment/39061861
has comment: http://stackoverflow.com/comment/39062291
upvote count: 2
has comment: http://stackoverflow.com/comment/39061966
has comment: http://stackoverflow.com/comment/39062152
answers question: http://stackoverflow.com/q/25101871
downvote count: 1
has body: you can use Set to avoid having duplicate Code: Set&lt;Integer&gt; set1 = new LinkedHashSet&lt;&gt;(); int ctr = 13; int randomNum = 0; while (ctr == 13) { Random r = new Random(); randomNum = r.nextInt(13); set1.add(randomNum); System.out.print(randomNum + " "); if (set1.size() &gt;= 13) { ctr = 12; } } System.out.println(""); set1.forEach(i -&gt; System.out.print(" " + i)); output: 4 11 11 11 5 1 9 12 5 7 5 2 9 10 1 7 10 3 11 8 9 3 12 9 2 6 7 10 12 3 11 1 10 3 6 2 0 4 11 5 1 9 12 7 2 10 3 8 6 0
has comment: http://stackoverflow.com/comment/39061990
has comment: http://stackoverflow.com/comment/39062224
has comment: http://stackoverflow.com/comment/39062078
score: 1
has comment: http://stackoverflow.com/comment/39062091
has comment: http://stackoverflow.com/comment/39062341
has comment: http://stackoverflow.com/comment/39061934
has comment: http://stackoverflow.com/comment/39061895

javascript
tags question: http://stackoverflow.com/q/25103915
tags question: http://stackoverflow.com/q/25158897
tags question: http://stackoverflow.com/q/25213150
tags question: http://stackoverflow.com/q/25077282
tags question: http://stackoverflow.com/q/25122660
tags question: http://stackoverflow.com/q/25228571
tags question: http://stackoverflow.com/q/25142862
tags question: http://stackoverflow.com/q/25174843
tags question: http://stackoverflow.com/q/25107554
tags question: http://stackoverflow.com/q/25178372
tag name: javascript
tags question: http://stackoverflow.com/q/25103426
tags question: http://stackoverflow.com/q/25207519
tags question: http://stackoverflow.com/q/25205580
tags question: http://stackoverflow.com/q/25072453
tags question: http://stackoverflow.com/q/25214528
tags question: http://stackoverflow.com/q/25081360
tags question: http://stackoverflow.com/q/25163401
tags question: http://stackoverflow.com/q/25104400
tags question: http://stackoverflow.com/q/25194496
tags question: http://stackoverflow.com/q/25224288
tags question: http://stackoverflow.com/q/25173449
tags question: http://stackoverflow.com/q/25183997
tags question: http://stackoverflow.com/q/25134168
tags question: http://stackoverflow.com/q/25131719
tags question: http://stackoverflow.com/q/25190791
type: Tag
tags question: http://stackoverflow.com/q/25200352
tags question: http://stackoverflow.com/q/25188677
tags question: http://stackoverflow.com/q/25131455
tags question: http://stackoverflow.com/q/25075503
tags question: http://stackoverflow.com/q/25146811
tags question: http://stackoverflow.com/q/25102319
tags question: http://stackoverflow.com/q/25201699
tags question: http://stackoverflow.com/q/25188452
tags question: http://stackoverflow.com/q/25136439
tags question: http://stackoverflow.com/q/25098705
tags question: http://stackoverflow.com/q/25107530
tags question: http://stackoverflow.com/q/25073707
tags question: http://stackoverflow.com/q/25148584
tags question: http://stackoverflow.com/q/25073019
tags question: http://stackoverflow.com/q/25166287
tags question: http://stackoverflow.com/q/25205171
tags question: http://stackoverflow.com/q/25183443
tags question: http://stackoverflow.com/q/25156983
tags question: http://stackoverflow.com/q/25117383
tags question: http://stackoverflow.com/q/25179806
tags question: http://stackoverflow.com/q/25100777
tags question: http://stackoverflow.com/q/25126624
tags question: http://stackoverflow.com/q/25123697
tags question: http://stackoverflow.com/q/25074351
tags question: http://stackoverflow.com/q/25212405
tags question: http://stackoverflow.com/q/25157082
tags question: http://stackoverflow.com/q/25204160
tags question: http://stackoverflow.com/q/25131802
tags question: http://stackoverflow.com/q/25092348
tags question: http://stackoverflow.com/q/25119308
tags question: http://stackoverflow.com/q/25210181
tags question: http://stackoverflow.com/q/25163678
tags question: http://stackoverflow.com/q/25179548
tags question: http://stackoverflow.com/q/25159711

http://stackoverflow.com/comment/39217349
has text: It does have an equals and a hashCode - the ones of `Object`.
comment on: http://stackoverflow.com/q/25185679
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/25089908
type: Question
has answer: http://stackoverflow.com/a/25089969
has answer: http://stackoverflow.com/a/25089983
tagged with: class
has answer: http://stackoverflow.com/a/25090020
has title: Questions about Java constructor, for class and its super class
score: 0
answer count: 4
tagged with: constructor
has comment: http://stackoverflow.com/comment/39039945
tagged with: super
accepted answer: http://stackoverflow.com/a/25089983
linked to: http://stackoverflow.com/q/2419410
has body: I'm trying to figure out how the constructors work in the following program. Basically there is a Seeker class that extends Player class, and a Game class that contains Seeker object, as shown in the code below. My question is, when the Game class instantiates mySeeker using mySeeker = new Seeker( "Sally", this ); does this invoke the player's constructor? If so, where did it pass on the name of the game? I saw a Game g in the constructor for Player, but I can't figure out how the game myGame (in the main method) has been passed to the Seeker. //Game class class Game { Seeker mySeeker; int gridSize; Game( int gs ) { gridSize = gs; mySeeker = new Seeker( "Sally", this ); //what does 'this' do here? why it does not include the name of the game? } void play() { mySeeker.seek(); } } //Player class abstract class Player { private Point location; private String name; Game game; Player( Point p, String n, Game g ) { location = p; name = n; game = g; } //Seeker class class Seeker extends Player { Seeker( String n, Game g ) { super( new Point( 0, 0 ), n, g ); // seeker starts at 0,0 } //Main Program public static void main(String[] args) { int gridSize = 3; // default value Game myGame = new Game( gridSize ); myGame.play(); }
tagged with: parameters
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25090052
tagged with: java
possible better answer: http://stackoverflow.com/a/25089969

http://stackoverflow.com/q/25113900
accepted answer: http://stackoverflow.com/a/25114274
downvote count: 0
has body: Is it possible to store a million of records(xml files) into Basex database? for(int j=1;j&lt;1000000;j++) { String id=String.valueOf(j); String[] elems={"firstname","lastname","nickname","salary","permanentAddress","currentAddress","contactNo","email","alternateMail","FacebookName","Color"}; String[] childs = {id,"yong"+id,"mook kim"+id,"mkyong"+id,"100000"+id,"Bhopal"+id,"pune"+id,"999999999"+id ,"test"+id+"@basex.com","testA"+id+"@basex.com","Tom"+id,"grey"+id}; try { xmlFile= x.CreateXMLDoc("test","transperfect",elems,childs); } catch (TransformerConfigurationException exception) { exception.printStackTrace(); } storeIntoBaseXDB(j,id,xmlFile); } //StoreIntoBaseXDB method public static void storeIntoBaseXDB(int i,String id,String xmlFile) throws BaseXException { if(i==1) { System.out.println("=========================Store into Database========================="); //System.out.println("Check database existence"); con.getDatabaseConnection(dbNmae); con.executeInsertQuery(dbNmae,id,xmlFile); } else { con.executeInsertQuery(dbNmae,id,xmlFile); } } //executeInsertQuery() method public long executeInsertQuery(String dbname,String id,String xmlFile) throws BaseXException { //System.out.println(path); new Open(dbname).execute(context); try { /* String query = "db:add('db','C:/Users/manish/Desktop/BaseX65/xml/books.xml')"; QueryProcessor proc = new QueryProcessor(query, context); proc.execute(); proc.close(); context.close();*/ new Add(id,xmlFile).execute(context); //System.out.println(new Find(id)); } catch (Exception e) { System.out.println("ERROR executing query: "); e.printStackTrace(); } }
has title: inserting millions of xml files into basex
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/25114274
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/25114547
has answer: http://stackoverflow.com/a/25114547
upvote count: 3
tagged with: java
tagged with: basex
type: Question
answer count: 2

http://stackoverflow.com/q/25079753
answer count: 0
upvote count: 3
type: UnansweredQuestion
type: Question
score: 3
tagged with: amazon-s3
tagged with: java
has title: Amazon s3 Upload Progress calculation in android for Transfer Manager
has body: I am using high level api for amazon s3 upload and getting a call back for progress but the method upload.getprogress().getPercentageTransferred() at times gives percentage above 100..Why does it shows above 100? Are there any changes needed BasicAWSCredentials lAwsCredentials = new BasicAWSCredentials( Constants.ACCESS_KEY_ID, Constants.SECRET_KEY); AmazonS3Client s3Client = new AmazonS3Client(lAwsCredentials); TransferManager tm = new TransferManager(s3Client); File lFile = new File(mFilePath); PutObjectRequest putRequest = new PutObjectRequest(mBucketName, mKeyName, lFile); mUpload = tm.upload(putRequest, new S3ProgressListener() { ExecutorService lExecutor = Executors.newFixedThreadPool(1); @Override public void progressChanged(ProgressEvent arg0) { // Log.v(TAG, "Transfer: " + mUpload.getDescription()); // Log.v(TAG, " - Percentage: " // + mUpload.getProgress().getPercentTransferred()); double lProgress = mUpload.getProgress() .getPercentTransferred(); int lProgressInteger = (int) lProgress; if (lProgressInteger % 10 == 0) { Log.d(TAG, "File id:" + mLocalFileId + "==== Transfer: " + mUpload.getDescription() + "====Percentage: " + mUpload.getProgress().getPercentTransferred()); publishProgress(lProgressInteger); } } @Override public void onPersistableTransfer( final PersistableTransfer persistableTransfer) { lExecutor.submit(new Runnable() { @Override public void run() { File f = new File(Environment .getExternalStorageDirectory() + "/resumeupload"); if (!f.exists()) try { f.createNewFile(); FileOutputStream fos; fos = new FileOutputStream(f); persistableTransfer.serialize(fos); fos.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); } });
downvote count: 0
tagged with: amazon-web-services
favorite count: 0
tagged with: android

http://stackoverflow.com/a/25136126
score: 1
answers question: http://stackoverflow.com/q/25135395
upvote count: 1
has body: I suppose you want to test the behaviour of the method i.e. if items actually contains the new item, not if the data is written to the database. I'd use dependency injection and a mock object. Using something like DatabseHelper.getInstance() is definitely convenient, but hard to test. I'd change the to test to public class ClassToTest { private DatabaseHelper databaseHelper; public void setDatabaseHelper(DatabaseHelper databaseHelper) { this.databaseHelper = databaseHelper; } public void addItem(Item item) { items.add(0, item); databaseHelper.writeOneItem(item); } } Next, I'd introduce an interface IDatabaseHelper with the method void writeOneItem(Item item) and let DatabaseHelper implement this interface. Additionally, I'd create a MockDatabaseHelper that also implements the interface. In your regular code you'd then use ClassToTest myClass = new ClassToTest(); myClass.setDatabaseHelper(DatabaseHelper.getInstance()); and in your Test you'd use ClassToTest myClass = new ClassToTest(); myClass.setDatabaseHelper(new MockDatabaseHelper()); The implementation in the MockDatabaseHelper could empty or be a simple log statement. If your class uses other methods from DatabaseHelper, you need to add these the interface as well and add an implementation to MockDatabaseHelper that mimicks the behaviour of the real DatabaseHelper. As others already have mentioned, there are mock frameworks that save you some of the work with writing MockObjects. Additionally, I'd recommend to check out Dependency Injection in general.
type: Answer
downvote count: 0

http://stackoverflow.com/q/25101575
has answer: http://stackoverflow.com/a/25101703
accepted answer: http://stackoverflow.com/a/25101786
has answer: http://stackoverflow.com/a/30616272
favorite count: 0
has body: i have this piece of code. I wanted to return to the beginning of loop and ask for user input again. However, it always loops without stopping to ask for input. What is wrong with my code? thanks while(true){ ... try { int choice = input.nextInt(); &lt;&lt;---=- this should stop and ask for input, but it always loops without stopping. } catch (InputMismatchException e){ &lt;&lt; I want to return to the beginning of loop here &gt;&gt; } }
has answer: http://stackoverflow.com/a/25101634
possible better answer: http://stackoverflow.com/a/25101615
has comment: http://stackoverflow.com/comment/39061324
has answer: http://stackoverflow.com/a/25101615
has comment: http://stackoverflow.com/comment/39061344
type: AnsweredQuestion
score: 3
has title: Continue a while loop after exception
tagged with: java
downvote count: 1
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/25101637
answer count: 6
has answer: http://stackoverflow.com/a/25101786
has comment: http://stackoverflow.com/comment/39061349

http://stackoverflow.com/q/25127757
tagged with: lotus-notes
has title: URL.openStream throws java.lang.NullPointerException
has body: URL url= new URL(url); url.openStream(); I catch an exception: java.lang.NullPointerException at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:727) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:654) at COM.ibm.JEmpower.applet.http.HttpURLConnection.getInputStream(HttpURLConnection.java:411) at java.net.URL.openStream(URL.java:1022) at ImageOptimizer.saveURL(Unknown Source) I run java code on laptop via IBM Notes. Is it something related to security so I can't open stream with another server?
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/39110908
accepted answer: http://stackoverflow.com/a/25135422
tagged with: java
has comment: http://stackoverflow.com/comment/39110998
has comment: http://stackoverflow.com/comment/39110716
has comment: http://stackoverflow.com/comment/39111044
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39111021
downvote count: 0
has answer: http://stackoverflow.com/a/34824308
favorite count: 0
has comment: http://stackoverflow.com/comment/39111619
has comment: http://stackoverflow.com/comment/39110538
has answer: http://stackoverflow.com/a/25135422
type: Question
has comment: http://stackoverflow.com/comment/39110955
possible better answer: http://stackoverflow.com/a/34824308
score: 3

http://stackoverflow.com/q/25149429
tagged with: java
type: Question
has body: not sure how to troubleshoot this since when I set a breakpoint in my thread it executes as expected. However if I let i execute normally without any breakpoints, i ALWAYS get the following: java.net.BindException: bind failed: EADDRINUSE (Address already in use) It's a pair of UDP threads. One thread listens on a socket, the 2nd thread closes the socket used by the Listen thread, sends the packet and closes the socket. Listen Thread should try(and fail) to use the socket until it succeeds. There are no other threads accessing that socket and only 1 instance of each running. public class Send implements Runnable{ private MsgObj mo; private int i = 0; public void run(){ while ( i == 0) {//I know this probably isn't the best way to do this, but don't know how else to do it. Any suggestions welcome :) if (!main.SendQueue.isEmpty()) { mo = main.SendQueue.remove(0); try { listenRepeat = false; String textString = Helper.msgCompiler(mo); int msg_len = textString.length(); byte[] message = textString.getBytes(); DatagramPacket dPacket = new DatagramPacket(message, msg_len, mo.getIP(), mo.getPort()); if (!dSocket.isClosed()){ dSocket.close();} dSocket = new DatagramSocket(3222); dSocket.send(dPacket); dSocket.close(); } catch (Exception e) { e.getMessage(); e.printStackTrace(); } } else { try {TimeUnit.SECONDS.sleep(1);} catch (Exception e) {} } } } } public class Listen implements Runnable{ MsgObj mo; public void run(){ listenRepeat = true; while (listenRepeat == true) { try { byte[] message = new byte[1500]; dSocket = new DatagramSocket(3222); DatagramPacket dPacket = new DatagramPacket(message, message.length); while (!dSocket.isClosed()){ dSocket.receive(dPacket); String text = new String(message, 0, dPacket.getLength()); //do stuff } listenRepeat = true; } catch (Exception e) { e.getMessage(); e.printStackTrace(); listenRepeat = true; } } } } I'm very new and welcome any suggestions on how to accomplish my task better/cleaner. I'm sure there are many best practices I'm…
has comment: http://stackoverflow.com/comment/39150908
score: 0
type: UnansweredQuestion
tagged with: sockets
has title: Bind failed when running but not when debugging?
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39151418
answer count: 0

http://stackoverflow.com/comment/39042021
comment on: http://stackoverflow.com/a/25091096
has text: it would be possible to define a "chained" Action, which took a list of Actions and wen executed, executed in Action in it's list, there by allowing a single Action to be registered, but perform, multiple actions...otherwise you'd need to setup a inheritance chain
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25165128
has comment: http://stackoverflow.com/comment/39253352
tagged with: c++
tagged with: sms
answer count: 0
has comment: http://stackoverflow.com/comment/39179712
has body: I was wondering if there is a way you can send an sms from mobile to pc using any language(preferably Java) without the use of gsm modem. I guess there should be some other way or some SMS API but my research didn't return anything. I want to use it for my final project at uni. If SMS is not an option, can you think of some other way of sending info from mobile to pcwithout having any internet connection. I know it sounds crazy, but i want to know from the experts if there is any way.
type: Question
tagged with: java
score: 0
tagged with: mobile
has comment: http://stackoverflow.com/comment/39179595
has title: Sending SMS from Mobile to PC and vice versa using a programming language without GSM Modem
has comment: http://stackoverflow.com/comment/39179873
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39223666

http://stackoverflow.com/a/30417892
upvote count: 1
has body: Ideally, this sounds like a job for SQL Loader rather than Java. If you do decide to do this job in java, consider using executebatch. An example is here.
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25095868

http://stackoverflow.com/comment/39205450
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25179316
type: AnswerComment
has text: I use 'mvn package' to build my project.My 'pom.xml' has the druid dependcy.

http://stackoverflow.com/comment/39073374
score: 1
has text: This looks like it is a highly specialized question that deals with interfacing with the Minecraft Bukkit plugin. Such questions I think are better suited for the Bukkit forums as opposed to here. Only thing I can suggest is to debug it in your development environment by setting up mock data and passing a command through to see where it errors. From the looks of it, you are not accounting for a case in which an exception is thrown, such as the player object not being extracted correctly.
comment on: http://stackoverflow.com/q/25108040
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25175430
has title: Issue while deploying Spring MVC application | no matching editors or conversion strategy found
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39202947
accepted answer: http://stackoverflow.com/a/25200524
has comment: http://stackoverflow.com/comment/39201806
has body: I am facing a deployment issue while trying to deploy my application in oracle weblogic 12c server. While deploying, I get below error: java.lang.Exception: Exception received from deployment driver. See Error Log view for more detail. at oracle.eclipse.tools.weblogic.server.internal.DeploymentProgressListener.watch(DeploymentProgressListener.java:190) at oracle.eclipse.tools.weblogic.server.internal.WlsJ2EEDeploymentHelper.deploy(WlsJ2EEDeploymentHelper.java:510) at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishWeblogicModules(WeblogicServerBehaviour.java:1501) at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishToServer(WeblogicServerBehaviour.java:920) at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishOnce(WeblogicServerBehaviour.java:708) at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publish(WeblogicServerBehaviour.java:555) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774) at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3108) at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53) Caused by: weblogic.application.ModuleException: java.lang.IllegalStateException: Cannot convert value of type [$Proxy214 implementing org.springframework.web.accept.ContentNegotiationStrategy,org.springframework.web.accept.MediaTypeFileExtensionResolver,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.springframework.web.accept.ContentNegotiationManager] for property 'contentNegotiationManager': no matching editors or conversion strategy found at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140) at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124) at weblogic.application.int…
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25200524
tagged with: spring

http://stackoverflow.com/q/25185258
linked to: http://stackoverflow.com/q/5752910
has answer: http://stackoverflow.com/a/25185618
has body: (Note: I came across this somewhat accidentally, so it may not be practical, but I am just very curious) I wanted to print out a value, which was the sum of two values, after incrementing the second. Something like so: int first = 10; int second = 20; System.out.println(first + ++second); //31 System.out.println(first); //10 System.out.println(second); //21 Maybe not the neatest code, but it worked. But then, I started experimenting. System.out.println(first +++ second); //30 System.out.println(first); //11 System.out.println(second); //21 That's fine; it means that the first was incremented after being added, and that whitespace can be ignored here. Cool. But then... System.out.println(first +++++ second); //"Invalid Argument", doesn't work While System.out.println(first ++ + ++ second); //31 System.out.println(first); //11 System.out.println(second); //21 Works fine, but for some reason, is still different than System.out.println(first + + + ++ second); //31 System.out.println(first); //10 System.out.println(second); //21 And maybe the strangest of all, System.out.println(first + + + + + + second); //30 System.out.println(first); //10 System.out.println(second); //20 So what's going on here? When is whitespace between operators ignored, and when is it not? Why can I write "+ + + + +", without any issues? Thanks!
has comment: http://stackoverflow.com/comment/39216455
has comment: http://stackoverflow.com/comment/39216491
answer count: 3
has answer: http://stackoverflow.com/a/25185575
favorite count: 0
tagged with: operators
has answer: http://stackoverflow.com/a/25185615
has title: Java Multiple Consecutive Operators
type: Question
accepted answer: http://stackoverflow.com/a/25185575
type: AnsweredQuestion
score: 7
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/39216472
upvote count: 10
has comment: http://stackoverflow.com/comment/39216345
possible better answer: http://stackoverflow.com/a/25185618

http://stackoverflow.com/comment/39305125
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25223451
type: QuestionComment
has text: Hm, never seen such a case. Maybe the method was inlined and obfuscated in a way the stack frames are no longer visible/reconstructable.

http://stackoverflow.com/q/25199401
has answer: http://stackoverflow.com/a/25199451
possible better answer: http://stackoverflow.com/a/25200726
has answer: http://stackoverflow.com/a/25200726
has title: How can I parse a weekday and time object to the next logical date from today?
type: AnsweredQuestion
tagged with: java
type: Question
has body: I have a date in the string that looks like MON 07:15. I'm trying to parse this to a Date using this snippet of code: System.out.println(new SimpleDateFormat("E kk:mm").parse("MON 07:15")); Using the above code, prints a date that reads: Mon Jan 05 07:15:00 EET 1970 I'd like the parse the date string to the next upcoming date. At the time of posting, my local date and time is Fri Aug 08 11:45:00 EEST 2014 and the next Monday will be on the 11th so the resultant date that I'm looking for is Mon Aug 11 07:15:00 EEST 2014. How can I parse this? The day and time object that I'll be parsing will always be in the future.
accepted answer: http://stackoverflow.com/a/25199451
score: 4
upvote count: 4
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/29722717

http://stackoverflow.com/a/25197124
type: Answer
has body: If SBT can build it, but Eclipse can't, try to regenerate Eclipse project from SBT: http://www.playframework.com/documentation/2.4.x/IDE
score: 0
answers question: http://stackoverflow.com/q/25196655

http://stackoverflow.com/q/25129508
upvote count: 1
answer count: 1
favorite count: 0
has title: How can I request an Image from a URL when the Response is 302?
has answer: http://stackoverflow.com/a/25138277
accepted answer: http://stackoverflow.com/a/25138277
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has body: I want to request an image from a url from within my Grails Service method. When I request the image from a url (in this case from Facebook) I get a 302 redirect. After that I request the new URL again. In the second response I get a 403 forbidden. Here is the Service method that I use: static queryImageUrl(url, query, MediaType contentType = urlencodedMediaType) { if(query instanceof Map) { query = map2query query } def uri = new URI("${url}?$query") def requestFactory = new SimpleClientHttpRequestFactory() def request = requestFactory.createRequest(uri, HttpMethod.GET) try { def response = request.execute() def statusCode = response.statusCode log.debug "got reply from $uri with status code $statusCode" if (statusCode == HttpStatus.FOUND) { def newUrl = response.connection.responses.getHeaders().Location[0] log.debug "302 redirect to ${newUrl}" return queryImageUrl(newUrl, "") } if (statusCode == HttpStatus.OK) { return response.body.bytes } else if(statusCode == HttpStatus.FORBIDDEN) { throw new IllegalAccessError(response.statusCode.toString()) } } catch(ex) { log.error "Exception while querying $url", ex } return null } How do I request an image from a url when the responds status is 302? Edit: Here are the logs from a image request for a Facebook user: got reply from http://graph.facebook.com/10002342342395/picture?width=200&amp;height=200 with status code 302 302 redirect to https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xap1/v/t1.0-1/p200x200/10491179_578345345924700_6665003172531587407_n.jpg?oh=d91657acaf300c3d01042eccc22cf006&amp;oe=543C6E19&amp;__gda__=1415182364_3afb5be4b59d61c4bb2994d2605d2c65 got reply from https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xap1/v/t1.0-1/p200x200/10491179_578563345345924700_666503453451587407_n.jpg?oh=d91657acaf300c3d01042eccc22cf006&amp;oe=543C6E19&amp;__gda__=1415182364_3afb5be4b59d61c4bb2994d2605d2c65? with status code 403 My recursive method is called a second time after the first response because of 302 and the se…
tagged with: grails
has comment: http://stackoverflow.com/comment/39116309
tagged with: groovy

http://stackoverflow.com/comment/39237106
type: Comment
type: QuestionComment
has text: Better try with sample to invoke Filter then go further.Because of the logs of check you have done be failed so it goes to invoke the Servlet.
comment on: http://stackoverflow.com/q/25195907
score: 0

http://stackoverflow.com/comment/39053133
has text: Don't change the size of your JFrame as doing so will make it hard to update, enhance or improve your application, and may make it not work well on other platforms. Again, please see the link to my answer with code above. Consider calling `setComponentOrientation(...)` for left justified text.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25096895

http://stackoverflow.com/a/25118045
has body: You can create NullCreature and use it for all empty grid locations. If you "preload" these into the grid, your search() method doesn't need to create them (just add them to the return list). Or preferable return a wrapper object which holds a Creature list (your current return value) and a list of empty positions. This is better imo because what you really want to do is return more information than just the list of nearby creatures.
has comment: http://stackoverflow.com/comment/39092454
type: Answer
answers question: http://stackoverflow.com/q/25117839
score: 0

http://stackoverflow.com/comment/39146157
type: AnswerComment
comment on: http://stackoverflow.com/a/25147000
has text: @Jashaszun forgot to update the `println`. Fixed now.
score: 0
type: Comment

http://stackoverflow.com/comment/39194508
type: QuestionComment
has text: after open certain port number that u said, i'll try to restart my laptop. Re-run the code again the apps npw is working finely..Thanks @Eran
comment on: http://stackoverflow.com/q/25134497
score: 0
type: Comment

http://stackoverflow.com/q/25121686
favorite count: 0
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/39099135
type: Question
has body: I tried to add override annotation and didn't work with it. public class Details extends Activity { String name = ""; String balance = ""; public class MyTask extends AsyncTask&lt;Void, Void, String&gt; { ProgressDialog progressDialog; protected void onPreExecute() { progressDialog = new ProgressDialog(Details.this); progressDialog.setMessage("Loading..."); progressDialog.setCancelable(false); progressDialog.show(); } @Override protected String doInBackground(Void... arg0) { NetWork netWork = new NetWork(); SharedPreferences settings = getSharedPreferences("details", 0); String user = settings.getString("user", ""); String pass = settings.getString("pass", ""); String s=""; try { s = netWork.getGradesHtml( "https://app.laundro-smart.com/Forms/frmMain.aspx", user, pass, "GET",0,3,0,""); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } int index = Jsoup .parse(s, "https://app.laundro-smart.com/Forms/frmMacineStateInRegion.aspx") .select("span#ctl00_ContentPlaceHolder1_lblPrePaidBalance") .toString().lastIndexOf("&lt;"); balance =Jsoup.parse(s, "https://app.laundro-smart.com/Forms/frmMacineStateInRegion.aspx") .select("span#ctl00_ContentPlaceHolder1_lblPrePaidBalance") .toString().substring(55, index); index = Jsoup .parse(s, "https://app.laundro-smart.com/Forms/frmMacineStateInRegion.aspx") .select("span#ctl00_lnkUsername").toString() .lastIndexOf("&lt;"); name= Jsoup.parse(s, "https://app.laundro-smart.com/Forms/frmMacineStateInRegion.aspx") .select("span#ctl00_lnkUsername") .toString().substring(58, index); return name; } @Override protected void onPostExecute(String aa) { TextView a = (TextView) findViewById(R.id.textView2); a.setText(aa); a =(TextView)findViewById(R.id.textView5); a.setText(balance); progressDialog.cancel(); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_details); (new MyTask()).execute(); }
has comment: http://stackoverflow.com/comment/39099097
tagged with: android
score: -2
has answer: http://stackoverflow.com/a/25123415
has title: AsyncTask onPostExecute is never called
tagged with: java
downvote count: 2
answer count: 1
accepted answer: http://stackoverflow.com/a/25123415
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/39098963

http://stackoverflow.com/q/25213935
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25214010
score: 1
has body: There are 3 entities (which matches tables): public class Enterprise{ private long id; private String name; private List&lt;Department&gt; departments; //getters()/setters() } public class Department{ private long id; private String name; private List&lt;Employee&gt; employees; //getters()/setters() } public class Employee{ private long id; private String name; private List&lt;Department&gt; departments; //getters()/setters() } ENTERPRISE---|OneToMany|---DEPARTMENT---|ManyToMany|---EMPLOYEE Can someone write method on JDBC : List&lt;Enterprise&gt; findAll(); The connection, statements, queries, etc. can be ignored. The main difficulty is to set all references on the correct objects (for example, to avoid: enterprise.getDepartments().get(1).getEmployees().get(1).getDepartments() == NULL) . EXAMPLE (The beginning of method): List&lt;Enterprise&gt; findAll(){ ResultSet rs = executeQuery(SELECT_ALL_ENTERPRISES); List&lt;Enterprise&gt; ents = createEnterprises(rs); .........
tagged with: java
upvote count: 1
type: Question
tagged with: dao
answer count: 2
has answer: http://stackoverflow.com/a/25214010
tagged with: sql
tagged with: jdbc
downvote count: 0
has title: Object formation with relationships(JDBC)
favorite count: 0
has comment: http://stackoverflow.com/comment/51976145
possible better answer: http://stackoverflow.com/a/25220504
has answer: http://stackoverflow.com/a/25220504

http://stackoverflow.com/q/25142957
linked to: http://stackoverflow.com/q/1732348
answer count: 2
has comment: http://stackoverflow.com/comment/39138449
upvote count: 0
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/39138201
accepted answer: http://stackoverflow.com/a/25143188
tagged with: regex
downvote count: 6
type: AnsweredQuestion
has body: I need extract the author from the text using regex. Also, I need have the index of every tags and authors. I tried few parser, none of them can preserve the index correctly. So the only solution is using regex. I have following regex and it has a problem on "[^]" How could I fix this regex: &lt;post\\s*author=\"([^\"]+)\"[^&gt;]+&gt;[^&lt;/post&gt;]*&lt;/post&gt; in order to extract the author in following text: &lt;post author="luckylindyslocale" datetime="2012-03-03T04:52:00" id="p7"&gt; &lt;img src="http://img.photobucket.com/albums/v303/lucky196/siggies/ls1.png"/&gt; Grams thank you, for this wonderful tag and starting this thread. I needed something to encourage me to start making some new tags. &lt;img src="http://img.photobucket.com/albums/v303/lucky196/holidays/stpatlucky.jpg"/&gt; Cruelty is one fashion statement we can all do without. ~Rue McClanahan &lt;/post&gt;
type: Question
has comment: http://stackoverflow.com/comment/39138199
has title: extract information from xml using regular expression
has comment: http://stackoverflow.com/comment/39138006
has comment: http://stackoverflow.com/comment/39138030
tagged with: java
possible better answer: http://stackoverflow.com/a/25143069
has answer: http://stackoverflow.com/a/25143069
has answer: http://stackoverflow.com/a/25143188

unicode
tags question: http://stackoverflow.com/q/25141585
tags question: http://stackoverflow.com/q/25138514
tag name: unicode
type: Tag
tags question: http://stackoverflow.com/q/25188269
tags question: http://stackoverflow.com/q/25099446
tags question: http://stackoverflow.com/q/25221596

http://stackoverflow.com/comment/39297252
type: Comment
has text: Right so here is an example: @echo off echo "I'm currently running right now, nothing can stop me" pause echo "Now I'm going to start a new process!!!" start batchfilenumber2.bat (or .txt or .doc or .whatever) Now a new file is opened and the batch file closes because it met the end of it's commands.
comment on: http://stackoverflow.com/a/25228020
score: 0
type: AnswerComment

http://stackoverflow.com/a/25613007
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25084955
upvote count: 2
has body: I'd say that using an EJB only for that reason may be a bit too heavy as you wrote. First most of modern application servers will cache that lookup so it will not be that costly. Second - you can use @Resource(name="myds") as Robert said which would use same resource reference, that can be mapped to the JNDI name using application server's mapping functions. Third - you could use CDI to have web module only solution like this: Create class which hold your DataSource definition like this: public class Datasources { @Produces @Resource(name="jdbc/yourRef", lookup="yourJNDI") DataSource myDataSource; } And then use it servlet using Inject: public class MyServlet extends HttpServlet { @Inject private DataSource myDs;

http://stackoverflow.com/a/64273270
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25204481
downvote count: 0
has body: Here is the answer of displaying digit in same order u have enter import java.util.Scanner; public class oddMethod { public static void main(String[] args) { System.out.println("Enter start number:"); int number=getNumber(); int last=Reverse1stTime(number); System.out.println("Digit You Enter:"+last); } private static int getNumber() { Scanner sr = new Scanner(System.in); return sr.nextInt(); } private static int Reverse1stTime(int number) { int digit=0; int reverse=0; while(number>0) { digit=number%10; reverse=reverse*10+digit; number=number/10; } return reverseAgain(reverse); } private static int reverseAgain(int number) { int digit=0; int reverse=0; while(number>0) { digit=number%10; System.out.println(digit); reverse=(reverse*10+digit); number=number/10; } return reverse; } } Input 12345 Output 12345
type: Answer

http://stackoverflow.com/comment/39122334
type: Comment
has text: @Girish This answer doesn't explain why, doesn't explain what is actually happening in yor example, and claims that "whatever seems clearest [of your two options]" is best, which is not true. It skips the important parts. Your question "Is this the right approach?" is not answered here. And a cast *is* happening, by the way, even if it is not explicit - it is important to always be aware of that.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25133247

http://stackoverflow.com/comment/39228813
has text: If it's an uncompressed image, have you tried to just read the bytes into an array and create a `BufferedImage` from that? If not, how is the data compressed? Do you know dimensions, color model etc of the image?
comment on: http://stackoverflow.com/q/25179381
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/25158595
has body: Try defining your CustomAuthenticationProvider bean in spring-security xml instead of using @Component annotation. Or you can also try to put &lt;context:component-scan base-package="com.mkyong.*" /&gt; in your security xml
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25149757
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/39179530
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25149757

http://stackoverflow.com/a/25649754
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25126632
answers question: http://stackoverflow.com/q/25126632
has body: it's available here: https://java.net/downloads/glassfish-samples/ although it also seems to ship with glassfish itself. see also https://stackoverflow.com/a/25649721/262852
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/25088752
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25093015
score: 1
tagged with: java
upvote count: 1
has title: jOOQ problems with limit..offset - no values sets
type: Question
tagged with: sql
downvote count: 0
answer count: 1
favorite count: 0
has body: I am trying to build a query using jOOQ, this is my test code: DSLContext create = DSL.using(SQLDialect.DERBY); String query = create.select().from(TABLE).limit(1).offset(0).getSQL() I get as query: select field1, field2...fieldN etc from TABLE offset ? rows fetch next ? rows only the problem is ? in ? rows fetch next ? rows only it seems to ignore the values that i used in limit and offset to build the query, why? I am trying to select the first row from the results and I am using jooq 3.4.1 Thanks for the help
tagged with: jooq
accepted answer: http://stackoverflow.com/a/25093015

http://stackoverflow.com/comment/39124887
comment on: http://stackoverflow.com/q/25135395
type: Comment
has text: You should look at the "D" of SOLID principle to increase your ability to write testable code. http://en.wikipedia.org/wiki/Dependency_inversion_principle
type: QuestionComment
score: 0

http://stackoverflow.com/a/25174542
answers question: http://stackoverflow.com/q/25174498
type: Answer
accepted answer of: http://stackoverflow.com/q/25174498
score: 2
upvote count: 2
type: AcceptedAnswer
has body: Start by taking a look at How to Write an Action Listeners In order for your buttons to provide notification, you must register an ActionListener within them. In order for your buttons to call your actionPerformed method however, you need to implement the ActionListener interface... public class CoinApp extends JFrame implements ActionListener { //... @Override public void actionPerformed(ActionEvent evt) { You should add the @Override annotation to methods you believe you are overriding from parent classes or interfaces, it will give you a compiler warning if you've done something wrong, like misspelt it for example. Now you can register the ActionListener with your buttons... rdbtnNewRadioButton_3.addActioinListener(this); Updated... Also, beware, you are shadowing your variables... What I mean by this is, you are declaring your variables as instance/class variables... private JRadioButton rdbtnNewRadioButton_3, rdbtnNewRadioButton, rdbtnNewRadioButton_1, rdbtnNewRadioButton_2; Which is good, but in your constructor, you are re-declaring them... public CoinApp() { //... JRadioButton rdbtnNewRadioButton_3 = new JRadioButton(""); This means when you go to reference rdbtnNewRadioButton_3 somewhere else in your program, it will be null. You should be using something like... public CoinApp() { //... rdbtnNewRadioButton_3 = new JRadioButton("");
downvote count: 0

http://stackoverflow.com/comment/39218148
comment on: http://stackoverflow.com/a/25185970
has text: @Raffaele So the string literal isn't visible in the binary. That's the OP's problem, right?
type: Comment
score: 0
type: AnswerComment

rasterize
type: Tag
tag name: rasterize
tags question: http://stackoverflow.com/q/25110647

http://stackoverflow.com/comment/39029675
type: QuestionComment
has text: When I compile the entire code, the prompt shows up but when I click a text file, nothing actually happens. And sorry, I am actually a newbie, I have only been trying to learn for a couple of weeks now. I do not yet know how I would prompt the chosen text file to execute the instruction of counting the letter frequency.
comment on: http://stackoverflow.com/q/25083851
score: 0
type: Comment

http://stackoverflow.com/a/25092279
score: 0
type: Answer
has body: You can use Factory pattern and a strategy pattern. Since Qestion is being asked in a different class (let's call it QueryResolver ) it should look like this : class QueryProcessor { private IQueryResolver _ resolver; //We will be injecting our dependencies in the constructor (Dependency Inversion) public QueryProcessor(IQueryResolver resolver ) { _resolver = resolver; } public string ProcessQuery() { _resolver.ResolveQuery(); } Now your QueryResolver Implements the IQueryResolver interface public interface IQueryResover { string ResolveQuery(); } And you will have multiple implementation of IQueryResolver each responsible for a particular kind of Query e.g.: //This particular implementation know how to resolve question including the "Who" key word. class WhoQueryResolver : IQueryResolver { private string _question; public WhoQueryResolver(string question) { _question = question; } public string ResolveQuery() { //do a lot of things here. System.out.print(getParents().getMother()); } Similarly, class HowQueryResolver : IQueryResolver { private string _question; public HowQueryResolver(string question) { _question = question; } public string ResolveQuery() { //do a lot of things here. System.out.print(GetActualHealth()); } than finally a factory which return concrete implementation of IQueryResolver public class QueryResolverFactory { public static IQueryResolver GetQueryResolver() { if (question.startsWith("How") &amp;&amp; question.endsWith("Josh?")) { return new HowQueryResolver(question); } else if (question.startsWith("Who") &amp;&amp; question.endsWith("mother?")) { return new WhoQueryResolver(question); } } }
answers question: http://stackoverflow.com/q/25090301

http://stackoverflow.com/a/25145580
answers question: http://stackoverflow.com/q/25145415
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: You can use \ to split parentheses sql.split("'\\),\\('");

http://stackoverflow.com/comment/39234665
has text: oh man thank u for this has help me a lot
type: Comment
comment on: http://stackoverflow.com/a/25194691
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39157278
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25152960
has text: Not for now. I'll try this out tomorrow. Thanks.
score: 0

http://stackoverflow.com/a/25139575
has comment: http://stackoverflow.com/comment/39132802
upvote count: 7
has body: Actually, it is type inference. The diamond operator (&lt;&gt;), allows the right hand side of the assignment to be defined as a true generic instance with the same type parameters as the left hand side without having to type those parameters again (because the compiler infers the type(s) from the left hand side). From the Angelika Langer's Generics FAQ: It (the diamond operator) denotes the empty angle brackets that are used for type inference in new -expression. More info: Type inference from the Java Tutorials
accepted answer of: http://stackoverflow.com/q/25139508
has comment: http://stackoverflow.com/comment/39132700
score: 7
answers question: http://stackoverflow.com/q/25139508
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39131779

http://stackoverflow.com/q/25076557
answer count: 1
upvote count: 13
accepted answer: http://stackoverflow.com/a/25114066
score: 13
tagged with: spring
has title: Not loading a Spring bean when a certain profile is set
type: AnsweredQuestion
tagged with: spring-profiles
tagged with: java
type: Question
downvote count: 0
has body: Background: So, I've got several beans that interface external systems. For development, it's convenient to mock the external systems and replace the interfacing beans with some implementations that produce more or less static responses. So what I've been doing is to create an interface, the real implementation and a stub implementation like this: public interface ExternalService { // ... } @Service public class ExternalServiceImpl implements ExternalService { // ... } @Service @Primary @Profile({"stub"}) public class StubExternalService implements ExternalService { // ... } ...and this works great: if the stub profile is not present, the stub-bean does not get loaded at all. If it is present, it nicely supersedes the real implementation because of the @Primary annotation. Problem: Now, however, I've run for the first time in a situation where I've actually got two real implementations of the same interface. One of them is defined as primary, but the other may also be used by loading it from the application context. I'd still like to create a stub service to replace them both, but this time my old way of defining the stub as @Primary doesn't work, because there's already one primary implementation. Basically what I'd need is a way of not loading the primary bean when the stub profile is set, but I'm at loss on how exactly to do that. Web searches or other Stack Overflow questions don't seem to be helping.
has answer: http://stackoverflow.com/a/25114066
favorite count: 0
tagged with: spring-bean

http://stackoverflow.com/comment/44698435
has text: Looks like you may benefit from this code: https://github.com/googlemaps/android-maps-utils/blob/master/library/src/com/google/maps/android/PolyUtil.java#L289
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25104691

http://stackoverflow.com/comment/39050870
type: QuestionComment
score: 0
has text: Thanks @GordonLinoff, I'll certainly look into doing things that way. As I already have a few users of this app with data stored in its current way even copying the data into a new format could benefit from looping through the current columns rather than typing them all out, but as it wasn't designed for this is this then not an option?
comment on: http://stackoverflow.com/q/25095430
type: Comment

http://stackoverflow.com/comment/39115876
type: AnswerComment
type: Comment
has text: Sorry about bad indenting. This commenting system doesn't let you use new lines. :/
comment on: http://stackoverflow.com/a/25130521
score: 0

http://stackoverflow.com/a/29491263
score: 3
type: Answer
answers question: http://stackoverflow.com/q/25177487
upvote count: 3
downvote count: 0
has body: I know that you want to test for where the value may include null, but there's a solution by using the empty operator that is elegant when one might want to also exclude null values in that it will evaluate to true if the value is null or does not exist. &lt;c:if test="${not empty hmap['REGION']}"&gt; &lt;%-- conditional block --%&gt; &lt;/c:if&gt;

http://stackoverflow.com/a/25107395
downvote count: 0
type: Answer
has body: Where is filechooser in javafx? The FileChooser class is located in the javafx.stage package. File Chooser This chapter explains how to use the FileChooser class to enable users to navigate the file system. The samples provided in this chapter explain how to open one or several files, configure a file chooser dialog window, and save the application content. Unlike other user interface component classes, the FileChooser class does not belong to the javafx.scene.controls package. However, this class deserves to be mentioned in the JavaFX UI Controls tutorial, because it supports one of the typical GUI application functions: file system navigation. The FileChooser class is located in the javafx.stage package along with the other basic root graphical elements, such as Stage, Window, and Popup. Source Using JavaFX UI Controls
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25107291

http://stackoverflow.com/q/25215987
has comment: http://stackoverflow.com/comment/39274871
score: 0
tagged with: java
has body: I am trying to convert datetime object to String base on user defined pattern. For example if a user pass in a string "Good morning, today is E MM/dd/yyyy.", I will replace the date format to the current time. "Good morning, today is Fri 11/15/2013." It is possible to handle by joda time library? or do I have to search for each possible pattern and do a string replace manually?
type: Question
tagged with: jodatime
has answer: http://stackoverflow.com/a/25221195
answer count: 1
has title: Formatting paragraph using jodatime
type: UnansweredQuestion

http://stackoverflow.com/q/25122587
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has answer: http://stackoverflow.com/a/25122663
linked to: http://stackoverflow.com/q/9256122
type: UnansweredQuestion
has body: OS: Windows Server 2008 R2 SP1 Web Server Front-End: IIS 7.5 Web Server Back-End: Tomcat 5.5 AJP Connector is used to pass JSP content from IIS to Tomcat. I have a number of project folders that get delivered for web consumption every so often. The web pages themselves end with the HTML extension. They need to be hosted on a Tomcat web server and I need session management control via a JSP application. That is, it's not enough for me to check if the session is active for Tomcat. I have some session control specific to the JSP application itself. I suppose I could run a script which takes the multitude of HTML pages and converts them into JSP, but I'd like to keep things as "drag-and-drop" friendly as I can. I'd rather not make any changes directly to these project folders. Is there a way I can enforce Tomcat to treat HTML pages as JSP pages? I.e., If, for example, I wanted to include JSP expressions inside the HTML pages, I could do that. Thank you very much for any help.
has comment: http://stackoverflow.com/comment/39100929
duplicate of: http://stackoverflow.com/q/4249622
tagged with: java
type: Question
has title: How can I treat html pages as jsp pages?
tagged with: session
tagged with: jsp
tagged with: tomcat
linked to: http://stackoverflow.com/q/4249622

http://stackoverflow.com/a/25157687
has body: You could try this. Editor -> Auto import -> Optimize imports on the fly
type: Answer
has comment: http://stackoverflow.com/comment/39168196
has comment: http://stackoverflow.com/comment/39165895
answers question: http://stackoverflow.com/q/25156831
has comment: http://stackoverflow.com/comment/39166742
score: 0

http://stackoverflow.com/comment/39220301
type: Comment
comment on: http://stackoverflow.com/a/25186232
has text: Thanks! it is working. i had to call 2 times GetRawInputDeviceList with the correct structure size finally get it.
type: AnswerComment
score: 0

http://stackoverflow.com/a/25102533
answers question: http://stackoverflow.com/q/25102319
score: 0
type: Answer
has body: You should change it to the click event Username: Password:
has comment: http://stackoverflow.com/comment/39063019

http://stackoverflow.com/a/25214432
type: Answer
answers question: http://stackoverflow.com/q/25214353
upvote count: 1
downvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/39276046
has comment: http://stackoverflow.com/comment/39271699
has body: How about not inserting the null value in the id column. It is of no use to insert null value. It might have generated the sql exception. Try INSERT INTO table_one (name) VALUES ('Hayley');. I would suggest to use PreparedStatement instead of Statement because of the threat of SQL injection. Sometimes, the particular sql exception can occur if the database name is not given. Have you tried writing the database name like INSERT INTO database_name.table_one (name) VALUES ('Hayley');.

http://stackoverflow.com/q/25218804
favorite count: 0
has comment: http://stackoverflow.com/comment/39279724
possible better answer: http://stackoverflow.com/a/25218861
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25218861
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/25218948
type: Question
has body: Was finding this problem with Eclipse(Kepler) over the last week, so downloaded Eclipse (Luna) and checked out the relevent project into an entirely new workspace. I'm using *.str files for a particular project (they are standard editor files anyway - short for 'string'). But Eclipse wants to open such files as macVim files: I have NO file associations set for *.str files: ...althought I do use macVim to open them in the underlying operating system. So I change the system editor to TextEdit and Eclipse happily now wants them to open in TextEdit - but I want to open them in the eclipse editor! (appart from anything else, I've got to develop an editor plugin for *.str files. How can I convince Eclipse that it can open *.str in it's own editors without having to resort to the system editor? EDIT - follow the answers - my understanding is this. If Eclipse doens't know what the file is, it will ask the system. If you ask it to open in a particular editor it will overlay that information on that particular file, and to make it happen in general (and change the icon) you need to add a file association.
tagged with: eclipse
answer count: 2
has title: Eclipse automatically opening some files in system editor
accepted answer: http://stackoverflow.com/a/25218948
downvote count: 0

properties
tags question: http://stackoverflow.com/q/25204068
type: Tag
tags question: http://stackoverflow.com/q/25176499
tag name: properties
tags question: http://stackoverflow.com/q/25204862
tags question: http://stackoverflow.com/q/25158100
tags question: http://stackoverflow.com/q/25205405

http://stackoverflow.com/comment/39164805
comment on: http://stackoverflow.com/q/25157282
type: QuestionComment
has text: I think this question is rather interesting, but it would be better fit for [CodeReview.SE]. There might be a different approach altogether that is better than the 2 you suggest.
type: Comment
score: 2

http://stackoverflow.com/q/25190219
type: Question
has comment: http://stackoverflow.com/comment/39246483
score: 0
tagged with: plsql
answer count: 1
accepted answer: http://stackoverflow.com/a/25201957
has comment: http://stackoverflow.com/comment/39226815
has comment: http://stackoverflow.com/comment/39254386
tagged with: resultset
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/39262244
has answer: http://stackoverflow.com/a/25201957
has comment: http://stackoverflow.com/comment/39258406
has comment: http://stackoverflow.com/comment/39257732
has comment: http://stackoverflow.com/comment/39227621
has body: I am trying to call a StoredProcedure from Java, but the result returned is always false. In reality, it has to return 100's of records. The connection is established good. I have a stored procedure, PROCEDURE get_records ( grp1 IN a.name%TYPE DEFAULT NULL ,grp2 IN a.name%TYPE DEFAULT NULL ,grp3 IN a.name%TYPE DEFAULT NULL ,grp4 IN a.name%TYPE DEFAULT NULL ,grp5 IN a.name%TYPE DEFAULT NULL ,flag1 IN a.flag%TYPE DEFAULT 'F' ,flag2 IN a.flag%TYPE DEFAULT 'F' ,refercursor_out OUT SYS_REFCURSOR ); My java Program: import java.io.IOException; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import oracle.jdbc.driver.OracleTypes; class DAO1 { public static void main(String args[]) throws SQLException, IOException { // Load the driver DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection conn = DriverManager .getConnection("jdbc:oracle:thin:admin/admin@//host1:1521/abcdev"); System.out.println(conn); // Prepare to call the stored procedure get_group_details. CallableStatement cstmt = conn .prepareCall("{call mypackage.get_records (?,?,?,?,?,?,?,?)}"); cstmt.registerOutParameter(8, OracleTypes.CURSOR); // REF CURSOR cstmt.setString(1, ""); cstmt.setString(2, ""); cstmt.setString(3, ""); cstmt.setString(4, ""); cstmt.setString(5, ""); cstmt.setString(6, ""); cstmt.setString(7, ""); // execute get_records //cstmt.execute(); //updated cstmt.executeQuery(); //updated ResultSet rs0 = (ResultSet) cstmt.getObject(8); System.out.println("rs0 is " + rs0.next()); /* * ResultSet rs = ((OracleCallableStatement) cstmt).getCursor(8); * System.out.println("rs is " + rs.next()); * * while (rs.next()) { System.out.println(".."); } */ // Close the statement cstmt.close(); // Close the connection conn.close(); } } Current ouput: oracle.jdbc.driver.OracleConnection@5afec107 rs0 is false Question - why is it false? I expect 100's of records in the resultset. There are …
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39257673
tagged with: java
has comment: http://stackoverflow.com/comment/39246524
has title: Java: resultset is empty while calling stored procedure with ref cursor as OUT
tagged with: cursor

http://stackoverflow.com/comment/39201339
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25174632
has text: Note that you can't use `[...]` inside parser rules: only inside lexer rules.
type: Comment

http://stackoverflow.com/a/25159536
has comment: http://stackoverflow.com/comment/39169755
has comment: http://stackoverflow.com/comment/39173099
upvote count: 1
has body: try: "SELECT * FROM users where \"user\" ='"+name+"'and pass ='" +pass+"'"; But it's harmful for sql injection. See PreparedStatements.
answers question: http://stackoverflow.com/q/25159416
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/25107090
accepted answer of: http://stackoverflow.com/q/25107048
type: Answer
has comment: http://stackoverflow.com/comment/39074005
score: 1
upvote count: 1
has body: The UML diagram shows each method only in the class that first introduced it. Otherwise, each class's UML would show all the methods of all the ancestor classes of its hierarchy, which wouldn't be very convenient. So you should definitely override calculateMonthlyPay() and getStatus() in the sub-classes, or you wouldn't be able to compile your code.
has comment: http://stackoverflow.com/comment/39074112
has comment: http://stackoverflow.com/comment/39074246
answers question: http://stackoverflow.com/q/25107048
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25243411
accepted answer of: http://stackoverflow.com/q/25200737
type: Answer
has body: It seems I was trying to do a bit too much with my data types and the libraries (or at least these two) don't really support it. The input JSON is, in this case, known to have a regular structure: "values" is an array which contains subarrays, each of which is always of size 2, such that the first item is a long and the second is a double (or null). So I was hoping I could just directly translate this into a suitable POJO. The idea is that if somehow an array somehow has x != 2 elements, or if the elements are not a long and a (nullable) double, that's a parse error; otherwise, it gets automatically translated into a POJO. Instead, what I went for was manual parsing of the array using the standard JSON Java library. I'm doing the validity checks manually as I go, accumulating the values into a List, and returning that. As a bonus the fields in my POJO can now easily be public final which is nice. One could also use Jackson or Gson do convert the JSON into primitives (see the other answers) but then you'd still have to check those primitives manually which seems to kind of defeat the point of using a fancy library. I still think it would be nicer to be able to use a library to do this conversion, but not sure if there is a library that supports it.
score: 0
answers question: http://stackoverflow.com/q/25200737
type: AcceptedAnswer

http://stackoverflow.com/a/25097143
type: Answer
answers question: http://stackoverflow.com/q/25096860
score: 0
has body: All of those positions start at zero, and then your excessive if statements check for just about everything but zero.

http://stackoverflow.com/a/25145824
upvote count: 9
has comment: http://stackoverflow.com/comment/39143971
type: Answer
has comment: http://stackoverflow.com/comment/39144824
has comment: http://stackoverflow.com/comment/39143845
has comment: http://stackoverflow.com/comment/39143762
has comment: http://stackoverflow.com/comment/39143679
downvote count: 0
has body: You can't call methods on ints; there's no compareTo method to call. That would be on the boxed Integer type, but boxing would be overkill. If you're on Java 7+, you should write return Integer.compare(o1.getScore(), o2.getScore()); ...otherwise you'll more or less need to write if (o1.getScore() &lt; o2.getScore()) { return -1; } else if (o1.getScore() &gt; o2.getScore()) { return 1; } else { return 0; }
has comment: http://stackoverflow.com/comment/39145633
score: 9
has comment: http://stackoverflow.com/comment/39143831
answers question: http://stackoverflow.com/q/25145789
has comment: http://stackoverflow.com/comment/39143859
accepted answer of: http://stackoverflow.com/q/25145789
type: AcceptedAnswer

http://stackoverflow.com/q/25207036
linked to: http://stackoverflow.com/q/25906175
has title: Pixelated Java applet on Macbook Pro Retina display
upvote count: 1
downvote count: 0
tagged with: applet
has comment: http://stackoverflow.com/comment/39257790
favorite count: 0
tagged with: retina-display
tagged with: macos
has comment: http://stackoverflow.com/comment/39287786
has comment: http://stackoverflow.com/comment/49336715
has body: I'm using java and acm-imports to draw things in an applet, and it comes out pixelated on my Macbook Pro Retina display. I code using Sublime Text, compile and run it directly from the Terminal. My Java version is 1.7.0_65. Is there any fix for this? Any way to make the image look sharp on Retina display? Thanks
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40598797
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/25148287
type: Question
upvote count: 2
answer count: 2
has title: Reduce Empty Space in JFrame
has answer: http://stackoverflow.com/a/25148379
has body: I've got a finished application here, but there's a ton of blank space on the screen and I've been fiddling around with things for a while, but the picture below is the most I've managed to cut. I'm assuming I'm not using a certain method or utility that I may or may not have used at all yet. Here's the code: public ListWindow() { chooser = new JFileChooser(); this.setLayout(new GridLayout(3,1,1,1)); JPanel sortPanel = new JPanel(); JPanel displayPanel = new JPanel(); JPanel btns = new JPanel(); JLabel sortLabel = new JLabel("Sort by:"); sortGame = new JRadioButton("Game"); sortScore = new JRadioButton("Score"); sortBtn = new JButton("Sort"); ButtonGroup group = new ButtonGroup(); group.add(sortGame); group.add(sortScore); list = new JList(reviewList.toArray()); JScrollPane reviewPane = new JScrollPane(list); reviewPane.setPreferredSize(new Dimension(400, 150)); windowBtn = new JButton("To Review Entry"); buttonActions(); sortPanel.add(sortLabel); sortPanel.add(sortGame); sortPanel.add(sortScore); sortPanel.add(sortBtn); displayPanel.add(reviewPane); btns.add(windowBtn); this.add(sortPanel); this.add(displayPanel); this.add(btns); } public static void main(String[] args) { ListWindow window = new ListWindow(); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setTitle("CriticalStrike.com - Review Database"); window.pack(); window.setVisible(true); } } Thanks for the help, guys!
accepted answer: http://stackoverflow.com/a/25148379
favorite count: 0
downvote count: 0
tagged with: swing
possible better answer: http://stackoverflow.com/a/25148599
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/25148599
tagged with: java

http://stackoverflow.com/comment/39267272
has text: @Zyion Nowhere, fillRect just makes the rectangle completely black right?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25211986

http://stackoverflow.com/a/53868333
has body: Try using class PersonRepositoryCustomImpl implements PersonRepositoryCustom, InitializingBean { ... }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25201306

http://stackoverflow.com/q/25198994
has answer: http://stackoverflow.com/a/25200966
answer count: 1
score: 0
tagged with: android
has title: How to add child image to sprite in Libgdx as we can do in Cocos2d?
type: UnansweredQuestion
has body: While i was learning about Libgdx i came across this problem of adding a child sprite to parent sprite in Libgdx as i did the same in Cocos2d it had no problem of doing it. How can the same be achieved in Libgdx, so that i can perform operation on parent sprite and it will be followed by the child added to it. EDIT : I have seen at https://github.com/libgdx/libgdx/wiki/Scene2d of scene2d, but they havn't mentioned how to make use of Group. This is what i tried earlier but its coming white screen public class TestScreen implements Screen{ private MainGame game; private Sprite sprite; public Group group; private Stage stage; private SpriteBatch batch; public TextureAtlas atlas1; public Skin skin; public Image bg; public Sprite sprite1; public TestScreen(MainGame game) { this.game=game; group = new Group(); batch = new SpriteBatch(); circle=AssestLoader.circle1; } @Override public void render(float delta) { // TODO Auto-generated method stub Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); stage.act(delta); batch.begin(); stage.addActor(group); batch.end(); } @Override public void show() { // TODO Auto-generated method stub atlas1 = new TextureAtlas("test/gamescreentest.pack"); skin = new Skin(); skin.addRegions(atlas1); bg = new Image(); bg.setDrawable(skin, "playbg_hdpi"); bg.setHeight(460f); bg.setWidth(460f); group.addActor(bg); } @Override public void hide() {} @Override public void resize(int width, int height) {} @Override public void pause() {} @Override public void resume() {} @Override public void dispose() {}} Its coming white screen without image
type: Question
tagged with: libgdx
tagged with: java

http://stackoverflow.com/q/25188269
accepted answer: http://stackoverflow.com/a/25209273
has comment: http://stackoverflow.com/comment/39222381
type: Question
has comment: http://stackoverflow.com/comment/39222521
has body: I am trying to support for devanagari font for android 2.x (even though android 2.x is not capable of rendering the devanagari font) using following code. The code is working fine except having some issues with 'raswa' and 'dirga'. Is it possible to obtain the correct devanagari representation in android 2.x ? Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/mangal.ttf"); TextView txtviewword=(TextView) findViewById(R.id.textViewWord); txtviewword.setTypeface(typeface); This is incorrect representation(from android 2.3): This should have been rather like this(from android 4.4):
answer count: 1
downvote count: 0
tagged with: unicode
favorite count: 0
has title: Android 2.x devanagari unicode issue
upvote count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/39225799
has comment: http://stackoverflow.com/comment/39222245
has comment: http://stackoverflow.com/comment/39222684
has comment: http://stackoverflow.com/comment/39234775
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25209273

http://stackoverflow.com/q/25195028
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/25195149
favorite count: 0
tagged with: scala
tagged with: recursion
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/25195102
has body: I'd like to get all nodes in a JSoup doc. What's the best way to do this (in Java or Scala?) Thanks
upvote count: 1
has comment: http://stackoverflow.com/comment/39240292
has answer: http://stackoverflow.com/a/25195102
tagged with: nodes
has title: quickest way to get all nodes (recursively) in JSoup doc
type: Question
tagged with: jsoup
has answer: http://stackoverflow.com/a/25195149

http://stackoverflow.com/a/25169087
has comment: http://stackoverflow.com/comment/39187465
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39187410
answers question: http://stackoverflow.com/q/25169026
type: Answer
accepted answer of: http://stackoverflow.com/q/25169026
has body: In your doInBackground you can try something like this. HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(HTTP_REQUEST_URL); //create and assign post request server data String latitude = loc.getLatitude() + ""; String longitude = loc.getLongitude() + ""; String time = DateFormat.getDateTimeInstance().format(Calendar.getInstance().getTime()) + ""; String whr = WhereAmI(loc.getLatitude(), loc.getLongitude()); //data back from server String responseBackFromServer = ""; try { List&lt;NameValuePair&gt; pairs = new ArrayList&lt;NameValuePair&gt;(); pairs.add(new BasicNameValuePair("latitude", latitude)); pairs.add(new BasicNameValuePair("longitude", longitude)); pairs.add(new BasicNameValuePair("whereAmI", whr)); pairs.add(new BasicNameValuePair("time", time)); post.setEntity(new UrlEncodedFormEntity(pairs)); HttpResponse server_response = client.execute(post); responseBackFromServer = EntityUtils.toString(server_response.getEntity()); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return "Response Back: " + responseBackFromServer; and In onPostExecute you can do whatever with the reponse.
score: 0

http://stackoverflow.com/comment/39500907
type: QuestionComment
has text: Added the stack trace to the bug report
type: Comment
comment on: http://stackoverflow.com/q/25227324
score: 0

http://stackoverflow.com/a/25212125
downvote count: 0
type: Answer
has body: MyButtonListener l = new MyButtonListener(getApplicationContext()); and create parameterize constructor in MyButtonListener and use that Context
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25211952

http://stackoverflow.com/q/25184217
upvote count: 2
type: UnansweredQuestion
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/25184561
has comment: http://stackoverflow.com/comment/62821495
score: 2
tagged with: java
tagged with: hibernate
tagged with: orm
has title: ORM for google App Engine (java)
type: Question
linked to: http://stackoverflow.com/q/20869422
linked to: http://stackoverflow.com/q/38397337
downvote count: 0
has body: I developed google endpoints API's &amp; access cloud sql database by using JDBC.now I want to use ORM tool for accessing cloud sql database. so which ORM tools are supported by google app engine rather that JDO &amp; JPA? I mean,does hibernate support GAE?
has answer: http://stackoverflow.com/a/47350861
answer count: 2
linked to: http://stackoverflow.com/q/25158746
favorite count: 0

http://stackoverflow.com/a/25190174
answers question: http://stackoverflow.com/q/25190006
type: Answer
has body: You are missing a closing bracket (}) somewhere. Probably at the end of your bean... Consider the line where you are having a problem: System.out.println(bean.getTelefones()); //here exception You are attempting to print the result of bean.getTelefones(). That function returns a List&lt;String&gt;. You can't just print out a List of something. To print the entire list: String todosTelefones = ""; for (String s : bean.getTelefones()) todosTelefones += s; System.out.println(todosTelefones ); To print out a single String element in the List: System.out.println(bean.getTelefones().get(index));
has comment: http://stackoverflow.com/comment/39226356
has comment: http://stackoverflow.com/comment/39226931
score: 0

http://stackoverflow.com/a/25167075
answers question: http://stackoverflow.com/q/25166586
has comment: http://stackoverflow.com/comment/39183709
score: 0
has comment: http://stackoverflow.com/comment/39248224
type: Answer
has body: There are a number of issues with this code, the first thing I noticed is that your constructor uses the animals Map to initialize itself. Just initialize the map using an empty constructor. i.e. animals = new TreeMap&lt;String, Animal&gt;(); Then call the method to read from the file which also fills your map. readDataFromFile(); finally if you want to iterate over a map and display the contents, you will need to do something like this: for (Map.Entry&lt;String, Animal&gt; animalEntry : animals.entrySet()) { System.out.println(animalEntry.getKey() + "/" + ((Animal)animalEntry.getValue()).getName()); }

http://stackoverflow.com/comment/39129489
comment on: http://stackoverflow.com/a/25127518
score: 0
type: AnswerComment
has text: To better clarify, I want to use this as a shell program after logging into Windows for two factor authentication. My goal is to have this program boot immediately after Windows login so that no other programs can be accessed until the user name and password is confirmed from the MySQL database. Since the showData() frame is what displays the successful login results, I wanted to have the secondary JButton with system.exit(0) coded to that window to kill the entire JVM so that the the system can be accessed. I hope that better describes the purpose. Let me know if more detail is needed.
type: Comment

http://stackoverflow.com/comment/39296281
type: QuestionComment
comment on: http://stackoverflow.com/q/25227777
has text: *"so I tried to create CompoundBorder inside a CompoundBorder but that wouldn't work."* It should work. Why did it not work here?
score: 1
type: Comment

http://stackoverflow.com/a/25125707
has body: Try this: String sampleString = "page=2&amp;items=200"; String [] splitArray = sampleString.split("page=|\\&amp;items="); System.out.println(sampleString.matches("page=\\d+\\&amp;items=\\d+")); System.out.println((Integer.parseInt(splitArray[1]) - 1) * 200 == Integer.parseInt(splitArray[2])); You will have to write 2 conditions, one to check the format (check the first SOP) and then do the maths (check the second SOP)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25124001

http://stackoverflow.com/q/25109390
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39075898
has comment: http://stackoverflow.com/comment/39076051
tagged with: string
has comment: http://stackoverflow.com/comment/39075882
has answer: http://stackoverflow.com/a/25109805
type: Question
has comment: http://stackoverflow.com/comment/39075877
has comment: http://stackoverflow.com/comment/39075909
accepted answer: http://stackoverflow.com/a/25109546
tagged with: integer
has title: Verify if a String is an integer (numberFormatException)
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/39077211
tagged with: java
has body: I was trying to write a piece of code to test if a string contains an integer. I am aware of the try catch solution, but i have read it becomes bad if you call the method from other classes. What I have read is that the method will show the error, but the main of the class calling it will keep running anyway. Therefore, I was trying to do it manually. My problem is that i am able to assess that the string is not empty and that all the characters in the string are digits, but I can't find a way to verify whether the number is too big to be sorted in an integer. Point is, i have found on stackoverflow many similar topics, but noone solve this problem without try catch. Here is my method. // INTEGER VERIFICATION public static boolean isInteger (String str_input){ int number_of_digits = 0; if (str_input.isEmpty()) { JOptionPane.showMessageDialog(null, "No input inserted", "Error", JOptionPane.ERROR_MESSAGE); return false; } for (char c : str_input.toCharArray()){ if(Character.isDigit(c)){ number_of_digits++; } } if (number_of_digits == str_input.length()){ return true; } else { JOptionPane.showMessageDialog(null, "The input is not an integer", "Error", JOptionPane.ERROR_MESSAGE); return false; } } Thanks in advance for your help!
has comment: http://stackoverflow.com/comment/39076012
possible better answer: http://stackoverflow.com/a/25109510
linked to: http://stackoverflow.com/q/20793578
has answer: http://stackoverflow.com/a/25109510
tagged with: numberformatexception
has answer: http://stackoverflow.com/a/25109546

http://stackoverflow.com/q/25190374
has title: type-mismatch in a conditional operator (java)
type: Question
has comment: http://stackoverflow.com/comment/129230952
has body: I don't understand why the following would NOT cause an error. boolean condition = &lt;whatever&gt;; return condition ? Collections.singleton("a field") : Collections.EMPTY_LIST; Collections.singleton() returns a java.util.Set which obviously is NOT the same type as EMPTY_LIST. Should that really NOT cause a type-mismatch error?
score: 0
answer count: 2
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25523681
tagged with: javac
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/73172503

http://stackoverflow.com/comment/39049905
comment on: http://stackoverflow.com/q/25095459
type: Comment
type: QuestionComment
score: 1
has text: You might want to read and learn about [UPnP](http://en.wikipedia.org/wiki/UPnP).

http://stackoverflow.com/comment/39071132
type: Comment
type: QuestionComment
has text: Sure, Akka Persistence saves all events to journal. You can use different SQL and NoSQL databases as journals, for example Cassandra or MongoDB (it's all done with Akka Persistence plugins). After restart it reads journal and builds latest state from it.
score: 1
comment on: http://stackoverflow.com/q/25095487

http://stackoverflow.com/comment/58258312
comment on: http://stackoverflow.com/a/35259938
score: 0
type: Comment
has text: 1. TapeEquilibrium Minimize the value |(A[0] + ... + A[P-1]) - (A[P] + ... + A[N-1])|.
type: AnswerComment

http://stackoverflow.com/q/25195586
answer count: 2
tagged with: database
has comment: http://stackoverflow.com/comment/39247932
has answer: http://stackoverflow.com/a/25195655
score: 0
has comment: http://stackoverflow.com/comment/39236106
has answer: http://stackoverflow.com/a/25200202
has body: I have been having a bit of trouble with connecting to my database. I connect to the same database on my website and it works, so I know it's probably something to do with the path to the database in my Java code. Connection con = DriverManager.getConnection("jdbc:mysql://ultraboodog.com:3306/ultraboo_lr", "ultraboo_root", "password"); I have no clue why it isn't working, and I am getting this error: java.sql.SQLException: Access denied for user 'ultraboo_root'@'S010650465d6c5d19.ss.shawcable.net' (using password: YES) Any help would be much appreciated :) EDIT: I am also using the mysql-connector-java plugin to connect to the database, it is made by Oracle.
type: UnansweredQuestion
tagged with: java
tagged with: mysql
type: Question
has title: Java Connecting to a MySQL database error

http://stackoverflow.com/q/25179795
tagged with: inner-classes
upvote count: 2
type: UnansweredQuestion
tagged with: jls
has comment: http://stackoverflow.com/comment/39206258
score: 2
has answer: http://stackoverflow.com/a/25179996
tagged with: java
type: Question
has body: Consider the following Test class to demonstrate the inner class behavior in Java. The main code is in the run method. Rest is just plumbing code. public class Test { private static Test instance = null; private Test() { } private void run() { new Sub().foo(); } public static void main(String[] args) { instance = new Test(); instance.run(); } class Super { protected void foo() { System.out.println("Test$Super.Foo"); } } class Sub extends Super { public void foo() { System.out.println("Test$Sub.Foo"); super.foo(); } } } I am just printing below the javap output for the hidden Sub constructor: so.Test$Sub(so.Test); Code: 0: aload_0 1: aload_1 2: putfield #1 // Field this$0:Lso/Test; 5: aload_0 6: aload_1 7: invokespecial #2 // Method so/Test$Super."&lt;init&gt;":(Lso/Test;)V 10: return Normally the compiler ensures that the sub-class constructor would call into the super-class constructor first before going on to initialize its own fields. This aids in a correctly constructed object but I am seeing an aberration from the normative behavior in the case of the constructor that the compiler generates for an Inner class. Why so? Is it specified by JLS? P.S: I know that the inner class contains a hidden reference to the outer class and that reference is being set here in the above javap output. But the question is why it is set before calling super constructor. What am I missing?
tagged with: javap
answer count: 1
downvote count: 0
has title: Why the call to the parent constructor is not the first call in the compiler generated constructor for Inner class?
favorite count: 0

http://stackoverflow.com/comment/39294174
type: Comment
has text: when i was writing it, some one else wrote !
comment on: http://stackoverflow.com/a/25226737
score: 1
type: AnswerComment

http://stackoverflow.com/a/25216268
has body: Thanks to &lt;T extends SomeType&gt;, we can be sure that T is always a subtype of SomeType, right? Right. So why can't I just return the supertype SomeType? Because it might not be a T! Put it this way - imagine SomeType is Object, and T is String. You're suggesting that this code should work: String foo() { return new Object(); } It works the other way round - you can return a subtype reference for a method declared to return a supertype, but that's different. The fix is easy though - just change orig to be of type T: T orig = super.createSomething(); Then it compiles with no problems.
accepted answer of: http://stackoverflow.com/q/25216255
answers question: http://stackoverflow.com/q/25216255
score: 6
has comment: http://stackoverflow.com/comment/39275162
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39275180
has comment: http://stackoverflow.com/comment/39275092
has comment: http://stackoverflow.com/comment/39275206
has comment: http://stackoverflow.com/comment/39275175
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/39275100

http://stackoverflow.com/a/25111504
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25111484
upvote count: 1
has body: the trace already told u the reason why it crashed: attempt to re-open an already-closed object: SQLiteDatabase
score: 1

http://stackoverflow.com/comment/39251373
comment on: http://stackoverflow.com/a/25202963
type: AnswerComment
has text: Nope , it didn't!! I have added the server side code.
score: 0
type: Comment

http://stackoverflow.com/a/25218521
has body: Try this simple way not need of for loop public class MainActivity extends Activity { CountDownTimer workoutTimer; CountDownTimer restTimer; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnStart.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startWorkoutTimer(0); } }); btnStop.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (workoutTimer!=null ){ workoutTimer.cancel(); } if (restTimer!=null ){ restTimer.cancel(); } } }); } public void startWorkoutTimer(final int count ){ workoutTimer=new CountDownTimer(30000, 1000) { @Override public void onTick(long millisUntilFinished) { } @Override public void onFinish() { if(count!=3){ startRestTimer(count); } } }; workoutTimer.start(); } public void startRestTimer(final int count ){ restTimer=new CountDownTimer(15000, 1000) { @Override public void onTick(long millisUntilFinished) { } @Override public void onFinish() { if(count!=3){ startWorkoutTimer(count+1); } } }; restTimer.start(); } }
has comment: http://stackoverflow.com/comment/39279555
has comment: http://stackoverflow.com/comment/39296318
answers question: http://stackoverflow.com/q/25218138
upvote count: 1
has comment: http://stackoverflow.com/comment/39297144
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25218138
has comment: http://stackoverflow.com/comment/39294028
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/25118536
tagged with: build-server
tagged with: java
has answer: http://stackoverflow.com/a/25119092
has title: Providing JCE policies without patching the JRE
answer count: 2
linked to: http://stackoverflow.com/q/6900542
tagged with: security
score: 0
tagged with: jce
has body: In my project I had some issues with cryptography which I fixed by using "JCE Unlimited Strength Jurisdiction Policy Files". On local machine I just replaced some JARs in the jre/lib/security directory. However, I also need my project to build (to be precise, to run tests) on a continuous integration build server (Teamcity in my case, but I guess it's not very important), which means patching jars in the JRE directory of every build agent, which is not a good option at all. Is there a way of specifying these JCE policies without patching the JRE?
has answer: http://stackoverflow.com/a/25305942
accepted answer: http://stackoverflow.com/a/25305942
linked to: http://stackoverflow.com/q/1179672
possible better answer: http://stackoverflow.com/a/25119092
type: Question
has comment: http://stackoverflow.com/comment/39155388
type: AnsweredQuestion

http://stackoverflow.com/comment/39098624
comment on: http://stackoverflow.com/a/25121106
has text: Sorry for limited information. I have updated the question. Can you help me.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25084990
downvote count: 3
has comment: http://stackoverflow.com/comment/39030399
upvote count: 1
has comment: http://stackoverflow.com/comment/39030429
type: Question
has answer: http://stackoverflow.com/a/25085162
has title: Exceptions (Java)
has body: Ok I have been trying this exercise because I am not good at exceptions.So here is the context of the exercise:Write a class with main method(the following code is give by the task): public class task{ public static void main( String[] args) { int[] array = new int[10]; // initialise array int result =task.min(array); // Where the class task // contains the min method } so I am asked to make sure that the method works even if the array contains only one element or none at all.So with the code give above I have to use exceptions to handle all the errors that could pop up. This is what I did: public static void main(String[] args){ int[] array = new int[10]; array[0]=5; array[1]=7; int result =Exercise1.min(array); if(array.length&lt;=0){ throw new IllegalArgumentException("empty array"); } else if(array.length&lt;10 &amp;&amp; array.length&gt;0){ throw new IllegalArgumentException("I got just these numbers"); } System.out.println(result); } public static int min(int[] array) { int min = array[0]; for(int i=1;i&lt;array.length;i++){ if(array[i]&lt; min){ min = array[i]; } } return min; } } However no matter what I write the output is always 0 and I don't understand why.In case my approach is entirely wrong please offer some advice.
has comment: http://stackoverflow.com/comment/39030450
answer count: 3
tagged with: arrays
tagged with: custom-exceptions
favorite count: 0
accepted answer: http://stackoverflow.com/a/25085162
has answer: http://stackoverflow.com/a/25085072
score: -2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25085072
has answer: http://stackoverflow.com/a/25085253
tagged with: java

http://stackoverflow.com/comment/39163007
score: 3
has text: Can you explain - *doesn't work*?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25156337

http://stackoverflow.com/a/25160816
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25160723
has body: 1.Please try to clean,rebuild your project and than check for the error. 2.If still problem persists clean+restart your eclipse. 3.&lt;?xml version="1.0" encoding="UTF-8"?&gt; Change the version="1.1" I had similar issue and able to solve by cleaning the project.

http://stackoverflow.com/q/25153370
linked to: http://stackoverflow.com/q/18603372
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/25154129
has body: I'm battling at the moment in trying to understand how to approach this issue in an object-oriented way. With a many-to-many relationship such as Students-Subjects, where each student gets a mark for a certain subject, assuming the following: I want to be able to display all the marks for a given student. I want to display all the marks from different students for a given subject I want to be able to change any student's mark for a given subject. I have trouble with this last one, I can't seem to think of a way to relate the classes to each other so that the marks will remain congruent when changed... Here's what I was thinking about doing in pseudocode. Pretend we have 3 students each involved in 3 subjects (9 marks total): Make a class for Student (String name, int studNumber) Make a class for Subject (String name, int subNumber) Make a class for Result(int percentageScore String grade(calculated based on percentageScore)) Then have an array of arrays of Result objects, eg. [1][2] in the array will give the score for the student with studNumber 2 in the subject with subNumber 1. I feel like this isn't object-oriented? There should be some kind of acknoledgement of the relationship within the class design for subject and students. If that is indeed right, could anyone point me in the right direction? How does one do this in an object-oriented way? Thanks a lot.
favorite count: 0
answer count: 4
has answer: http://stackoverflow.com/a/25154627
has answer: http://stackoverflow.com/a/67470100
has title: The object-oriented approach to a many-to-many relationship
tagged with: java
accepted answer: http://stackoverflow.com/a/25154129
possible better answer: http://stackoverflow.com/a/25154627
type: Question
type: AnsweredQuestion
tagged with: oop
score: 4
tagged with: class
upvote count: 4
has answer: http://stackoverflow.com/a/25153587

http://stackoverflow.com/q/25111086
has title: List<Block> cannot be resolved
favorite count: 0
has answer: http://stackoverflow.com/a/25111270
upvote count: 1
tagged with: plugins
downvote count: 1
has comment: http://stackoverflow.com/comment/39079104
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25111270
answer count: 1
tagged with: minecraft
score: 0
has comment: http://stackoverflow.com/comment/39079261
has comment: http://stackoverflow.com/comment/39079086
has comment: http://stackoverflow.com/comment/39079259
has body: it says that 'block' cant be resolved even when i have it imported...i am using Eclipse else if (spawn.distance(loc) &gt; 11){ List&lt;Block&gt; blocks = UHCore.blocksBetweenPoints(player.getLocation().add(2, 2, 2), player.getLocation().subtract(2, 2, 2)); for (Block block : blocks); if (block.getType() != Material.AIR)continue; if (block.getLocation().distance(spawn)&gt;15){ block.getWorld().playEffect(block.getLocation(), Effect.MOBSPAWNER_FLAMES, 2); } }

http://stackoverflow.com/comment/39035929
type: Comment
comment on: http://stackoverflow.com/q/25087490
type: QuestionComment
score: 0
has text: It's probably an external library because the program that I run while getting this error is Samsung Link - but it's a java error that I get in a windows dialog with java icon so I thought that someone gere can help me understand what the error is.

http://stackoverflow.com/a/25453461
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25105546
type: Answer
upvote count: 0
has body: Netbeans support for scala seems pathetic so I just decided to jump to IntelliJ IDEA. It was little bit of learning curve but I'm glad I did because now everything was working (autocomplete, documentation, awesome SBT support etc. etc.)
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/25105546

http://stackoverflow.com/a/26034180
has comment: http://stackoverflow.com/comment/40810322
score: 5
upvote count: 5
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25117760
has body: You can insert text data into a orc table by such command: insert overwrite table orcTable select * from textTable; The first table is orcTable is created by the following command: create table orcTable(name string, city string) stored as orc; And the textTable is as the same structure as orcTable.
has comment: http://stackoverflow.com/comment/40780099

http://stackoverflow.com/comment/39004756
comment on: http://stackoverflow.com/q/25070975
has text: I'm stuck on step 3. It says add http://www.oracle.com/technetwork/java/javafx/downloads/index.html as the plug in site. The link says the page has been moved.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25173055
answer count: 1
type: UnansweredQuestion
has body: I have the following code: ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1, nameOfPool); scheduler.scheduleAtFixedRate (new Runnable() { @Override public void run() { if (someCondition) { return; } } }, 0L, 30, TimeUnit.MINUTES); Might be a dumb question, but does run() still get run every 30 minutes, even if I return; inside of the run() body, having met someCondition?
tagged with: java
has answer: http://stackoverflow.com/a/25173093
type: Question
has title: Java ScheduledExecutorService behavior?
score: 0

http://stackoverflow.com/q/25179300
tagged with: layout-manager
favorite count: 0
has body: I'm experiencing some Issues with GroupLayout. When disabling elements at runtime, manual gaping seems to be broken. There is a huge gap between elements that simply isn't there when using automatic gaps. Automatic gaps: labels enabled: labels 1-8 disabled: Manual gaps: labels enabled: labels 1-8 disabled: Is it a bug, or have I forgot some settings ? Here the according code: public class GroupLayoutTesting extends JFrame{ public static void main(String[] args) { new GroupLayoutTesting(); } public GroupLayoutTesting() { super(); this.getContentPane().setLayout(new BorderLayout()); this.setVisible(true); this.setSize(new Dimension(600,100)); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.getContentPane().add(getGroupLayouted()); } static JLabel[] labels = { new JLabel("Label 0"), new JLabel("Label 1"), new JLabel("Label 2"), new JLabel("Label 3"), new JLabel("Label 4"), new JLabel("Label 5"), new JLabel("Label 6"), new JLabel("Label 7"), new JLabel("Label 8"), new JLabel("Label 9") }; private Component getGroupLayouted() { JPanel panel = new JPanel(); GroupLayout layout = new GroupLayout(panel); //layout.setAutoCreateGaps(true); // &lt;- automatic gaps panel.setLayout(layout); JButton btn = new JButton("Light switch"); btn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { for(int i = 1; i&lt;9; i++){ labels[i].setVisible(!labels[i].isVisible()); } } }); SequentialGroup sequentialGroup = layout.createSequentialGroup(); layout.setHorizontalGroup(sequentialGroup); sequentialGroup.addComponent(btn); sequentialGroup.addPreferredGap(ComponentPlacement.UNRELATED,10,10); //&lt;- Manual gaps for(int i=0; i&lt;10; i++) { sequentialGroup.addComponent(labels[i]); sequentialGroup.addPreferredGap(ComponentPlacement.UNRELATED,10,10); //&lt;- Manual gaps } ParallelGroup parallelGroup = layout.createParallelGroup(); layout.setVerticalGroup(parallelGroup); parallelGroup.addComponent(btn); for(int i=0; i&lt;10; i++) { parallelGroup.addC…
has comment: http://stackoverflow.com/comment/39206421
has title: Group layout, bug/weird behaviour when using manual gaps
has answer: http://stackoverflow.com/a/25198932
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39207999
upvote count: 1
tagged with: swing
type: Question
tagged with: grouplayout
answer count: 2
tagged with: layout
downvote count: 0
has answer: http://stackoverflow.com/a/25181202

http://stackoverflow.com/comment/39095413
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25119307
has text: Here: https://netbeans.org/kb/docs/javaee/javaee-entapp-ejb.html
score: 0

http://stackoverflow.com/q/25204619
favorite count: 0
has body: I am working on a very simple spoj problem in which we have to take input N calculate its factorial then find out number of trailing zeros and display it some thing like Sample Input: 6 3 60 // fact of 60 has 14 trailing zeros 100 1024 23456 8735373 Sample Output: 0 14 24 253 5861 2183837 so i have written a code which is working fine on my machine but when i am submitting it is giving me time limit error. i don't know how to make this code fast. So i want suggestions from you guys. public class Factorial { public static void main(String[] args) throws IOException { try { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(bf.readLine()); for (int i = 0; i &lt; t; i++) { Long num = Long.parseLong(bf.readLine()); BigInteger bd = BigInteger.valueOf(num); System.out.println(countTrailinZeros(factorial(bd.toString()))); } } catch (IllegalStateException e) { return; } } public static BigInteger factorial(String n) { BigInteger x = BigInteger.valueOf(1); for (long i = 1; i &lt;= Integer.parseInt(n); i++) { x = x.multiply(BigInteger.valueOf(i)); } return x; } public static int countTrailinZeros(BigInteger bd) { String s = bd.toString(); int glen = s.length(); s = s.replaceAll("[0.]*$", ""); int llen = s.length(); return glen - llen; } } I have googled about some possible solutions and found out that lookup table may work i don't have much idea about this. I'd be very thankful if some can explain me about lookup table. edit: Could it be java is too slow to solve this problem in given time? or in general it is not favorable to use java for competitive programing?
has comment: http://stackoverflow.com/comment/39253480
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39253284
has answer: http://stackoverflow.com/a/71287755
upvote count: 0
tagged with: java
has title: Competitive Programing: Factorial Time limit exceeded
has comment: http://stackoverflow.com/comment/39253344
type: Question
has answer: http://stackoverflow.com/a/25205104
score: -2
has comment: http://stackoverflow.com/comment/39253223
has comment: http://stackoverflow.com/comment/39253897
downvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/62214201
has comment: http://stackoverflow.com/comment/39253124

http://stackoverflow.com/comment/39290561
comment on: http://stackoverflow.com/a/25224700
type: AnswerComment
has text: I'm sorry but I'm not sure that I've learned how to do what you suggested yet. Either that or I just didn't understand. Yeah I changed my code, I edited it in the post as well.
score: 0
type: Comment

http://stackoverflow.com/a/25154226
score: 0
has comment: http://stackoverflow.com/comment/39159316
answers question: http://stackoverflow.com/q/25154118
has comment: http://stackoverflow.com/comment/39159254
type: Answer
has body: Just try @Email annotation for email validation @NotEmpty annotation instead of @NotBlank for example: @NotEmpty @Email private String email; Read more...

http://stackoverflow.com/q/25228914
type: Question
tagged with: android
possible better answer: http://stackoverflow.com/a/25228985
tagged with: inner-classes
score: 0
has answer: http://stackoverflow.com/a/25228985
answer count: 2
accepted answer: http://stackoverflow.com/a/25228987
tagged with: java
type: AnsweredQuestion
has title: Java. Getting synchronous data in inner callback
has answer: http://stackoverflow.com/a/25228987
has body: I want the array of bytes that the android camera returns. As i expect to get it synchronously I am doing the code below waiting the callback to complete... but coming from c++ I guess there's something I don't get correctly. In my function I want to return an array of bytes provided in the callback. I've tries several combinations until this one that still has a problem. In the sameple below jpegCallback.jpgData gives "can not find symbol (the field jpgData)". (I am doing this on Qt but I think the problem is strictly related to java (and me)). Thanks for any insight. public static byte[] CameraTakePicture(){ final CountDownLatch jpgWaiter = new CountDownLatch(1); Camera.PictureCallback jpgCallback=new Camera.PictureCallback(){ public byte[] jpgData; @Override public void onPictureTaken(byte[] data,Camera cam){ jpgData=data; jpgWaiter.countDown(); } }; camera.takePicture(null,null,null,jpgCallback); jpgWaiter.await(); byte[] jpgData=jpgCallback.jpgData.clone(); return jpgData; }

http://stackoverflow.com/q/25112745
answer count: 2
has answer: http://stackoverflow.com/a/25113371
has title: Serialization Overwriting Data
score: 0
tagged with: serialization
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25113127
has comment: http://stackoverflow.com/comment/39082202
tagged with: linked-list
tagged with: java
has body: I have a program I'm making for a small business which is implementing serializable on a linkedList to save data. This all works fine, until I have two staff members try and add more data to the list and one ends up overwriting the other. JButton btnSaveClientFile = new JButton("Save Client File"); btnSaveClientFile.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { // add new items to list jobList.add(data); . . . Controller.saveData(); } }); btnSaveClientFile.setBounds(10, 229, 148, 23); frame.getContentPane().add(btnSaveClientFile); This method results in one overwriting the other, so I tried doing it like this JButton btnSaveClientFile = new JButton("Save Client File"); btnSaveClientFile.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { Controller.retrieveData(); // add new items to list jobList.add(data); . . . Controller.saveData(); } }); btnSaveClientFile.setBounds(10, 229, 148, 23); frame.getContentPane().add(btnSaveClientFile); And when I use this one, I get no data added to the list at all. Here are my Serialization methods. This one is used to save my data. // methods to serialize data public static void saveData() { System.out.println("Saving..."); FileOutputStream fos = null; ObjectOutputStream oos = null; try { fos = new FileOutputStream("Data.bin"); oos = new ObjectOutputStream(fos); oos.writeObject(myOLL); oos.close(); } catch (Exception ex) { ex.printStackTrace(); } } And this one is used to collect my data public static void retrieveData() { // Get data from disk System.out.println("Loading..."); FileInputStream fis = null; ObjectInputStream ois = null; try { fis = new FileInputStream("Data.bin"); ois = new ObjectInputStream(fis); myOLL = (OrderedLinkedList) ois.readObject(); ois.close(); } catch (Exception ex) { System.err.println("File cannot be found"); ex.printStackTrace(); } } How do I make it so I can save data to my file from two different computers at a simil…
type: Question

http://stackoverflow.com/comment/39159562
type: Comment
comment on: http://stackoverflow.com/a/25140248
has text: Please paste your html.html out.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39297273
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25228312
has text: This is a question about the Java language definition and rationale for why the language has a particular characteristic. This forum is used primarily for application of a language, not a meta discussion of the language definition. You need to find another place for such a discussion in order to get satisfactory answers or comments.
score: 0

http://stackoverflow.com/comment/39191627
comment on: http://stackoverflow.com/q/25171227
score: 0
has text: A popular, light weight http server is http://www.eclipse.org/jetty/.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25127240
answer count: 2
has comment: http://stackoverflow.com/comment/39109485
has comment: http://stackoverflow.com/comment/39109665
accepted answer: http://stackoverflow.com/a/25127288
has title: Pass a class parameter and return an object of that class (java)
score: 0
tagged with: generics
possible better answer: http://stackoverflow.com/a/25127292
has answer: http://stackoverflow.com/a/25127292
has body: I have a public method. The public method is declared as public Object createUIBean(Class c, HttpServletRequest request) { Object o = c.newInstance() ; setRequestParams(o, request) ; return o ; } // try catch block omitted for reasons of brevity When calling this method, I have to cast the return result. Is there way I can write this method so I do not need to cast the returned object.
has answer: http://stackoverflow.com/a/25127288
type: AnsweredQuestion
tagged with: reflection
tagged with: java
type: Question

foreground
type: Tag
tags question: http://stackoverflow.com/q/25078722
tag name: foreground

http://stackoverflow.com/a/25291716
answers question: http://stackoverflow.com/q/25110647
type: AcceptedAnswer
downvote count: 0
has body: java.awt.Component is the superclass of any class that can be drawn on screen. In this class you can see how really a Pixel is drawn on screen. There is a method in this class i.e. public void repaint(long tm, int x, int y, int width, int height). In this function you have to look at 3403'th line to understand how it works. It instantiate a PaintEvent for this. PaintEvent e = new PaintEvent(this, PaintEvent.UPDATE, new Rectangle(x, y, width, height)) where constructor for PaintEvent is PaintEvent(Component source, int id, Rectangle updateRect). There is another line Toolkit.getEventQueue().postEvent(e). Toolkit gets the EventQueue of system, and adds a PaintEvent into it. EventQueue keep the track of all Events in a queue and fires them accordingly. PaintEvent is the event to draw a rectangle on screen.
has comment: http://stackoverflow.com/comment/39416825
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/39417737
has comment: http://stackoverflow.com/comment/39417167
has comment: http://stackoverflow.com/comment/39416625
upvote count: 3
has comment: http://stackoverflow.com/comment/39417086
accepted answer of: http://stackoverflow.com/q/25110647
has comment: http://stackoverflow.com/comment/39417443

http://stackoverflow.com/comment/39160624
has text: "We use the `sun.nio.ch.FileChannelImpl.map` ...". You shouldn't. You should use `java.nio.channels.FileChannel.map().`
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25154768

http://stackoverflow.com/q/25213350
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25213595
has title: How to compile Java code without an IDE?
type: Question
has comment: http://stackoverflow.com/comment/39270067
has answer: http://stackoverflow.com/a/25213372
tagged with: development-environment
answer count: 2
upvote count: 1
tagged with: ide
favorite count: 0
type: UnansweredQuestion
tagged with: editor
downvote count: 0
has body: I am a beginning programmer that has been using an IDE to learn to code. However I want to try using a text editor to see which one I would like more. My question is, once you download a text editor, what tools do you need to compile and run a program and how do you set them up?

xpath
tags question: http://stackoverflow.com/q/25115965
tags question: http://stackoverflow.com/q/25153865
tags question: http://stackoverflow.com/q/25119734
tag name: xpath
tags question: http://stackoverflow.com/q/25181591
tags question: http://stackoverflow.com/q/25132605
tags question: http://stackoverflow.com/q/25171186
tags question: http://stackoverflow.com/q/25163328
tags question: http://stackoverflow.com/q/25103145
tags question: http://stackoverflow.com/q/25198208
type: Tag
tags question: http://stackoverflow.com/q/25118451
tags question: http://stackoverflow.com/q/25227223
tags question: http://stackoverflow.com/q/25078991
tags question: http://stackoverflow.com/q/25222663

http://stackoverflow.com/comment/39174917
score: 0
type: AnswerComment
type: Comment
has text: So, you say there is no way I can get the user to directly communicate with the spring-based server, which mediates the communication with the GWT client, because one should want the GWT client deployed at the user's? Obviously I still have JSON being exchanged with the spring-based server when invoking the REST APIs.
comment on: http://stackoverflow.com/a/25145948

http://stackoverflow.com/q/25200511
upvote count: 1
has comment: http://stackoverflow.com/comment/39245193
has answer: http://stackoverflow.com/a/25201065
accepted answer: http://stackoverflow.com/a/25201065
favorite count: 0
has comment: http://stackoverflow.com/comment/39245206
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25200667
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39247225
has body: I am trying to add a maven repository mvnrepository.com, but it seems that I fail doing this. mvnrepository http://mvnrepository.com/artifact/ I can clearly see that the artifact I am looking for is there http://mvnrepository.com/artifact/org.springframework.ldap/spring-ldap/1.3.1.RELEASE But my maven build output reports me that it's not Downloading: http://mvnrepository.com/artifact//org/springframework/ldap/spring-ldap/1.3.1.RELEASE/spring-ldap-1.3.1.RELEASE.jar [INFO] Unable to find resource 'org.springframework.ldap:spring-ldap:jar:1.3.1.RELEASE' in repository mvnrepository (http://mvnrepository.com/artifact/) What am I doing wrong? How can I download spring ldap artifact? UPDATE I have tried several artifactories, but all of them fail Downloading: http://repo1.maven.org/maven2//org/springframework/ldap/spring-ldap/1.3.1.RELEASE/spring-ldap-1.3.1.RELEASE.jar [INFO] Unable to find resource 'org.springframework.ldap:spring-ldap:jar:1.3.1.RELEASE' in repository maven central repo (http://repo1.maven.org/maven2/) Downloading: http://download.java.net/maven/2//org/springframework/ldap/spring-ldap/1.3.1.RELEASE/spring-ldap-1.3.1.RELEASE.jar [INFO] Unable to find resource 'org.springframework.ldap:spring-ldap:jar:1.3.1.RELEASE' in repository java.net repo (http://download.java.net/maven/2/) Downloading: http://maven.springframework.org/external//org/springframework/ldap/spring-ldap/1.3.1.RELEASE/spring-ldap-1.3.1.RELEASE.jar [INFO] Unable to find resource 'org.springframework.ldap:spring-ldap:jar:1.3.1.RELEASE' in repository spring external (http://maven.springframework.org/external/) Downloading: http://search.maven.org//org/springframework/ldap/spring-ldap/1.3.1.RELEASE/spring-ldap-1.3.1.RELEASE.jar [INFO] Unable to find resource 'org.springframework.ldap:spring-ldap:jar:1.3.1.RELEASE' in repository repo.jenkins-ci.org (http://search.maven.org/) Downloading: https://repository.jboss.org//org/springframework/ldap/spring-ldap/1.3.1.RELEASE/spring-ldap-1.3.1.RELEASE.ja…
tagged with: maven
has title: Maven repo does not work
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25202006
linked to: http://stackoverflow.com/q/6625752
answer count: 3
possible better answer: http://stackoverflow.com/a/25202006

http://stackoverflow.com/comment/39116109
comment on: http://stackoverflow.com/a/25130269
score: 0
type: AnswerComment
has text: Thanks for your suggestions, but unfortunately the problem persist. Maybe the issues resolves around my XML (included in my initial post).
type: Comment

http://stackoverflow.com/a/25176136
score: 0
answers question: http://stackoverflow.com/q/25170036
type: Answer
has body: One of the prominent examples is the repo of OGC Schemas. Since these are schemas we frequently use, we've compiled them in reusable maven artifacts. I would say, you need both a schema repository as well as - if you're using JAXB - a repository of compiled schemas. Just having JAXB compilations limits you just to one technology which is not advisable. Maybe yo'll need to employ other languages than Java (or environments which don't have adequate JAXB). Or you may also have schemas where application of JAXB is not adequate. At the same time it is reasonable to provide standard compilations of schemas. Mostly it's sufficient and you don't need to recompile them in individual projects. However in some technology stacks (speaking SOA) you can't reuse these artifacts.

http://stackoverflow.com/q/25178582
has title: OSGi noClassDefFound for java.nio.files.FileSystems$DefaultFileSystemHolder
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39209335
score: 1
accepted answer: http://stackoverflow.com/a/25183970
tagged with: java
tagged with: maven
upvote count: 1
has comment: http://stackoverflow.com/comment/39213661
type: Question
has comment: http://stackoverflow.com/comment/39212952
has body: in our application, we're using ini files for the configuration of our OSGi apps. Now I thought about adding a WatchService to detect changes and reload the modified file if necessary. I found multiple tutorials so far. Most of them are similar and result in something like the following: http://java.dzone.com/news/how-watch-file-system-changes. I adopted it like this: 36: public Ini(final File file) throws IOException { if (!file.exists()) { throw new IOException("Ini-File does not exist."); } else if (!file.canRead()) { 40: throw new IOException("Ini-File is not readable."); } iniFile = file; FileSystem fileSystem = FileSystems.getFileSystem(file.toURI()); 45: Path test = fileSystem.getPath(file.getAbsolutePath()); Path ini = FileSystems.getDefault().getPath(file.getParent(), file.getName()); Logger.debug(ini.toString()); readIni(ini); 50: service = FileSystems.getDefault().newWatchService(); file.getParentFile().toPath().register(service, ENTRY_MODIFY); Thread watcher = new Thread(() -&gt; { // noinspection InfiniteLoopStatement 55: while (true) { WatchKey key = null; try { key = service.take(); for (WatchEvent&lt;?&gt; event : key.pollEvents()) { 60: Logger.debug("event received"); if (event.kind() != ENTRY_MODIFY) { continue; } WatchEvent&lt;Path&gt; ev = (WatchEvent&lt;Path&gt;) event; 65: File filename = ev.context().toFile(); if (filename.getAbsolutePath().equals(iniFile.getAbsolutePath())) { Logger.debug(filename.getName() + " has changed"); 70: config = new HashMap&lt;&gt;(); try { readIni(filename.toPath()); } catch(IOException e) { Logger.warning(e); 75: } } } } catch (Exception e) { Logger.warning(e); 80: } if (key != null) key.reset(); } }); 85: watcher.start(); } When creating a new instance, I first check whether the file exist or not. After this, I want to create a WatchService profiling this config file (at first only this one. Later I will change to 1 WatchService for all loaded files). There are several lines (44 - 46) doing the same in different …
has comment: http://stackoverflow.com/comment/39207961
has comment: http://stackoverflow.com/comment/39209923
tagged with: filesystemwatcher
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25183970
has comment: http://stackoverflow.com/comment/39209957
favorite count: 0
tagged with: osgi

http://stackoverflow.com/comment/39202798
score: 0
type: QuestionComment
has text: what I know is that the .class file of the FacebookException class is not getting generated in the generated jar file. But I am not understanding why only for the Facebook Exception class it is happening.
type: Comment
comment on: http://stackoverflow.com/q/25177813

testng
tags question: http://stackoverflow.com/q/25084552
tags question: http://stackoverflow.com/q/25172360
tags question: http://stackoverflow.com/q/25114666
tags question: http://stackoverflow.com/q/25132539
tags question: http://stackoverflow.com/q/25161075
tags question: http://stackoverflow.com/q/25126734
tags question: http://stackoverflow.com/q/25163853
tag name: testng
tags question: http://stackoverflow.com/q/25119282
tags question: http://stackoverflow.com/q/25136870
tags question: http://stackoverflow.com/q/25087257
tags question: http://stackoverflow.com/q/25197134
tags question: http://stackoverflow.com/q/25161987
type: Tag
tags question: http://stackoverflow.com/q/25144489
tags question: http://stackoverflow.com/q/25194578

http://stackoverflow.com/a/25115358
upvote count: 3
downvote count: 1
answers question: http://stackoverflow.com/q/25114526
type: Answer
has body: The Log4j2 FAQ page has an example that uses the RoutingAppender to achieve this.
has comment: http://stackoverflow.com/comment/65449133
score: 2
has comment: http://stackoverflow.com/comment/65049342
has comment: http://stackoverflow.com/comment/65444852
has comment: http://stackoverflow.com/comment/39105550
has comment: http://stackoverflow.com/comment/65444584

http://stackoverflow.com/comment/39070943
type: QuestionComment
has text: Render *what* in iFrame form? The server worlds? The console?
comment on: http://stackoverflow.com/q/25080554
score: 0
type: Comment

http://stackoverflow.com/q/25168481
has title: MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 110; timeout -1;
has answer: http://stackoverflow.com/a/48578282
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
score: 3
tagged with: network-programming
has answer: http://stackoverflow.com/a/25168551
tagged with: jakarta-mail
answer count: 2
downvote count: 0
favorite count: 0
has body: I'm trying to read messages from my inbox, but I'm keep getting exception "MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 110; timeout -1;" I disabled my AntiVir and Firewall, but doesn't help. Below is code and console report: public class JavaMailPOP3eMail { private String server = null; private String user = null; private String pass = null; public void sendMail() { server = "smtp.gmail.com"; user = "user123@gmail.com"; pass = "pass123"; Store store = null; Folder folder = null; try { // get default session Properties properties = System.getProperties(); Session session = Session.getDefaultInstance(properties, null); session.setDebug(true); // get a pop3 message store, and connect to it store = session.getStore("pop3"); store.connect(server, user, pass); // get the default folder folder = store.getDefaultFolder(); if (folder == null) { throw new Exception("No default folder"); } // get the inbox folder = folder.getFolder("INBOX"); if (folder == null) { throw new Exception("No POP3 INBOX"); } // open the folder read only folder.open(Folder.READ_ONLY); // get the messages and print them Message[] messages = folder.getMessages(); for (int i = 0; i &lt; messages.length; i++) { printMail(messages[i]); } } catch (Exception e) { e.printStackTrace(); } finally { try { if (folder != null) { folder.close(false); } if (store != null) { store.close(); } } catch (MessagingException ex) { ex.printStackTrace(); } } } public void printMail(Message message) { try { // get header information String from = null; from = ((InternetAddress) message.getFrom()[0]).getPersonal(); // print sender details System.out.println("From: " + from); // get and print subject String subj = message.getSubject(); System.out.println("Subject: " + subj); // get the message itself Part messagePart = message; Object content = messagePart.getContent(); if (content instanceof Multipart) { messagePart = ((Multipart) content).getBodyPart(0); System.out.println("[ Multipart Message ]"); …
accepted answer: http://stackoverflow.com/a/25168551
possible better answer: http://stackoverflow.com/a/48578282

http://stackoverflow.com/comment/39155889
has text: the ((str.indexOf(substr, i)) != -1) part of the loop, I don't quite how it processes. I only know it is a condition for the loop to start and end.
comment on: http://stackoverflow.com/q/25152325
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25092935
type: Answer
score: 1
has body: The reason for NullPointer is because the value of Graphics object is null. You need to get the Grpahics object. There are a number of ways to get it. If you want to draw the line on an image you can get it from createGraphics() method.
answers question: http://stackoverflow.com/q/25092904
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25112349
has title: What script is this?
has comment: http://stackoverflow.com/comment/39081543
type: UnansweredQuestion
tagged with: swt
has answer: http://stackoverflow.com/a/25112362
has body: I am developing a java application using SWT. It has a browser embeded in it.I have to add copy,selectall,find functions to this app.I have used this script to implement copy function final String SCRIPT01 = "var html = \"\";"+ "if (typeof window.getSelection != \"undefined\") {"+ "var sel = window.getSelection();"+ "if (sel.rangeCount) {"+ "var container = document.createElement(\"div\");"+ "for (var i = 0, len = sel.rangeCount; i &lt; len; ++i) {"+ "container.appendChild(sel.getRangeAt(i).cloneContents());"+ "}"+ "html = container.innerHTML;"+ "}"+ "} else if (typeof document.selection != \"undefined\") {"+ "if (document.selection.type == \"Text\") {"+ "html = document.selection.createRange().htmlText;"+ "}" + "}" + "return html"; I actually found this code on SO and i have no idea what this is.But it worked for me.Can anyone tell what script it is.I thought it was javascript but i think im wrong and any links to tutorials of this script will be very useful.I want to learn this script and see if i can use it to implement "select all" and "find" functions.
linked to: http://stackoverflow.com/q/26417811
tagged with: java
type: Question
score: 0
answer count: 1

http://stackoverflow.com/comment/39231733
type: AnswerComment
comment on: http://stackoverflow.com/a/25193070
type: Comment
has text: You should read polymorphism and typecasting in java , there is nothing unusual happening in Android.
score: 0

http://stackoverflow.com/q/25130475
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/39126990
has body: I am new to jax-rs and dependency injection, in my application I have a situation where a class uses a DAO object. I have an interface for the DAO and an implementation. I am trying to inject the DAO object inside this class BusinessLogic using @Context in jax-rs. Ex: Class BusinessLogic{ @Context BackDAO backDAO; public void doSomethig(){ backDAO.doSome().... } } where BackDAO is the interface and its implementation is BackDAOImpl. I want to know how to inject BackDAOImpl object instance here or is it possible to inject User-defined classes using @Context, because as far as my research I think @Context is used on ServletConfig, ServletContext, HttpServletRequest and HttpServletResponse. I don't want to do this with any frameworks and also without using @Inject, is it possible? I tried many links at stack-overflow and the javadocs didn't have any good examples. Where do @Context objects come from
has title: @Context Dependency Injection
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10897933
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39134797
type: Question
tagged with: jakarta-ee
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/39149937
has comment: http://stackoverflow.com/comment/39148903
score: 0

http://stackoverflow.com/q/25149833
has comment: http://stackoverflow.com/comment/39232995
favorite count: 0
has answer: http://stackoverflow.com/a/26581003
has title: How to use my own Iterable in Play Framework template
tagged with: scala
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/45140756
upvote count: 1
tagged with: twirl
has body: Problem in a Nutshell I cannot iterate over a lightly wrapped collection in a Play! Framework template. I made the assumption that simply implementing the Iterable interface would enable me to use for-each loops in the templates, but that seems to be incorrect. How can I get this working? What I Did I created a simple wrapper class around java.util.Queue. I made the assumption that implementing Iterable would allow me to use a for-each loop in a Play! Framework template. public class DecisionQueue implements Iterable&lt;Decision&gt; { Queue&lt;Decision&gt; decisions; public DecisionQueue() { decisions = new LinkedList&lt;Decision&gt;(); } // redacted methods for manipulating the queue @Override public Iterator&lt;Decision&gt; iterator() { return decisions.iterator(); } } I provided an instance of the wrapper to a template. public static Result getFormOutput() { DecisionQueue decisionQueue = getDecisionQueue(); return ok(views.html.questionnaire.output.render(decisionQueue)); } I attempted to iterate over the wrapper in my template. @(decisionQueue: data.DecisionQueue) &lt;ul&gt; @for(decision &lt;- decisionQueue) // Problem here // redacted } &lt;/ul&gt; I got the following stack trace during compilation. [error] C:\...\app\views\questionnaire\output.scala.html:12: type mismatch; [error] found : decisionQueue.type (with underlying type models.data.DecisionQueue) [error] required: ?{def map(x$1: ? &gt;: &lt;error&gt; =&gt; play.twirl.api.HtmlFormat.Appendable): ?} [error] (which expands to) ?{def map(x$1: ? &gt;: &lt;error&gt; =&gt; play.twirl.api.Html): ?} [error] Note that implicit conversions are not applicable because they are ambiguous: [error] both method javaCollectionToScala in object TemplateMagic of type [T](x: Iterable[T])Iterable[T] [error] and method iterableAsScalaIterable in trait WrapAsScala of type [A](i: Iterable[A])Iterable[A] [error] are possible conversion functions from decisionQueue.type to ?{def map(x$1: ? &gt;: &lt;error&gt; =&gt; play.twirl.…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39232320
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39212848
downvote count: 0
tagged with: playframework

http://stackoverflow.com/q/25174345
type: Question
tagged with: jersey
has title: Jersey on google app engine
score: 0
tagged with: api
answer count: 1
tagged with: rest
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/25183778
has body: We have an AppEngine app with that we would like to use with Google Endpoints. We need to support mobile clients so is it necessary to use jersey framework for developing backend API's?
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/39014950
comment on: http://stackoverflow.com/a/25076473
score: 0
type: AnswerComment
has text: Yeah im not familiar with that so my questions sound childish
type: Comment

http://stackoverflow.com/a/32515882
answers question: http://stackoverflow.com/q/25141487
score: 2
downvote count: 0
has body: Ref the below Spring documentation (para 2) - To enable AspectJ annotation support in the Spring IoC container, you only have to define an empty XML element aop:aspectj-autoproxy in your bean configuration file. Then, Spring will automatically create proxies for any of your beans that are matched by your AspectJ aspects. For cases in which interfaces are not available or not used in an application’s design, it’s possible to create proxies by relying on CGLIB. To enable CGLIB, you need to set the attribute proxy-targetclass= true in aop:aspectj-autoproxy. In case your class implements an interface, a JDK dynamic proxy will be used. However if your class does not implement any interfaces then a CGLIB proxy will be created. You can achieve this @EnableAspectJAutoProxy. Here is the sample @Configuration @EnableAspectJAutoProxy public class AppConfig { @Bean public LoggingAspect logingAspect(){ return new LoggingAspect(); } } @Component @Aspect public class LoggingAspect { ... ... }
upvote count: 2
type: Answer

http://stackoverflow.com/a/25167302
has comment: http://stackoverflow.com/comment/39183953
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39183883
type: Answer
has comment: http://stackoverflow.com/comment/39183976
has comment: http://stackoverflow.com/comment/39183903
has body: collections.Counter is a very handy tool and worth learning about when you start using python. from collections import Counter inp = input("Enter letters") # input() if using python 3 l = len(inp.strip()) # get length of input string ,inp.strip() removes any whitespace, just use len(inp) if you want to include c = Counter(inp) for char in c: c[char] = c[char] * 100 / l # don't need to cast as float for python 3 print (c) Counter({'C': 30.0, 'G': 30.0, 'A': 20.0, 'T': 20.0}) There is a module csv that has a DictWriter that will be able to write the data to file.
accepted answer of: http://stackoverflow.com/q/25167176
has comment: http://stackoverflow.com/comment/39183819
has comment: http://stackoverflow.com/comment/39183834
answers question: http://stackoverflow.com/q/25167176

http://stackoverflow.com/q/25140343
tagged with: constructor
upvote count: 3
downvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/39133305
has comment: http://stackoverflow.com/comment/39133327
has answer: http://stackoverflow.com/a/25140512
linked to: http://stackoverflow.com/q/13982345
has title: Why is a no-args constructor not always inserted by compiler?
tagged with: java
has comment: http://stackoverflow.com/comment/39133312
has comment: http://stackoverflow.com/comment/39133344
score: 0
has answer: http://stackoverflow.com/a/25140529
accepted answer: http://stackoverflow.com/a/25140529
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/39133654
possible better answer: http://stackoverflow.com/a/25140512
has body: The java compiler automatically inserts a no-args constructor if the programmer provides no constructor. However, if an argumented constructor exists, then the compiler does not insert a no-args constructor. My question is why? Doesn't it make sense for the compiler to insert a no-args constructor (if it doesn't exist) to EVERY class that is NOT final?
type: AnsweredQuestion

http://stackoverflow.com/comment/39079710
score: 0
comment on: http://stackoverflow.com/q/25110588
type: Comment
type: QuestionComment
has text: 1) *"requires a text field for the user to enter the width of an ellipse.."* Offer a `JSpinner` with a `SpinnerNumberModel` instead. 2) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal, Complete, Verifiable Example).

http://stackoverflow.com/comment/39136180
type: QuestionComment
has text: can you explain what you have done in if (playIntent == null){} section, I think you bind to service and then startService that is your service now has a bounded component and also it has been called by startService which makes unbounded service.
comment on: http://stackoverflow.com/q/25141194
score: 0
type: Comment

http://stackoverflow.com/comment/39178022
has text: clean your project and it'll be fine.. don't forget the mark the answer
type: AnswerComment
comment on: http://stackoverflow.com/a/25164034
score: 0
type: Comment

spring-transactions
tags question: http://stackoverflow.com/q/25222341
type: Tag
tag name: spring-transactions

http://stackoverflow.com/comment/39075027
type: Comment
type: QuestionComment
has text: Maybe try creating a temporary thread or two extra? Then stop them when operation is done?
score: 1
comment on: http://stackoverflow.com/q/25108966

error-messaging
type: Tag
tags question: http://stackoverflow.com/q/25123990
tag name: error-messaging

alarm
tags question: http://stackoverflow.com/q/25134468
tag name: alarm
tags question: http://stackoverflow.com/q/25132325
type: Tag

http://stackoverflow.com/a/35256610
has comment: http://stackoverflow.com/comment/58225987
downvote count: 0
has comment: http://stackoverflow.com/comment/58341726
has comment: http://stackoverflow.com/comment/58227083
type: Answer
upvote count: 1
has body: I also just started with java and with this book, and this is the code that did the tric for me. Forgive me if i did something strange... :) import java.util.Scanner; public class SeparateNumber { public static void main(String[] args) { Scanner in = new Scanner(System.in); int nr, nr1, nr2, nr3, nr4, nr5; System.out.print("Enter a number with 5 digits: "); nr = in.nextInt(); nr1 = nr / 10000; nr2 = (nr % 10000) / 1000; nr3 = ((nr % 10000) % 1000) / 100; nr4 = (((nr % 10000) % 1000) % 100) / 10; nr5 = (((nr % 10000) % 1000) % 100) % 10; System.out.printf("%d%s%d%s%d%s%d%s%d%n", nr1, " ", nr2, " ", nr3, " ", nr4, " ", nr5); } }
answers question: http://stackoverflow.com/q/25204481
score: 1

http://stackoverflow.com/a/25182632
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39295804
type: Answer
has comment: http://stackoverflow.com/comment/39295288
accepted answer of: http://stackoverflow.com/q/25179548
has body: When you write EL(Expression Language) in your .jsp file, that .jsp file is parse by its JSP container and EL are processed. Consider the following code : anyfile.jsp &lt;script type="text/javascript"&gt; function testJs() { alert("${testString}"); // JSP Container will replace '${testString}' with its value } &lt;/script&gt; JSP container did not processed any of the above code Except EL, and therefore only ${testingString} is replaced. I mean, container do not know about &lt;script&gt; or function testJs(). JSP container will only process the files with .jsp (or .jspx, or some other files) extension. In the above code your javascript was inside .jsp file. But on the other hand, when you replaced above code with this - &lt;script src="resource/js/test.js" &gt;&lt;/script&gt; Now the previous code is inside test.js file. But how container can know about that! You are expecting JSP container to understand this code i.e. to understand that test.js is added as javascript in the .jsp file by using &lt;script&gt; element and src attribute. But it didn't. Container actually not have to do anything with this code. And your code will be sent to client without any changes. But if you stills want to use your javascript code to work from other file, you can use following code : anyfile.jsp &lt;script type="text/javascript"&gt; &lt;jsp:include page="test.jsp" /&gt; &lt;/script&gt; And test.jsp &lt;%@page contentType="text/javascript" pageEncoding="UTF-8"%&gt; function go() { alert("${testString}"); }
has comment: http://stackoverflow.com/comment/39295490
answers question: http://stackoverflow.com/q/25179548
has comment: http://stackoverflow.com/comment/39295334
has comment: http://stackoverflow.com/comment/39295617
has comment: http://stackoverflow.com/comment/39295852
score: 0

http://stackoverflow.com/q/25115677
tagged with: android-asynctask
has body: When my Android app is starting up needs to load a lot of data from the database during onCreate in the firstly loaded activity. I would like to show a ProgressDialog for that. ProgressDialog however can't be shown in the main thread, so one must use AsyncTask or new Thread. But that also means, that the activity continues to be initialized as the main thread goes on. Basically, I need to show the ProgressDialog or a kind of its equivalent while processing in the main thread (not in AsyncTask). Is there a way to do it?
tagged with: multithreading
tagged with: android
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25115766
has answer: http://stackoverflow.com/a/25115885
tagged with: java
has title: Suspend Android app's main thread while showing the ProgressDialog
has answer: http://stackoverflow.com/a/25115784
possible better answer: http://stackoverflow.com/a/25115766
type: Question
accepted answer: http://stackoverflow.com/a/25115885
has answer: http://stackoverflow.com/a/25115873
score: 0

http://stackoverflow.com/q/25128128
has comment: http://stackoverflow.com/comment/39112522
has comment: http://stackoverflow.com/comment/39112313
has body: Please Note: I created a post earlier that had this question along with several others, but was told that since I was asking so many questions in the same post, it'd be better to break it up into individual questions. So please do not mark this as a duplicate, yes the instructions are the same and yes the same code is being used, but the question itself is different. Thanks. I'm working on a program with the following instructions: Write a class named Octagon that extends GeometricObject and implements the Comparable and Cloneable interfaces. Assume that all 8 sides of the octagon are of equal size. The area can be computed using the following formula area = (2 + 4/square root of 2) * side * side Write a program (driver) to read in a series of values from a file, display the area and perimeter, create a clone and compare the object and its clone (based on the area). In addition, your program should compare the current object (just read in) with the first object read in. The program ends when a negative number is read from the file. Here is the code I have so far, This is my GeometricObject Class: public abstract class GeometricObject { public abstract double getArea(); public abstract double getPerimeter(); } My Octagon class: public class Octagon extends GeometricObject implements Comparable&lt;Octagon&gt; { private double side = 1.0; protected native Object clone() throws CloneNotSupportedException; private static int numberOfObjects = 0; public Octagon() { } public Octagon(double side) { this.side = side; numberOfObjects++; } public double getSide() { return side; } public void setSide(double side) { this.side = side; } public double getArea() { return (2 + (4 / (Math.sqrt(2))) * side * side); } public double getPerimeter() { return side * 8; } public String toString() { return "Octagon " + numCreated + ": Area: " + getArea() + "\nPerimeter: " + getPerimeter() + "\nClone Compare: " + Cloneable + "\nFirst Compare: " + comparisson; } public int compareTo(Octagon oc…
accepted answer: http://stackoverflow.com/a/25128521
has title: Remembering First Value Read in From a File in Java
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39112450
tagged with: java
has comment: http://stackoverflow.com/comment/39111856
has comment: http://stackoverflow.com/comment/39112353
tagged with: file
has answer: http://stackoverflow.com/a/25128521
has comment: http://stackoverflow.com/comment/39112297
type: Question
has comment: http://stackoverflow.com/comment/39111906
has comment: http://stackoverflow.com/comment/39111572
has comment: http://stackoverflow.com/comment/39112474
has comment: http://stackoverflow.com/comment/39112505
upvote count: 1
has comment: http://stackoverflow.com/comment/39112172
has comment: http://stackoverflow.com/comment/39112186
answer count: 1
favorite count: 0

http://stackoverflow.com/q/25160297
accepted answer: http://stackoverflow.com/a/25160339
has body: I am making a quartz thread application that is collect data from a table and insert it in another table after inserting it is updating the data base but when i got the above error i got some of the data inserted twice in the table Note that : 1.I use Oracle DB 2.**OJDBC6.jar to connect** 3.all tables are in same schema StackTrace: java.sql.SQLException: Connection is closed. at org.apache.commons.dbcp.PoolingDriver$PoolGuardConnectionWrapper.checkOpen(PoolingDriver.java:263) at org.apache.commons.dbcp.PoolingDriver$PoolGuardConnectionWrapper.close(PoolingDriver.java:268) at com.sender.gsm.dao.Dao.closeConnection(Dao.java:38) at com.sender.gsm.dao.OutDataDao.insertData(OutDataDao.java:91) at com.sender.gsm.jobs.DataHandler.execute(DataHandler.java:49) at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) The close connection function is public void closeConnection(Connection conn) throws SQLException { if (conn != null ) { conn.close(); } }
type: Question
has answer: http://stackoverflow.com/a/25160339
score: 4
upvote count: 4
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39170009
favorite count: 0
tagged with: ojdbc
tagged with: oracle-database
type: AnsweredQuestion
has title: java.sql.SQLException: Connection is closed
tagged with: java

http://stackoverflow.com/a/25099546
has comment: http://stackoverflow.com/comment/39057606
has body: Go to json.org and study the syntax carefully. A key or string value in JSON must be enclosed in double quotes. Your code is generating {'Hobbies' : Programming &amp; Gaming} To do it the way you're doing it you need to escape the double quotes: new JSONObject("{\"Hobbies\":\"" + h + "\"}"); However, it would be far better to construct a JSONObject out of separate key and value. I'm not sure which specific Java JSON package you're using, but for most this would be simply: new JSONObject("Hobbies", h);
has comment: http://stackoverflow.com/comment/39057536
has comment: http://stackoverflow.com/comment/39057516
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25099498
answers question: http://stackoverflow.com/q/25099498
has comment: http://stackoverflow.com/comment/39057476
has comment: http://stackoverflow.com/comment/39057577
type: Answer
has comment: http://stackoverflow.com/comment/39057818
has comment: http://stackoverflow.com/comment/39058450
upvote count: 1
has comment: http://stackoverflow.com/comment/39057609

http://stackoverflow.com/a/25204121
has body: Use the Seconds class DateTime now = DateTime.now(); DateTime dateTime = now.plusMinutes(10); Seconds seconds = Seconds.secondsBetween(now, dateTime); System.out.println(seconds.getSeconds()); EDIT: Int type ranges from –2,147,483,648 to 2,147,483,647. Your value give you something like 3,565,987,200. So this method will not work for you Workaround: Date d1 = ...; Date d2 = ...; long seconds = (d2.getTime()-d1.getTime())/1000;
downvote count: 3
has comment: http://stackoverflow.com/comment/39251733
score: -2
answers question: http://stackoverflow.com/q/25204043
type: Answer
has comment: http://stackoverflow.com/comment/39252360
upvote count: 1

http://stackoverflow.com/a/25193481
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/25193227
type: Answer
has body: It looks like you want a menu with custom CSS and a TabPane underneath it, below I show you an example made with FXML. <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <MenuItem mnemonicParsing="false" text="Action 1" /> <MenuItem mnemonicParsing="false" text="Action 2" /> <MenuItem mnemonicParsing="false" text="Action 1" /> <MenuItem mnemonicParsing="false" text="Action 2" /> <MenuItem mnemonicParsing="false" text="Action 1" /> <MenuItem mnemonicParsing="false" text="Action 2" /> <Separator layoutX="2.0" layoutY="24.0" prefHeight="5.0" prefWidth="590.0" /> <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" /> <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" /> <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
has comment: http://stackoverflow.com/comment/39233255
has comment: http://stackoverflow.com/comment/39233009

http://stackoverflow.com/comment/39063746
type: Comment
comment on: http://stackoverflow.com/a/25102764
type: AnswerComment
has text: Also keep in mind to use a 64bit version of Eclipse on MacOS (http://www.eclipse.org/downloads/?osType=macosx) when using a 64bit JDK Installation
score: 0

http://stackoverflow.com/a/25217516
answers question: http://stackoverflow.com/q/25217432
score: 3
has comment: http://stackoverflow.com/comment/39278501
has comment: http://stackoverflow.com/comment/39278436
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39278266
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/39277526
has body: The answers I feel that might be correct are, abc123 and 123abc Well no, Lets have a look at what you are doing. public static synchronized void say(String s) { System.out.print(s); } The above code specifies that only one thread can execute this method at a time. When one thread finishes its say() , any other thread can execute it. Now, Thread letters = new Thread() { public void run() { say("a"); say("b"); say("c"); } }; Thread numbers = new Thread() { public void run() { say("1"); say("2"); say("3"); } }; Creates 2 threads, The important thing to be noted is say("a") , say("b") and say("c") aren't guaranteed to be executed consecutively. They run in the same thread but they are not guaranteed to be executed one after another. When say("a") finishes, thread letters might pause and thread numbers might start executing. So, your output isn't guaranteed. To get epected output, you need to lock - ExamQ32.class in each run method (as shown below) because your say() is static Change your code to the following to get expected output : public class ExamQ32 { public static void say(String s) { System.out.print(s); } public static void main(String[] args) { Thread letters = new Thread() { public void run() { synchronized (ExamQ32.class) { say("a"); say("b"); say("c"); } } }; Thread numbers = new Thread() { public void run() { synchronized (ExamQ32.class) { say("1"); say("2"); say("3"); } } }; letters.start(); numbers.start(); } }
has comment: http://stackoverflow.com/comment/39278084
downvote count: 0
has comment: http://stackoverflow.com/comment/39277478
has comment: http://stackoverflow.com/comment/39277666
accepted answer of: http://stackoverflow.com/q/25217432
has comment: http://stackoverflow.com/comment/39277590

http://stackoverflow.com/a/25218861
has comment: http://stackoverflow.com/comment/39281567
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25218804
type: Answer
upvote count: 2
has body: Right click on the file, select open with, and there should be three options (Text Editor/System Editor/Default). Selecting text editor should associate it with eclipse (from within eclipse only) in future.

http://stackoverflow.com/comment/39193547
type: QuestionComment
comment on: http://stackoverflow.com/q/25172113
score: 0
has text: If you are using an AWT based applet, you might find that's not possible, as AWT components are typically rendered at a native level...not saying it's not possible, but there is a lot to take into consideration...
type: Comment

http://stackoverflow.com/comment/39119095
has text: and also is that solves the issue,that my code is working only on time element? like waiting for 1 minute?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25132398
type: Comment

http://stackoverflow.com/comment/39057890
type: Comment
has text: @sehams: you have to do this with ***all*** the JTextFields, not just the one I've shown.
comment on: http://stackoverflow.com/a/25099731
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39246866
has text: it works if I remove the hover classes. but this is no good for me as I want the hover effect for desktop/laptop. not sure why this is.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25200430

http://stackoverflow.com/a/25140425
upvote count: 31
type: Answer
accepted answer of: http://stackoverflow.com/q/25122047
answers question: http://stackoverflow.com/q/25122047
downvote count: 0
score: 31
has body: So i just fixed my problem thanks to @lena : Edit the Phpstorm.exe.vmoptions file (IDE_HOME\bin\Phpstorm.exe.vmoptions) : -Xms128m -Xmx2048m -XX:MaxPermSize=250m -XX:ReservedCodeCacheSize=64m -XX:+UseCodeCacheFlushing -ea -Dsun.io.useCanonCaches=false And reduce -Xmx value step by step reducing by 100m every time until it starts.
has comment: http://stackoverflow.com/comment/84095416
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/54114300
has comment: http://stackoverflow.com/comment/45242138

http://stackoverflow.com/comment/39059640
comment on: http://stackoverflow.com/a/25100517
type: Comment
has text: I did what you suggested but did not work. The only difference was that I had to declare the 'redButton' as Object. Please find reviewed code for the Panel Class:
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39263903
has text: Glad to help! If you have more major trouble, you can always post another question. Also if my answer solved your problem, you can accept it as the solution :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25209750
type: AnswerComment

http://stackoverflow.com/a/25176609
has comment: http://stackoverflow.com/comment/39201492
has comment: http://stackoverflow.com/comment/39200653
score: 0
has comment: http://stackoverflow.com/comment/39200683
accepted answer of: http://stackoverflow.com/q/25176499
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25176499
has comment: http://stackoverflow.com/comment/39201559
type: Answer
has comment: http://stackoverflow.com/comment/39201179
has body: Me it static and call your init code in the static block static final Properties properties = new Properties(); static { /************ File properties configuration ***************/ // Get the inputStream final InputStream inputStream = SeleniumTest.class.getResourceAsStream("messages_fr.properties"); System.out.println("InputStream is: " + inputStream); // load the inputStream using the Properties properties.load(inputStream); /*********** End configuration properties file **************/ }
has comment: http://stackoverflow.com/comment/39202945

http://stackoverflow.com/comment/39123125
score: 0
has text: Often method2 has a lot of messed invokation
type: Comment
comment on: http://stackoverflow.com/a/25134665
type: AnswerComment

http://stackoverflow.com/comment/39148619
type: QuestionComment
comment on: http://stackoverflow.com/q/25148146
has text: So the entries are separated by line breaks?
score: 0
type: Comment

http://stackoverflow.com/q/25158100
has comment: http://stackoverflow.com/comment/39315017
score: -1
answer count: 2
upvote count: 0
tagged with: ear
favorite count: 0
type: UnansweredQuestion
tagged with: maven
tagged with: properties
has comment: http://stackoverflow.com/comment/39166753
tagged with: build
has title: Maven Build Settings.xml
has body: I have two Maven projects, Parent and Child. To build Child I need to mvn install Parent before, so that the EAR produced by Parent is available in my m2 repo. I want to modify the Child build in such a way that it can install the dependent libraries from a provided Parent project EAR rather than relying on the Parent project being installed locally. Is there a way where the location of the ear file can be configured in the .m2 settings file?
tagged with: java
has answer: http://stackoverflow.com/a/34947099
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25237198

http://stackoverflow.com/comment/39003376
score: 3
has text: You will run into a database design challenge here. Whether to lock tables, pages or rows. Good luck.
type: Comment
comment on: http://stackoverflow.com/q/25070375
type: QuestionComment

http://stackoverflow.com/q/25171084
has answer: http://stackoverflow.com/a/25171642
has body: Im having trouble creating a main method that can correctly demonstrate this class. The constructor's arguments have to be in the form MMYYYY. The constructor should read the contents of both files for June 2013(highs062013.txt and lows062013.txt) and store the values in two integer arrays. The files contain the same amount of data. There is also methods for getting the highest and lowest temp, and the high average and low average. import java.io.*; public class Weather { public Weather(int date) throws FileNotFoundException, IOException { String dateLow = ("lows" + date + ".txt"); String dateHigh = ("highs" + date + ".txt"); File low = new File(dateLow); File high = new File(dateHigh); FileReader frLow=new FileReader(dateLow); FileReader frHigh = new FileReader(dateHigh); char[] cLow = new char[(int)dateLow.length()]; char[] cHigh = new char[(int)dateHigh.length()]; frLow.read(cLow); frHigh.read(cHigh); } public char lowest(char[] cLow) { char small = cLow[0]; for (int i = 0; i &lt; cLow.length; i++) { if (cLow[i] &lt; small) { small = cLow[i]; } } System.out.println(small + " is the lowest temp."); return small; } public char highest(char[] cHigh) { char high = cHigh[0]; for (int i = 0; i &lt; cHigh.length; i++) { if (cHigh[i] &gt; high) { high = cHigh[i]; } } System.out.println(high + " is the highest temp."); return high; } public int averageLow(char[] cLow) { int sum = 0; int averageLow; for(int i=0; i &lt; cLow.length; i++) { sum = sum + cLow[i]; } averageLow = sum/cLow.length; return averageLow; System.out.println(averageLow + " is the average low temp."); } public int averageHigh(char[] cHigh) { int sum = 0; int averageHigh; for(int i=0; i &lt; cHigh.length; i++) { sum = sum + cHigh[i]; } averageHigh = sum/cHigh.length; System.out.println(averageHigh + " is the average high temp."); return averageHigh; } } I need to create a driver method that can demonstrate my code, that Is what I am having trouble with.
has comment: http://stackoverflow.com/comment/39191675
type: Question
tagged with: java
answer count: 2
downvote count: 6
has comment: http://stackoverflow.com/comment/39191629
has title: Having problems creating main method
score: -6
favorite count: 0
has answer: http://stackoverflow.com/a/25171153
has comment: http://stackoverflow.com/comment/39191080
accepted answer: http://stackoverflow.com/a/25171642
possible better answer: http://stackoverflow.com/a/25171153
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/39191091

http://stackoverflow.com/comment/39201049
comment on: http://stackoverflow.com/a/25176284
has text: Thanks a lot!! Had been banging my head around it for nearly 16 hours....!! Made my day......Seems like a pretty silly mistake to me now...
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39122337
has text: Specifying the `path="..." ` allows you to pre-select some of the values, `items="..."` builds the list
score: 0
comment on: http://stackoverflow.com/a/25134342
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39130235
has text: For JScrollPane Object of course :-). Hope you can find a solution. Good Luck. I would help but I don't have Netbeans right now
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25135234
score: 1

http://stackoverflow.com/a/32310996
accepted answer of: http://stackoverflow.com/q/25080131
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/52497036
has comment: http://stackoverflow.com/comment/52497151
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25080131
has body: Sorry I do not have enough reputation to comment yet, but there's a possible bug in your code (unless you intended to exclude the root username), because the first readLine command reads the first line while the readLine at the beginning of the loop reads the next line.

http://stackoverflow.com/comment/39029256
has text: @AndroidDev: Well that's not going to even compile... but if you're trying to parse something like that, I suggest you search through other questions on Stack Overflow - it's been addressed several times.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25083346

http://stackoverflow.com/comment/39221684
type: QuestionComment
comment on: http://stackoverflow.com/q/25187922
score: 0
has text: "but it seems wrong to copy + paste whole chunks of code" - and why would you have to do that ? If the parent-class has its own unit-tests that means that this code is already being tested.
type: Comment

http://stackoverflow.com/comment/39161907
type: Comment
has text: Hey! I am tring to setText in the result Textfield but it says it needs String ! hoW do i typecast it ?
type: AnswerComment
comment on: http://stackoverflow.com/a/25155266
score: 0

http://stackoverflow.com/q/25090933
has answer: http://stackoverflow.com/a/25091096
tagged with: jtextarea
downvote count: 0
score: 1
has title: Change JButton color and move JTextArea Caret Simultaneously
has answer: http://stackoverflow.com/a/25091198
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39041791
accepted answer: http://stackoverflow.com/a/25091096
favorite count: 0
possible better answer: http://stackoverflow.com/a/25091198
type: Question
answer count: 2
upvote count: 1
tagged with: swing
has body: I'm writing a program where there is a keyboard and a JTextArea. Once a button is pressed, the color of the button should change as well as the caret position. I used Key Binding. Now if I first change the color then move the caret, only the caret moves but color doesn't change and vise versa. Here is a sample of my code: (I have many panels to organize the rest of the buttons...) import java.awt.BorderLayout; import java.awt.Color; import java.awt.EventQueue; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.swing.ButtonGroup; import javax.swing.InputMap; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.KeyStroke; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.border.EmptyBorder; public class KeyboardTest extends JFrame { public static final JTextArea textToType = new JTextArea("jjj jjj jjj jjj kkk kkk kkk kkk jjj kkk jjj kkk jjj kkk jkj jkj jkj jkj kjk kjk kjk \r\nkjk jjj jjj jjj kkk kkk kkk jk jk jk kj kj kj jj kk jk kj kj jk jj jk kk kj j j j j k \r\nk k k j k k j j k k j jkj jjk kjj kkj jkk kkk jjj kjk"); public static final int caretPosition = 0; public static void main(String[] args) { new KeyboardTest(); } public KeyboardTest() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (Exception ex) { try { UIManager.setLookAndFeel(UIManager .getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } } JFrame…
tagged with: jbutton
tagged with: java
tagged with: import

http://stackoverflow.com/a/25221709
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25165969
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25165969
has body: Check whether AUTO_COMMIT is set to false in data source configuration in spring specific xml.
type: AcceptedAnswer

http://stackoverflow.com/comment/39024861
comment on: http://stackoverflow.com/a/25082137
score: 0
type: Comment
has text: Thanks it display hello world but i want to run just like the Test class that open another cmd
type: AnswerComment

http://stackoverflow.com/q/25141714
type: Question
has answer: http://stackoverflow.com/a/25141945
downvote count: 0
tagged with: byte
tagged with: file-io
answer count: 1
favorite count: 0
has title: What is efficient way to Write and Read mixed data as byte on file
has body: I have a huge HashMap data structure that I want to compress its values and write them and hashmap keys as byte on files. Also I want to read this data from some of the files and decompress them and put them on a Hashmap too. I implemented all parts except writing and reading these data from a file. I explained what I did until now. I defined my hashmap as HashMap&lt;String, ArrayList&lt;Posting&gt;&gt; The Posting is defined: class Posting { public int documentId; public double score; public Posting(){ documentId=-1; score=1; } public Posting(int docId, double scr){ documentId = docId; score = scr; } After I filled the Hashmap I compress all docIds of a key and saved them as byte[]and compress the scr as int[]. Then I want to write this information in the following order in the file. key(String){seperator1}docIds(byte[]){seprator2}scores(int[]){seperator3} key2(String){seperator1}docIds1(byte[]){seprator2}scores1(int[]){seperator3} I use "." as a seperate in my implementation. I wrote and read these data on file based on following codes DataOutputStream os= new DataOutputStream(new FileOutputStream(file,true)); os.writeBytes(key); os.writeBytes("."); int n = finalInvertedLists.get(key).size(); for (int i = 0; i &lt; n ; i++) { Posting p = finalInvertedLists.get(key).get(i); os.writeByte(p.documentId); os.writeBytes("."); os.writeByte((int)p.score); os.writeBytes("."); } os.close(); reading the posting list for given word based on the following code DataInputStream is= new DataInputStream(new FileInputStream(str)); String line=""; while((line = is.readLine()) != null) { StringTokenizer tokens = new StringTokenizer(line,"."); if(tokens.nextToken().equals(word)) { while(tokens.hasMoreTokens()) { int id=Integer.parseInt(tokens.nextToken()); double score= Double.parseDouble(tokens.nextToken()); //int docLength= Integer.parseInt(tokens.nextToken()); postings.add(new Posting(id,score)); //, docLength )); } } } is.close(); I cannot read correctly; I think; maybe I did not …
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25141945
score: 1
tagged with: java

http://stackoverflow.com/q/25155225
answer count: 4
has answer: http://stackoverflow.com/a/25155264
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/25155288
has comment: http://stackoverflow.com/comment/39160964
tagged with: java
score: 0
has title: Overriding actionPerformed
has answer: http://stackoverflow.com/a/25155304
has answer: http://stackoverflow.com/a/25155266
type: UnansweredQuestion
has body: There is the problem overriding the function actionPerformed , it says unable to find the symbols op1, op2 &amp; add. What am i doing wrong ? Note : This isnt the complete program. I am trying to make a simple program to add,divide,subtract and multiply the numbers fetched from the textfields and then displaying it in the another textfield named result. package arithmetic; import java.awt.event.*; import javax.swing.*; import java.awt.*; public class Arithmetic extends JFrame implements ActionListener { private JPanel Pbutton; private JPanel Ptext ; private JPanel result; private JPanel main; Arithmetic () { main = new JPanel(); Pbutton = new JPanel(); Ptext = new JPanel (); result = new JPanel(); JButton add = new JButton("ADD"); JButton div = new JButton("DIVIDE"); JButton sub = new JButton("SUBTRACT"); JButton mul = new JButton("MULTIPLY"); JButton ex = new JButton ("EXIT"); JTextField op1 = new JTextField(10); JTextField op2 = new JTextField(10); JTextField res = new JTextField(10); JLabel frst = new JLabel("Operand 1"); JLabel sec = new JLabel("Operand 2"); JLabel rel = new JLabel ("Result"); main.add(Pbutton); main.add(Ptext); main.add(result); Ptext.add(frst); Ptext.add(op1); Ptext.add(sec); Ptext.add(op2); add(main); Pbutton.add(add); Pbutton.add(div); Pbutton.add(mul); Pbutton.add(sub); result.add(rel); result.add(res); result.add(ex); add.addActionListener(this); sub.addActionListener(this); mul.addActionListener(this); div.addActionListener(this); ex.addActionListener(this); setSize(800,145); Pbutton.setBackground(Color.BLACK); Ptext.setBackground(Color.BLACK); result.setBackground(Color.BLACK); setVisible(true); setLayout(null); main.setLayout(new BoxLayout(main,BoxLayout.X_AXIS)); Pbutton.setLayout( new BoxLayout(Pbutton, BoxLayout.Y_AXIS)); } @Override public void actionPerformed(ActionEvent a) { if (a.getSource() == add) { int sum = op1.getText() + op2.getText(); } } public static void main(String[] args) { new Arithmetic (); } }

http://stackoverflow.com/comment/39011731
comment on: http://stackoverflow.com/q/25074373
type: Comment
type: QuestionComment
has text: It was query problem. I changed the query and removed asterisk, and it worked fine. Thank you.
score: 0

http://stackoverflow.com/a/25211349
answers question: http://stackoverflow.com/q/25211250
accepted answer of: http://stackoverflow.com/q/25211250
type: AcceptedAnswer
type: Answer
score: 0
has body: If you already have AutoCloseable, then you're working with Java 7 or later. Then, it would be better if you use try-with-resources instead: try (Connection con = ...; Statement stmt = ...; ResultSet rs = ...) { } catch (...) { } Also, for every method that has to execute a statement, it would be better if you pass the Connection as parameter so you can reuse a single connection instead of opening/closing it per statement, thus heavily improving the app performance.

http://stackoverflow.com/comment/39091526
type: QuestionComment
type: Comment
has text: It seems to me this question is `Why doesn't HashSet implement Map`. If you want a key-value pair relationship, that is a `Map`. If you want a `HashMap`, use it.
score: 0
comment on: http://stackoverflow.com/q/25117713

http://stackoverflow.com/comment/39190756
comment on: http://stackoverflow.com/q/25170855
score: 0
type: Comment
type: QuestionComment
has text: @Reimeus I got the same results. Code updated.

http://stackoverflow.com/a/25171938
has comment: http://stackoverflow.com/comment/39193383
accepted answer of: http://stackoverflow.com/q/25171039
answers question: http://stackoverflow.com/q/25171039
upvote count: 12
has comment: http://stackoverflow.com/comment/133649548
has body: In addition to using the low-level Thread API and Platform.runLater(...) to schedule code to be executed on the FX Application Thread, as in Tomas' answer, another option is to use the FX concurrency API. This provides Service and Task classes, which are intended to be executed on background threads, along with callback methods which are guaranteed to be executed on the FX Application Thread. For your simple example, this looks like a bit too much boilerplate code, but for real application code it is quite nice, providing a clean separation between the background task and the UI update that is performed on completion. Additionally, Tasks can be submitted to Executors. import javafx.application.Application; import javafx.concurrent.Task ; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.layout.BorderPane; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.stage.Stage; public class ClassApplication extends Application { private Pane pane; public Parent createContent() { /* layout */ BorderPane layout = new BorderPane(); /* layout -&gt; center */ pane = new Pane(); pane.setMinWidth(250); pane.setMaxWidth(250); pane.setMinHeight(250); pane.setMaxHeight(250); pane.setStyle("-fx-background-color: #000000;"); /* layout -&gt; center -&gt; pane */ Circle circle = new Circle(125, 125, 10, Color.WHITE); /* add items to the layout */ pane.getChildren().add(circle); layout.setCenter(pane); return layout; } @Override public void start(Stage stage) throws Exception { stage.setScene(new Scene(createContent())); stage.setWidth(300); stage.setHeight(300); stage.show(); Task&lt;Void&gt; task = new Task&lt;Void&gt;() { @Override public Void call() throws Exception { Thread.sleep(2000); return null ; } }; task.setOnSucceeded(event -&gt; { Circle circle = new Circle(50, 50, 10, Color.RED); pane.getChildren().setAll(circle); }); new Thread(task).run(); } public static void main(String args[]) { launch…
has comment: http://stackoverflow.com/comment/133656105
score: 12
has comment: http://stackoverflow.com/comment/39192716
has comment: http://stackoverflow.com/comment/39194173
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39193594
has comment: http://stackoverflow.com/comment/39193794
has comment: http://stackoverflow.com/comment/39194298
type: Answer
has comment: http://stackoverflow.com/comment/133656164

http://stackoverflow.com/a/25099731
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25099674
has comment: http://stackoverflow.com/comment/39057890
has comment: http://stackoverflow.com/comment/39057871
has comment: http://stackoverflow.com/comment/39058022
has comment: http://stackoverflow.com/comment/39058158
has comment: http://stackoverflow.com/comment/39057981
has body: You're calling getText() on your JTextFields and just ignoring the String returned. Instead your passing the actual JTextField's toString result and not its text into your SQL statement. Don't do that. So instead, get the text Strings from your fields, and put them into String variables. Then use those variables to build your SQL statement. i.e., String foo = fooTextField.getText(); // now use foo, not fooTextField to create your SQL statements. i.e., if (me.getSource() == createCustomerButton) { String nachname = nachnameField.getText(); // get text put into variable String vorname = vornameField.getText(); // .... etc String statement = "INSERT INTO kunde (nachname, vorname, strasse, postleitzahl, telefon, email, zusatzinfo) VALUES(" + nachname + "," // use variable here + vorname + "," ...... etc... Also: Learn and then use PreparedStatements as these are safer to use. Don't add MouseListeners to JButtons as this will lead to bad button behavior (i.e., disabled buttons that still work, buttons that don't respond to space bar presses...) Use ActionListeners instead. Don't overuse static modifier as you're doing. Using them in this way suggests that your code needs to be improved greatly. Don't post bad snippets as you're doing as that will only confuse us.

http://stackoverflow.com/a/32104851
accepted answer of: http://stackoverflow.com/q/25193198
has body: This is a really old "bug" that was somewhat fixed with the introduction of Platform.setImplicitExit(false). You can read the developers comments in the open issue JDK-8090517. As you will see it has a low priority and probably will never get fixed (at least not soon). Another solution you might want to try instead of using Platform.setImplicitExit(false) is to extend the Application class in your current Main class and use the primary Stage to display the application's main window. As long as the primary Stage remains open the FX Thread will be alive (and dispose correctly when you close your app). If you aren't looking to use an FX Stage as your main window (since it would require to use a SwingNode for what you have now or migrate your UI to JavaFX) you can always fake one like this: @Override public void start(Stage primaryStage) throws Exception { YourAppMainWindow mainWindow = new YourAppMainWindow(); // Load your main window Swing Stuff (remember to use // SwingUtilities.invokeLater() to run inside the Event Dispatch Thread mainWindow.initSwingUI(); // Now that the Swing stuff is loaded open a "hidden" primary stage // that will keep the FX Thread alive primaryStage.setWidth(0); primaryStage.setHeight(0); primaryStage.setX(Double.MAX_VALUE); primaryStage.setY(Double.MAX_VALUE); primaryStage.initStyle(StageStyle.UTILITY); primaryStage.show(); } Keep in mind that faking a primary stage (or migrating your main window to FX) will end in more code than simply using Platform.setImplicitExit(false) and Platform.exit() accordingly. Anyway, hope this helps!
has comment: http://stackoverflow.com/comment/52154961
type: AcceptedAnswer
downvote count: 0
score: 8
answers question: http://stackoverflow.com/q/25193198
upvote count: 8
type: Answer

http://stackoverflow.com/comment/39177698
has text: @Kayaman This is a corner case. The user sending the stream is sending bad data, but I need to handle it so the application doesn't crash.
comment on: http://stackoverflow.com/q/25160262
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25132981
has body: A little research gives below result... For static receiver public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.e("PANKAJ", "Context class " + context.getClass().getName()); Log.e("PANKAJ", "Application Context class " + context.getApplicationContext().getClass().getName()); } } I got below log 08-05 06:51:33.448: E/PANKAJ(2510): Context class android.app.ReceiverRestrictedContext 08-05 06:51:33.448: E/PANKAJ(2510): Application Context class android.app.Application For bynamic receiver (registered into an Activity MainActivity) like private BroadcastReceiver myReceiver = new BroadcastReceiver() { public void onReceive(android.content.Context context, Intent intent) { Log.e("PANKAJ", "Context class " + context.getClass().getName()); Log.e("PANKAJ", "Activity Context class " + MainActivity.this.getClass().getName()); Log.e("PANKAJ", "Application Context class " + context.getApplicationContext().getClass().getName()); } }; I got below log 08-05 06:53:33.048: E/PANKAJ(2642): Context class com.example.testapp.MainActivity 08-05 06:53:33.048: E/PANKAJ(2642): Activity Context class com.example.testapp.MainActivity 08-05 06:53:33.048: E/PANKAJ(2642): Application Context class android.app.Application So when it make true the statement given into documentation that The Context in which the receiver is running.
answers question: http://stackoverflow.com/q/25132399
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25132399
upvote count: 8
type: Answer
score: 8

http://stackoverflow.com/q/25211643
type: Question
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/39274366
tagged with: xxe
tagged with: java
upvote count: 1
tagged with: jaxb
answer count: 1
has answer: http://stackoverflow.com/a/25250354
type: UnansweredQuestion
tagged with: security
downvote count: 0
score: 1
has title: JAXB XXE attack with Default Parser
favorite count: 0
has body: This is regarding avoiding XXE attack while using JAXB APIs. I understand that when using JAXB, the default parsing mechanism can be overridden and an alternate SAX Parser can be employed and set entity features to avoid XXE attacks. But would like to understand what exactly is the default parser and get the security features set on it. Any help?

http://stackoverflow.com/q/25156226
type: UnansweredQuestion
score: 8
linked to: http://stackoverflow.com/q/23545105
tagged with: java
tagged with: maven
type: Question
tagged with: ant
has title: How to execute multiple ant targets in maven
tagged with: eclipse
has answer: http://stackoverflow.com/a/47559852
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25156471
favorite count: 0
has body: Yes, yes, this is a XY type of problem. (I wanted to present it nicer without loosing any information) In my project when I tried to execute the ANT tasks in maven it gives me the same error that I have in this sample. I took this example from here. I tried to execute the multiple ant targets using the maven-antrun-plugin as below. But, it always executes the below most target only (when I don't mention depends attibute). When I use it, it gives following exception : Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project jibx-mvn-demo: An Ant BuildException has occured: Target "compile" does not exist in the project "maven-antrun-". It is used from target "myDAO". -> [Help 1] pom.xml maven-antrun-plugin 1.7 install Clean up my working directory to be nice and sparkly Initialize stuff for my DAO build Maybe setup some properties? I need my directories for building. But first, I need to setup stuff" I need to compile my dao source" But first, I need to make the necessary directories Here's where I package up my DAO But I have to compile stuff before I can package it run What is the reason for this? How can I execute multiple ant tasks in maven?
upvote count: 8

http://stackoverflow.com/q/25194496
has title: How do I access files in /WEB-INF using HTML in a Tomcat server?
accepted answer: http://stackoverflow.com/a/25210843
tagged with: tomcat
has comment: http://stackoverflow.com/comment/39235069
has comment: http://stackoverflow.com/comment/39253293
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has body: Currently I have a website running which allows the user to enter a password into a . The form calls a doPost() to a Java HttpServlet file, which then checks if the field entered was correct or not. Depending on the condition, it either redirect to TryAgain or Menu page using the following request.getRequestDispatcher("/WEB-INF/FOLDERNAME/Menu.jsp").forward( request, response); This part works okay, but once I am on the Menu page I have two hyperlinks which should redirect to either /WEB-INF/FOLDERNAME/Multi.jsp or /WEB-INF/FOLDERNAME/Single.jsp I need to keep these pages only accessible by users who signed in successfully on the initial password form page, so I put these inside of my /WEB-INF/ folder. The problem I am having is how do I redirect to the appropriate page (Multi.jsp/Single.jsp) using HTML? I think it is a bit of an overkill to wire these two hyperlinks to two individual forms and call the request.getRequestDispatcher().forward(); from doPost(){} just to redirect a user. Is there a different way to go about doing this?
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/39235163
has comment: http://stackoverflow.com/comment/39234205
has answer: http://stackoverflow.com/a/25210843
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39261580
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39244531
tagged with: jsp
tagged with: javascript

http://stackoverflow.com/a/25213276
has body: A comment on that answer points to this question as a solution: null JavaCompiler in Eclipse Some tools aren't implemented in the JRE and only available in the JDK. It seems Eclipse runs the processor using the JRE by default, so you need to configure your project to use a JDK as runtime instead.
has comment: http://stackoverflow.com/comment/55073292
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/39273888
answers question: http://stackoverflow.com/q/25192381

http://stackoverflow.com/comment/39156716
type: AnswerComment
comment on: http://stackoverflow.com/a/25152844
has text: What's (if it exists) the compiled `.class` equivalent of a `.cs` file? Can they exist on their own?
score: 0
type: Comment

http://stackoverflow.com/comment/39013864
comment on: http://stackoverflow.com/a/25076147
type: Comment
has text: Thanks! This works. I will need to discuss with the client, though, and see if he approves of the solution. In any case, I will mark this as an answer since it produces the desired result.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39139592
score: 0
type: Comment
type: QuestionComment
has text: No, I tried many times
comment on: http://stackoverflow.com/q/25143607

http://stackoverflow.com/comment/39276603
has text: @Amogh Hai Amogh i am new to this environment that is why i am posting too big. According to Your reference the problem is in @JoinColumn(name="id") is the Problem. I added that one but it doesnt works.Still my helloOneToMany.hello have a null value.
score: 0
comment on: http://stackoverflow.com/q/25216951
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39078163
comment on: http://stackoverflow.com/a/25108760
has text: (cont'd) In other languages, where methods are values, you can do interesting things like iterate over the methods in an object without explicitly using reflection.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25150199
has title: Pick a random element from a string array?
has answer: http://stackoverflow.com/a/25150262
has body: I've got this code, which (I hope) reads from a text file with 66 words and puts the words into an array. BufferedReader buff = null; String wordlist=new String[66]; int i=0; try { buff = new BufferedReader(new FileReader("C:\\easy.txt")); wordlist[i] = buff.readLine(); while(wordlist[i] != null&amp;i&lt;66){ wordlist[i]=buff.readLine(); i++; } } I want to pick a random word from the array. However trying a few things myself and looking at other questions doesn't seem to work. Any help would be appreciated
favorite count: 0
linked to: http://stackoverflow.com/q/738629
has comment: http://stackoverflow.com/comment/39152110
answer count: 5
linked to: http://stackoverflow.com/q/8065532
has comment: http://stackoverflow.com/comment/39152103
duplicate of: http://stackoverflow.com/q/8065532
has answer: http://stackoverflow.com/a/25150296
linked to: http://stackoverflow.com/q/7961788
upvote count: 2
type: UnansweredQuestion
score: 1
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25150218
has comment: http://stackoverflow.com/comment/39152102
has answer: http://stackoverflow.com/a/25150224
has comment: http://stackoverflow.com/comment/39152113
has answer: http://stackoverflow.com/a/25150246
tagged with: arrays

http://stackoverflow.com/comment/39081529
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25112355
has text: check the projects which you have added to *your* project in the build path.. check if they share common dependencies which will be loaded..

http://stackoverflow.com/comment/39261040
type: Comment
type: QuestionComment
has text: the java concept of "listeners" (which is an horrible hack intended to cater for the language's incapabilities) is translated to proper [events](http://msdn.microsoft.com/en-us/library/awbftdfh.aspx) in C#. You don't need a "Listener" class in C# because there's built in, language-level support for events. What type of view is CW?
score: 0
comment on: http://stackoverflow.com/q/25208659

http://stackoverflow.com/comment/39301100
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25229797
has text: Also what is v13 ? Why v13 ?
type: AnswerComment

http://stackoverflow.com/comment/39245000
type: QuestionComment
comment on: http://stackoverflow.com/q/25197664
has text: It is giving exception when i run it in java . I will edit my question to give you a better explanation
type: Comment
score: 0

http://stackoverflow.com/comment/39057080
has text: @mimi yes add in out of onClick.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25098815
type: Comment

http://stackoverflow.com/q/25098314
tagged with: java
has comment: http://stackoverflow.com/comment/39056787
tagged with: eclipse
type: Question
has body: I'm using the latest version of Eclipse on Mac OSX 10.9.4. To help with GUI building I have downloaded the windows builder tool for eclipse. I would like to press a button and have a popup display some text so I have imported the required packages and done the following: btnSignIn = new Button(shlUserSignIn, SWT.NONE); btnSignIn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { JOptionPane.showMessageDialog(null, "Test"); } }); This produces the following error and causes the program to crash: 2014-08-02 19:36:46.459 java[32273:507] *** WARNING: Method userSpaceScaleFactor in class NSWindow is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead. 2014-08-02 19:36:48.067 java[32273:507] [Java CocoaComponent compatibility mode]: Enabled 2014-08-02 19:36:48.068 java[32273:507] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000 2014-08-02 19:36:48.593 java[32273:16303] *** -[NSConditionLock unlock]: lock (&lt;NSConditionLock: 0x7fff1b7c96a0&gt; '(null)') unlocked when not locked 2014-08-02 19:36:48.593 java[32273:16303] *** Break on _NSLockError() to debug. 2014-08-02 19:36:48.696 java[32273:16303] *** -[NSConditionLock unlock]: lock (&lt;NSConditionLock: 0x7fff1b097ee0&gt; '(null)') unlocked when not locked 2014-08-02 19:36:48.696 java[32273:16303] *** Break on _NSLockError() to debug. 2014-08-02 19:36:48.798 java[32273:16303] *** -[NSConditionLock unlock]: lock (&lt;NSConditionLock: 0x7fff1b0984b0&gt; '(null)') unlocked when not locked 2014-08-02 19:36:48.798 java[32273:16303] *** Break on _NSLockError() to debug. 2014-08-02 19:36:48.901 java[32273:16303] *** -[NSConditionLock unlock]: lock (&lt;NSConditionLock: 0x7fff1b7cd5a0&gt; '(null)') unlocked when not locked 2014-08-02 19:36:48.901 java[32273:16303] *** Break on _NSLockError() to debug. 2014-08-02 19:36:49.002 java[32273:16303] *** -[NSConditionLock unlock]: lock (&lt;NSCondition…
score: 0
has title: Java JOptionPane Issue
has comment: http://stackoverflow.com/comment/39056741
has comment: http://stackoverflow.com/comment/39055606
tagged with: macos
has comment: http://stackoverflow.com/comment/39055647
has comment: http://stackoverflow.com/comment/39055582
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39056557

http://stackoverflow.com/a/25152489
type: Answer
has body: Try NaN, e.g. result = 0.0/0.0; The first format results in NaNf whereas the second produces something that prints on (my) stdout like this: � Which seems to be my "replacement character": 0xef 0xbf 0xbd when od'd. From Javadoc of DecimalFormat: "NaN is formatted as a string, which typically has a single character \uFFFD. " Similarly infinity: result = 1.0/0.0; Results are Infinityf and ∞f You can (probably with a virtually unlimited) chance of success hunt for other differences. Here's a comparison, static void cmp( double result ){ String strRes1 = String.format("%3.2ef",result); DecimalFormat resFormat = new DecimalFormat("0.00E00f"); String strRes2 = resFormat.format(result); if (strRes2.contains("E-")) strRes2 = strRes2.replace("E", "e"); else strRes2 = strRes2.replace("E", "e+"); if( ! strRes1.equals( strRes2 ) ){ System.out.println( strRes1 + " " + strRes2 ); System.out.println( result ); } } and now try to find some differences: for( double x = 1.0; true; x /= 2.0 ){ // hit Ctrl-C to terminate the program cmp( x ); } 3.13e-02f 3.12e-02f 0.03125 1.27e-321f 1.26e-321f 1.265E-321 There is some difference w.r.t. rounding. This is very nice, but what was the original question on that OJ site? Trying to fish for subtle differences in the JDK API is a rather weird challenge. You can bet that there are more interesting issues.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25152105
score: 1
has comment: http://stackoverflow.com/comment/39183713
answers question: http://stackoverflow.com/q/25152105
has comment: http://stackoverflow.com/comment/39175896
has comment: http://stackoverflow.com/comment/39186384
has comment: http://stackoverflow.com/comment/39177618
has comment: http://stackoverflow.com/comment/39177117
has comment: http://stackoverflow.com/comment/39180362
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39183969

http://stackoverflow.com/comment/39259174
type: AnswerComment
has text: Can you create any code example on how should I implement my scenario ?
type: Comment
comment on: http://stackoverflow.com/a/25207479
score: 0

http://stackoverflow.com/comment/39035930
score: 7
comment on: http://stackoverflow.com/q/25087773
has text: One day there will be a "spot the bug" olympics, it will have a string reference comparison and I will win the damn trophy for that.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25121085
type: Answer
upvote count: 11
has comment: http://stackoverflow.com/comment/39098003
has comment: http://stackoverflow.com/comment/39098391
has comment: http://stackoverflow.com/comment/39098074
score: 11
has body: I would assume that addandDisp means add and display. When you have a collection, defined as: List&lt;? extends Object&gt; ls2 = new LinkedList&lt;Number&gt;(); This means that the compiler will allow you to assign the colletion to all the possible unknown subtypes of Object. Since you have the operation add, the compiler denies to give you green light, because it doesn't know if the provided object's type meets the restriction to be of the unknown subtype of Object. This is called covariance. Similary, when you have a definition like this: List&lt;? super String&gt; ls1 = new LinkedList&lt;String&gt;(); The compiler allows you to assing ls1 to: LinkedList&lt;String&gt;(); //you can add Strings to the list LinkedList&lt;Object&gt;(); //you can add Strings and Objects to the list In this case, the compiler will be completely aware if the object you're trying to pass meets the condition to be subtype of the generic type of the collection. This is called contravariance. More info: What is PECS?
downvote count: 0
answers question: http://stackoverflow.com/q/25120951

http://stackoverflow.com/q/25135880
tagged with: eclipse-plugin
favorite count: 0
tagged with: eclipse-rcp
has body: Switched my Eclipse from Kepler to Luna, and I have this weird bug in the plugin.xml of my RCP app. Although all the views have icons, the icons don't show anymore in the org.eclipse.ui.views tree. Is this because RCP 3.8 is deprecated in Luna?
tagged with: eclipse-luna
upvote count: 3
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/36074789
score: 3
tagged with: java
tagged with: eclipse
answer count: 1
has title: Eclipse RCP no icons in plugin.xml extensions
downvote count: 0
has comment: http://stackoverflow.com/comment/39138816

http://stackoverflow.com/q/25220945
has answer: http://stackoverflow.com/a/25220997
tagged with: performance
tagged with: algorithm
tagged with: java
has body: The problem is: Given a list of strings and an integer k, return the top k most frequently occurring words in descending order based on frequency. This must be done O(N) where N is the length of the list of strings. The popular solution is to store (word, frequency) in a hash table, sort the hash table by frequency, and output the top k words. This is not O(N) however because sorting by frequency takes O(NlgN). I'm wondering if a O(N) solution actually exists. I've thought about quick-select where you get the kth top most occurring word and sort the remaining frequencies but that would be O(N + klgk) which is still O(NlgN) when k is say N.
answer count: 2
has comment: http://stackoverflow.com/comment/39283820
has answer: http://stackoverflow.com/a/25222048
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/39283766
type: UnansweredQuestion
score: 2
tagged with: word-frequency
upvote count: 2
linked to: http://stackoverflow.com/q/185697
has title: Is there a O(N) solution to getting top k most occurring string in List<String>?
type: Question
duplicate of: http://stackoverflow.com/q/185697

http://stackoverflow.com/comment/39118410
comment on: http://stackoverflow.com/a/25132213
score: 0
type: Comment
type: AnswerComment
has text: @MartinFrank Thank you . Even i was confused what was required

http://stackoverflow.com/q/25133672
favorite count: 0
type: UnansweredQuestion
tagged with: void
has comment: http://stackoverflow.com/comment/39121093
has title: How can I use a method to change a value?
has answer: http://stackoverflow.com/a/25133729
has comment: http://stackoverflow.com/comment/39122261
tagged with: java
upvote count: 1
tagged with: methods
downvote count: 1
duplicate of: http://stackoverflow.com/q/1068760
type: Question
has comment: http://stackoverflow.com/comment/39120948
has body: class Trial { static void main() { int i = 0; change(i); System.out.println(i); } static void change(int n) { n = n + 2; } } Output I'm getting - 0 Output I want - 2 Please help me change my code.
score: 0
linked to: http://stackoverflow.com/q/1068760
answer count: 1

http://stackoverflow.com/q/25098155
has comment: http://stackoverflow.com/comment/39058074
has answer: http://stackoverflow.com/a/25098398
accepted answer: http://stackoverflow.com/a/25098398
score: 0
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/25098244
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39056078
has answer: http://stackoverflow.com/a/25098244
tagged with: unit-testing
has body: I have a class that normally runs in a thread that processes data forever until another thread invokes stop() on it. The problem I have is that the unit test gets stuck in the main loop since the test is single threaded and I want to keep it that way. How can I unit test this without polluting the code? this class is part of a critical system and needs to be as simple and efficient as possible so I want to avoid unit testing hacks in the code public class MyClass implements Runnable { boolean running; public void run() { //foo is injected from the outside foo.start(); work(); foo.end(); } public void work() { running = true; while(running) { //main loop bar.process(); //bar is injected from the outside } } public void stop() { running = false; } } Basically what I'm doing in the test is mocking out foo and bar and I call run() from the unit test, where later I verify in the bar mock whether process was actually called. I also verify that in the foo mock start() and end() got called. The problem is that because I really want to keep the test single threaded, the test thread gets stuck forever in the while(running) loop. Some things I have tried and don't like add some VM property to trigger a break at the end of the iteration of the main loop. The problem with this is that as mentioned, this code is very critical and I want to keep the code clear of unit-testing clutter. I don't want production code evaluating in every iteration some VM property that I only use at development time use the bar mock to invoke stop() on its call of process(). Mockito doesn't like the fact that I call another class' method and throws an exception externalize the control of the mainloop. so instead of checking a boolean in the while, I call a method that returns whether to continue or not. And this loop-control object can be injected from the outside, that way in the unit test i can make the control method return true and then false to get a single iteration out of the loop. This complexi…
type: Question
has title: how to unit test this threaded code
answer count: 2
tagged with: mockito

http://stackoverflow.com/a/25186430
has comment: http://stackoverflow.com/comment/39219198
score: 42
has comment: http://stackoverflow.com/comment/39218818
upvote count: 42
has comment: http://stackoverflow.com/comment/39218985
has comment: http://stackoverflow.com/comment/39219093
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25185634
has comment: http://stackoverflow.com/comment/39220217
accepted answer of: http://stackoverflow.com/q/25185634
has comment: http://stackoverflow.com/comment/39220121
has comment: http://stackoverflow.com/comment/39219130
has comment: http://stackoverflow.com/comment/39220385
type: Answer
has body: Goto Windows -> Preferences Java -> Installed JREs –> Execution Environment JavaSE1.x -> JDE 1.x If you don’t have the JDK in the Installed JRE, then Select the Installed JRE and Add the JDK installed path Let's try to configure your run configurations to clean install Click on the small black arrow and then Run Configurations After, you just put clean install in your Maven goal, like this : And then, try to run your compilation, and we will see what happens... :)

http://stackoverflow.com/a/25227619
upvote count: 1
score: 0
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/39296781
answers question: http://stackoverflow.com/q/25226014
has comment: http://stackoverflow.com/comment/39296327
has body: maybe this version will be usefull. make Element interface generic interface Element&lt;V&gt; { &lt;R&gt; R accept(V visitor); } and SpecificElement should be so: public class SpecificElement implements Element&lt;SpecificVisitor&gt; { public &lt;R&gt; R accept(SpecificVisitor visitor) { return visitor.visit(); } } note that Element_s generic type V is not strict type, there can be anything. implementor of Element interface, can write any class in it, even if it doesn't implement Visitor interface. this is the disadvantage of this code.
has comment: http://stackoverflow.com/comment/39296522

google-maps-android-api-2
tags question: http://stackoverflow.com/q/25147631
type: Tag
tag name: google-maps-android-api-2
tags question: http://stackoverflow.com/q/25152255

http://stackoverflow.com/q/25154298
tagged with: java
has comment: http://stackoverflow.com/comment/39168494
has comment: http://stackoverflow.com/comment/39181057
type: Question
linked to: http://stackoverflow.com/q/8210702
has comment: http://stackoverflow.com/comment/39191711
tagged with: weblogic
has comment: http://stackoverflow.com/comment/39191734
score: 0
has title: Java/Coldfusion Weblogic error
has comment: http://stackoverflow.com/comment/39193431
type: UnansweredQuestion
tagged with: soap
tagged with: coldfusion
answer count: 0
has body: I have a .jar which is accessed to create signed SOAPs by ColdFusion, this works fine when I run it on my local host, however when I run it on the server (Weblogic) it gives me the error: "Unable to create message factory for SOAP: weblogic.webservice.core.soap.MessageFactoryImpl" Unfortunately I don't have access to poke around in Weblogic all I can do is pass over .jar and .cfm files to be used. Since this works fine locally I assume it is some other external dependency that I am missing, or a different version of a dependency is being run, but I have no idea how I can go about fixing it. (I have already tried this: weblogic.webservice.core.soap.MessageFactoryImpl cannot be cast to javax.xml.soap.MessageFactory )

http://stackoverflow.com/comment/39278520
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25208799
score: 0
has text: Can we perform AES 256 encryption by just using BC jars alone, without overwriting JCE policy jars in jdk lib folder. I tried following the link, but wiki page itself is down from BC website. http://stackoverflow.com/questions/12895031/aes-256bit-encryption-with-bouncy-castle-unlimited-strength-policy-still-requir?rq=1

http://stackoverflow.com/a/25133325
has comment: http://stackoverflow.com/comment/39120805
has comment: http://stackoverflow.com/comment/39121055
type: Answer
answers question: http://stackoverflow.com/q/25133157
has comment: http://stackoverflow.com/comment/39121108
downvote count: 1
has comment: http://stackoverflow.com/comment/39121396
has body: I've written the following 2 methods: public static void cast() { long l = 123L; double d = (double)l / 1000; } public static void valueOf() { long l = 123L; double d = Double.valueOf(l) / 1000; } As you can see this is the simplified version of yours code; I did it to make the experiment cleaner. Now, I compiled the code and then printed the bytecode using javap -v: public static void cast(); flags: ACC_PUBLIC, ACC_STATIC Code: stack=4, locals=4, args_size=0 0: ldc2_w #2 // long 123l 3: lstore_0 4: lload_0 5: l2d 6: ldc2_w #4 // double 1000.0d 9: ddiv 10: dstore_2 11: return LineNumberTable: line 3: 0 line 4: 4 line 5: 11 public static void valueOf(); flags: ACC_PUBLIC, ACC_STATIC Code: stack=4, locals=4, args_size=0 0: ldc2_w #2 // long 123l 3: lstore_0 4: lload_0 5: l2d 6: invokestatic #6 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double; 9: invokevirtual #7 // Method java/lang/Double.doubleValue:()D 12: ldc2_w #4 // double 1000.0d 15: ddiv 16: dstore_2 17: return LineNumberTable: line 8: 0 line 9: 4 line 10: 17 As we can see the code of 2 methods is similar, but in second case we have (as expected) invocations of valueOf() and then of doubleValue(). So, it seems that unless you have some very special reasons you just should use casting. It is shorter, clearer and more cheaper in terms of CPU usage.
has comment: http://stackoverflow.com/comment/39121349
score: -1
has comment: http://stackoverflow.com/comment/39121147
has comment: http://stackoverflow.com/comment/39120601
upvote count: 0

http://stackoverflow.com/comment/39270987
type: QuestionComment
has text: The technicalities are basically left to you. I would probably write each model into it's own buffer. Seems cleaner. The way you could implement it is easy: you probably have some sort of `Draw()` function that issues opengl to render your model. Before you do so, you check the distance between the camera eye and the model's position. If it's larger than a certain amount, you render the low-resolution model. If it's close enoug, you render the full-resolution model. And tadaa, you've implemented distance-based model LOD.
score: 1
comment on: http://stackoverflow.com/q/25210516
type: Comment

checked
tags question: http://stackoverflow.com/q/25204031
tag name: checked
type: Tag

http://stackoverflow.com/q/25183872
has comment: http://stackoverflow.com/comment/39213896
has comment: http://stackoverflow.com/comment/39214368
favorite count: 0
has body: I implement equals() the Java 7 way: @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MyClass other = (MyClass) obj; return Objects.equal(myFirstField, other.myFirstField) &amp;&amp; Objects.equal(mySecondField, other.mySecondField); } Is there a way to reduce the code duplication? I would prefer something like @Override public boolean equals(Object obj) { if (Objects.equalsEarlyExit(this, obj)) return Objects.equalstEarlyExitResult(this, obj); MyClass other = (MyClass) obj; return Objects.equal(myFirstField, other.myFirstField) &amp;&amp; Objects.equal(mySecondField, other.mySecondField); } Or similar.
has comment: http://stackoverflow.com/comment/39214318
has comment: http://stackoverflow.com/comment/39214435
has answer: http://stackoverflow.com/a/28394306
has comment: http://stackoverflow.com/comment/39214290
score: 10
answer count: 4
tagged with: boilerplate
has comment: http://stackoverflow.com/comment/39214460
has comment: http://stackoverflow.com/comment/39213872
tagged with: equals
has answer: http://stackoverflow.com/a/25184650
has comment: http://stackoverflow.com/comment/39214569
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39214525
has comment: http://stackoverflow.com/comment/39214414
type: Question
has comment: http://stackoverflow.com/comment/39213748
has answer: http://stackoverflow.com/a/25184301
tagged with: java
has answer: http://stackoverflow.com/a/25184564
upvote count: 10
has comment: http://stackoverflow.com/comment/39214737
has title: Can Java help me avoid boilerplate code in equals()?
has comment: http://stackoverflow.com/comment/39213985
has comment: http://stackoverflow.com/comment/39213893
downvote count: 0

http://stackoverflow.com/q/25090999
downvote count: 0
has title: why error " Syntax error on token "println", = expected " in the following code?
favorite count: 0
has body: In the following code I added some System.out.println statements so that i can see the changes of values of variables everytime . But I now am having error " Syntax error on token "println", = expected " , though I checked everything and coundn;t find any mistakes . And before adding those System.out.println statements , everything was ok . Here is my code : public class A{ public static int temp = 4; //System.out.println("temp = "+temp); public int sum; System.out.println("sum = " + sum); public int y; System.out.println("y = " + y); public A(int x){ y = temp - 2 +x; System.out.println("y = " + y); sum = temp + 3; System.out.println("sum = " + sum); temp-=2; //System.out.println("temp = "+temp); } public void methodB(int m, int n){ int x = 0; y = y + m + (temp++); System.out.println("y = " + y); x = x + 2 + n; System.out.println("x = " + x); sum = sum + x + y; System.out.println("sum = " + sum); System.out.println(x + " " + y+ " " + sum); } } class B extends A { public int x; public int sum; System.out.println("sum = "+sum); public B(int p){ super(p); y = temp + p ; System.out.println("y = "+y); sum = p+ temp + 1; System.out.println("sum = "+sum); temp-=1; } public void methodB(int m, int n){ int y =0; y = y + this.y; System.out.println("y = " + y); x = this.y + 2 + temp; System.out.println("x = " + x); super.methodB(x, y); sum = x + y + super.sum; System.out.println("sum = " + sum); System.out.println(x + " " + y+ " " + sum); } } class Test { public static void main(String [] args){ A a1 = new A(2); B b1 = new B(3); a1.methodB(1, 1); b1.methodB(1, 2); a1.methodB(3, 2); b1.methodB(2, 2); } }
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25091263
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25091024
answer count: 2

http://stackoverflow.com/comment/39205145
has text: The exception is caught inside configuration.buildSessionFactory(serviceRegistry);
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25162289
score: 0

http://stackoverflow.com/q/25200430
answer count: 0
tagged with: css-transitions
tagged with: java
type: Question
has body: I have rollover link that works fine for desktop with the hover pseudo class. (view it here http://www.rtmf.org.uk/ret-pri-trns.html ) I have tried to add a 'click event' with jQuery so it works on tablet/mobile devices. It triggers fine with click but it doesn't toggle back to its original state once clicked again. Here is my html and css. (css only includes -webkit prefix for testing ) RTMF provides a no-cost Right to Manage service for retired leaseholders. Read More Right to Manage for Retirement Blocks .retirement { height: 253px; overflow: hidden; position: relative; text-align: center; width: 380px; } .retirement a { color: rgba(27,252,10,.65); opacity: 0; position: relative; text-decoration: none; } p, h2, i { font-family: "aktiv-grotesk-std-n2", "aktiv-grotesk-std",sans-serif; font-style: normal; font-weight: 200; position: relative; z-index: 5; } p, h2 { color: #fff; padding: 0 15px; } .retirement p { font-size: 1.8em; opacity: 0; text-align: center; top: 0; webkit-transform: translateY(253px); webkit-transition: all .2s ease-in; } a:hover { color: rgba(27,252,10,1); } .retirement i { color: #fff; margin: 0; text-align: center; top: -24px; webkit-transition: all .2s ease-in .2s; } .retirement h2 { font-size: 1.2em; margin: 0; text-align: center; top: -31px; webkit-transition: all .2s ease-in .4s; } .green_mask { background-color: rgb(8, 109, 3); height: 253px; left: 0px; position: absolute; top: 190px; webkit-transition: all .3s ease-in-out; width: 380px; z-index: 3; } .opacity_mask { background-color: rgb(12, 61, 9); height: 253px; left: 0; opacity: 0; position: absolute; top: 190px; transition: all .2s ease-in-out; webkit-transition: all .2s ease-in-out; width: 380px; z-index: 4; } img[src="images/block-links/ret-image.jpg"] { left: 0px; position: absolute; top: 0px; z-index: 1; } img[src="images/block-links/ret-image-blur.jpg"] { left: 0px; opacity: 0; position: absolute; top: 0px; webkit-transition: all .2s ease-in .1s; z-index: 2; } .retirement:hover …
has comment: http://stackoverflow.com/comment/39246866
score: 0
has title: applying onClick trigger to transitions for tablet/mobile devices
tagged with: jquery
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/39245142
tagged with: css

http://stackoverflow.com/q/25075683
has answer: http://stackoverflow.com/a/25076885
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25075879
has answer: http://stackoverflow.com/a/32066557
accepted answer: http://stackoverflow.com/a/32066557
score: 33
has title: Spring MVC validator annotation + custom validation
type: Question
possible better answer: http://stackoverflow.com/a/25076885
answer count: 3
has comment: http://stackoverflow.com/comment/39012868
tagged with: validation
upvote count: 33
favorite count: 0
has body: I'm working on spring mvc application, where I should aplly validation based on Spring MVC validator. I first step for that I added annotation for class and setup controller and it works fine. And now I need to implement custom validator for perform complex logic, but i want to use existing annotation and just add additional checking. My User class: public class User { @NotEmpty private String name; @NotEmpty private String login; // should be unique } My validator: @Component public class UserValidator implements Validator { @Autowired private UserDAO userDAO; @Override public boolean supports(Class&lt;?&gt; clazz) { return User.class.equals(clazz) || UsersForm.class.equals(clazz); } @Override public void validate(Object target, Errors errors) { /* ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "NotEmpty.user"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "login", "NotEmpty.user"); */ User user = (User) target; if (userDAO.getUserByLogin(user.getLogin()) != null) { errors.rejectValue("login", "NonUniq.user"); } } } My controller: @Controller public class UserController { @Autowired private UserValidator validator; @InitBinder protected void initBinder(final WebDataBinder binder) { binder.setValidator(validator); } @RequestMapping(value = "/save") public ModelAndView save(@Valid @ModelAttribute("user") final User user, BindingResult result) throws Exception { if (result.hasErrors()) { // handle error } else { //save user } } } So, Is it possible to use custom validator and annotation together? And if yes how?

http://stackoverflow.com/comment/39195522
has text: @KickButtowski You can use it just the way it is in Java 8 ;) - Just because there's a "feature" doesn't mean you need to run out and use. Not everyone is using 8 and Lambda functions are not backwards compatible...
type: Comment
comment on: http://stackoverflow.com/a/25173290
score: 0
type: AnswerComment

http://stackoverflow.com/a/25083892
type: AcceptedAnswer
has body: It's very simple using DOM parser using getAttributes().getNamedItem("keyname") method. sample code: import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; public class SpringXMLParser { public static void parse(String file) throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dbf.newDocumentBuilder(); Document doc = docBuilder.parse(new FileInputStream(file)); Element root = doc.getDocumentElement(); org.w3c.dom.NodeList nodeList = root.getElementsByTagName("key"); for (int i = 0; i &lt; nodeList.getLength(); i++) { System.out.print(((Node) nodeList.item(i)) .getAttributes().getNamedItem("keyname")); System.out.println("\tvalue: "+((Node) nodeList.item(i)).getTextContent()); } } public static void main(String args[]) throws Exception { parse("resources/xml5.xml"); } } output: keyname="info" value: keyname="name" value: keyname="address" value: keyname="id" value: 13
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25083804
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25083804

http://stackoverflow.com/q/25224530
has answer: http://stackoverflow.com/a/25224700
accepted answer: http://stackoverflow.com/a/25224700
tagged with: parameters
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25224560
tagged with: methods
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25224560
tagged with: arrays
tagged with: sorting
favorite count: 0
upvote count: 3
has body: I'm trying to write a sorting program that will ask a user what type of sorting method to use (insertion, bubble, selection) and then ask him to enter integers to sort. I think I have everything correct except for the array: I want the size of the array to be big as the number of integers the user enters, but I do not seem to be doing it correctly. In the sorting class, where the insertionSort method is, should I have the input parameter named like that (through out the algorithm) or should I make a generic name like "arr"? Where can I improve and correct my code? Thanks for any help!! DriverSort class: import java.util.Scanner; public class DriverSort { public static void main(String[] args) { Scanner scan =new Scanner(System.in); Sorter sorter = new Sorter(); int choice;// variable which says which sorting algorithm to use System.out.println("1-Insertion sort\n" +"2-Selection sort\n" + "3-Bubble sort\n" + "0-quit\n"); int size = scan.nextInt(); int input[] = new int[size]; System.out.println("Please enter the number for a sorting method or enter 0 to quit: "); size = scan.nextInt(); System.out.println("\nBefore Sorting: "); sorter.printArray(input); // sort the array Sorter.insertionSort(input); System.out.println("\nAfter Sorting: "); sorter.printArray(input); switch (choice) { case 0: System.out.println("Goodbye!"); System.exit(0); break; case 1: Sorter.insertionSort(input); sorter.printArray(input); break; } } } Sorter class: public class Sorter { public static int[] insertionSort(int[] input) { for (int i = 1; i &lt; input.length; i++) { int valueToSort = input[i]; int j = i; while (j &gt; 0 &amp;&amp; input[j - 1] &gt; valueToSort) { input[j] = input[j - 1]; j--; }//end while loop. // insert the element input[j] = valueToSort; }//end for loop return input; }//end insertionSort public void printArray(int[] input) { System.out.println(input.toString()); } }
has title: Java: insertion sort trouble with array size

specifications
type: Tag
tags question: http://stackoverflow.com/q/25202926
tag name: specifications

http://stackoverflow.com/comment/39304190
score: 0
type: Comment
type: QuestionComment
has text: Ok, I see what the issue is. You're using `Bukkit` as your plugin object, instead of `JavaPlugin`. The `Bukkit` object isn't actually meant to be used that way, and that's what's causing the errors. What you need to do is change your `plugin` object to be `JavaPlugin` instead of `Bukkit`. Then, when you are creating your `BukkitListener` class from your class that extends `JavaPlugin`, just pass it `this` for the `plugin` variable.
comment on: http://stackoverflow.com/q/25224454

http://stackoverflow.com/comment/128409141
comment on: http://stackoverflow.com/a/25102072
type: Comment
has text: The only answer that explained the problem in one sentence and then showed how to fix it. Very helpful.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39203776
type: QuestionComment
score: 0
has text: If you are using `HTML 5` then don't need extra validation, just add `required` in `input tag` where you want such a validation.
comment on: http://stackoverflow.com/q/25178372
type: Comment

http://stackoverflow.com/comment/39065344
score: 0
type: AnswerComment
has text: @james large hmmmm you are right...stupid me :) But if you could put all the modifying "requests" in a `concurrentLinkedQueue` and a single thread actually reads that queue and performs the changings to the map? All other Threads would ve read access only.
type: Comment
comment on: http://stackoverflow.com/a/25079445

http://stackoverflow.com/comment/39288334
score: 0
has text: Please elaborate! How do you know that it does not work? Are there any messages you could share? Are you using eclipse with m2e or mvn on the command line?
type: Comment
comment on: http://stackoverflow.com/q/25223393
type: QuestionComment

http://stackoverflow.com/comment/89339160
score: 1
has text: As noted in the solution below this one you don't always have an entity class to add the annotations to, at least not the right one. Pretty common when calling stored procedures to map the results onto a DTO and you don't have an entity version of that DTO (for obvious reasons). Solution below solves that scenario.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25184489

http://stackoverflow.com/a/25225985
type: Answer
has comment: http://stackoverflow.com/comment/39292761
answers question: http://stackoverflow.com/q/25225946
has comment: http://stackoverflow.com/comment/39292820
upvote count: 1
downvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/39292742
has body: toString() may not always print what you want. If you use it on objects* that have not been overridden, it'll print the address of the object. You can overwrite toString() to behave as you need.

http://stackoverflow.com/q/25095631
type: Question
tagged with: google-maps
accepted answer: http://stackoverflow.com/a/25095728
score: 0
tagged with: google-maps-markers
has answer: http://stackoverflow.com/a/25095728
answer count: 1
has body: I am getting the values for latitude,longitude,title and snippet however when i run it the markers are not displaying.Below is my code snippet. @Override public void onMapData(boolean isSet) { initializeMap(); List&lt;LocationBean&gt; locData = pShelf.getLocationData(); if (!isFromSplash) pShelf.setOfferCount(locData.size()); // TODO: Check here if any // errors for locations list // in future for (int i = 0; i &lt; locData.size(); i++) { Log.wtf("location Acitvity","Lat"+(int) (locData.get(i).getmLat() * 1e6)+"Long"+(int) (locData.get(i).getmLng() * 1e6)); Log.wtf("LocationActivity",locData.get(i).getMVendorName()); Log.wtf("LocationActivity",locData.get(i).getmAddress()); Log.wtf("LocationActivity","Siiiiize" +locData.size()); googleMap.addMarker(new MarkerOptions() .position(new LatLng((int) (locData.get(i).getmLat() * 1e6),(int) (locData.get(i).getmLng() * 1e6))) .title(locData.get(i).getMVendorName()) .snippet(locData.get(i).getmAddress())); } listViewBtn.setEnabled(true); } Please Help!
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
has title: Multiple marker Not Displaying In Google Maps V2

http://stackoverflow.com/q/25192550
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25295155
upvote count: 1
tagged with: gwt
tagged with: java
type: Question
answer count: 2
downvote count: 0
has title: GWT event prevent default not working in Java
favorite count: 0
has body: I'm new to GWT and I need to get a right click working. The doco I've read suggests that I need to override the onBrowserEvent() method. I'm just experimenting at this stage. the event is processed and my pop-up appears. However, as soon as I close the pop-up, the usual browser drop down menu appears (with options like "Bookmark this page" and such). I'm using IceWeasel 24.5.0 (FireFox clone for Debian) and, obviously, Debian (wheezy). Here's the relevant code: public ActivityTextCell() { super(BrowserEvents.MOUSEDOWN, BrowserEvents.MOUSEUP); } @Override public void onBrowserEvent( com.google.gwt.cell.client.Cell.Context context, Element parent, ActivityDTO value, NativeEvent event, ValueUpdater&lt;ActivityDTO&gt; valueUpdater) { super.onBrowserEvent(context, parent, value, event, valueUpdater); event.preventDefault(); event.stopPropagation(); if (event.getType().equals(BrowserEvents.MOUSEUP)) { Window.alert("mouse up event"); } else { switch ( event.getButton()){ case NativeEvent.BUTTON_RIGHT: Window.alert("right mouseclick"); break; case NativeEvent.BUTTON_LEFT: Window.alert("left mouseclick"); break; case NativeEvent.BUTTON_MIDDLE: default: break; // Do nothing } } The class ActivityTextCell extends AbstractCell. So what am I missing? How do I stop the browser from reaticng to the mouse click?
tagged with: events
score: 1
has answer: http://stackoverflow.com/a/25194040

http://stackoverflow.com/q/25208659
answer count: 1
has body: I'm trying to port some Java code in to C#. where CW is a class which extends a view. OnSelectedListener is a interface with Cselected as method which takes an int argument. setListener is a method within the class. the problem is with instantiate a interface like in Java. private View selectedView = new View( context ); CW.setListener( new OnSelectedListener() { @Override public void cSelected(Integer color) { selectedColor = color; selectedView.setBackgroundColor( color ); } }); Another Implementation in same method VS.setListener( new OnSelectedListener() { public void cSelected(Integer color) { VS.setColor( color, true ); } } ); Can anyone please help me port the above code to C#? Any help is appreciated. I'm using Xamarin to develop Android apps. EDIT: Here is the full CW class public class HSVColorWheel : View { private const float SCALE = 2f; private const float FADE_OUT_FRACTION = 0.03f; private const int POINTER_LINE_WIDTH_DP = 2; private const int POINTER_LENGTH_DP = 10; private Context _context; public HSVColorWheel(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { this._context = context; Init(); } public HSVColorWheel(Context context, IAttributeSet attrs) : base(context, attrs) { this._context = context; Init(); } public HSVColorWheel(Context context) : base(context) { this._context = context; Init(); } private int scale; private int pointerLength; private int innerPadding; private Paint pointerPaint = new Paint(); private void Init() { float density = _context.Resources.DisplayMetrics.Density; scale = (int) (density*SCALE); pointerLength = (int) (density*POINTER_LENGTH_DP); pointerPaint.StrokeWidth = (int) (density*POINTER_LINE_WIDTH_DP); innerPadding = pointerLength/2; } public void setListener(OnSelectedListener listener) { _listener = listener; } private float[] colorHsv = {0f, 0f, 1f}; public void setColor(Color color) { Color.ColorToHSV(color, colorHsv); Invalidate(); } } Interface: public interface OnSelectedL…
has comment: http://stackoverflow.com/comment/39261291
tagged with: android
accepted answer: http://stackoverflow.com/a/25209634
type: AnsweredQuestion
tagged with: java
tagged with: xamarin.android
has comment: http://stackoverflow.com/comment/39261455
type: Question
has title: SetListener for View in Xamarin
tagged with: c#
has comment: http://stackoverflow.com/comment/39261955
has comment: http://stackoverflow.com/comment/39261570
has comment: http://stackoverflow.com/comment/39261040
has answer: http://stackoverflow.com/a/25209634
score: 0
tagged with: xamarin
has comment: http://stackoverflow.com/comment/39261534

http://stackoverflow.com/comment/39073915
type: Comment
has text: THANK YOU! I have been beaating myself up over how to store a stupic sublist all along
comment on: http://stackoverflow.com/a/25107917
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39136522
comment on: http://stackoverflow.com/a/25141633
score: 0
type: AnswerComment
has text: I'm using Gradle : compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13' Then importing in my java file: import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter; So I think that's my classpath covered?
type: Comment

http://stackoverflow.com/q/25086515
tagged with: deserialization
score: 0
accepted answer: http://stackoverflow.com/a/25086632
tagged with: udp
answer count: 1
has body: In my implementation, I am using Java serialization to send across a set of binary objects starting with a notification header which tells how many objects are going to be passed and what their respective sizes are. Just to start with simple test, I was able to transfer the header object successfully, and after that I am trying to send just one 1024 bytes data object. However after running the test, I observe following: The first data object is being passed successfully and is received as well. When I send second object, I see that some of the data from first object is still coming as a prefix to the second data set; resulting in truncation of the second object and InvalidClassException. Can someone please provide some pointers as to what is this issue and how to fix this problem? The receiver thread run() method looks like this. public void run() { while (mRunning) { try { // Receive the serialized object byte[] buf = new byte[1024]; DatagramPacket packet = new DatagramPacket(buf, buf.length); socket.receive(packet); System.out.println("SERVER: data received: "); // Display the serialized object. byte[] data = packet.getData(); System.out.println(Arrays.toString(data)); ByteArrayInputStream in = new ByteArrayInputStream(data); ObjectInputStream is = new ObjectInputStream(in); try { Object obj = is.readObject(); if (obj instanceof DatakNotification) { System.out.println("Data notification received: "); } else if (obj instanceof DataChunk) { System.out.println("Data Chunk received: "); } System.out.println(obj); } catch (ClassNotFoundException e) { e.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); mRunning = false; } } socket.close(); } In the logs, I see as follows. First object (header) SERVER: data received: [-84, -19, 0, 5, 115, 114, 0, 47, 99, 111, 109, 46, 99, 111, 110, 97, 46, 118, 105, 100, 101, 111, 99, 108, 105, 101, 11 0, 116, 46, 99, 104, 117, 110, 107, 103, 101, 110, 46, 66, 108, 111, 99, 107, 78, 111, 116, 105, 102, 105, 99, 97, 116,…
tagged with: serialization
has title: InvalidClassException during Java serialization of binary data
has comment: http://stackoverflow.com/comment/39033726
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25086632

http://stackoverflow.com/comment/91167816
has text: FYI, the terribly troublesome old date-time classes such as [`java.util.Date`](https://docs.oracle.com/javase/10/docs/api/java/util/Date.html), [`java.util.Calendar`](https://docs.oracle.com/javase/10/docs/api/java/util/Calendar.html), and `java.text.SimpleDateFormat` are now [legacy](https://en.wikipedia.org/wiki/Legacy_system), supplanted by the [*java.time*](https://docs.oracle.com/javase/10/docs/api/java/time/package-summary.html) classes built into Java 8 and later. See [*Tutorial* by Oracle](https://docs.oracle.com/javase/tutorial/datetime/TOC.html).
type: Comment
comment on: http://stackoverflow.com/a/25190059
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39232169
has text: No I just need to run a websocket client (lets say the one in your code). How do I invoke this in my web app (which is a bunch of JSP pages and servlets)?
type: Comment
comment on: http://stackoverflow.com/a/25193299
score: 0
type: AnswerComment

http://stackoverflow.com/q/25082148
downvote count: 0
has answer: http://stackoverflow.com/a/53109417
linked to: http://stackoverflow.com/q/8495327
tagged with: spring-security
favorite count: 0
has answer: http://stackoverflow.com/a/25085036
has answer: http://stackoverflow.com/a/66803784
has title: Spring Websockets @SendToUser without login?
answer count: 5
possible better answer: http://stackoverflow.com/a/26242797
tagged with: spring
has answer: http://stackoverflow.com/a/26242797
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/43430736
upvote count: 17
type: Question
accepted answer: http://stackoverflow.com/a/25085036
has body: I have a simple spring application with websocket functionality and everything works so far. Now I want to send a message from my server to a specific client using the @SendToUser annotation. This gives me the error "Ignoring message, no principal info available". I understand that i have no login whatsoever on my server, so every user is "anonymous" and does not have a principal (I am not using spring security for now). But every user has a session-id. Isnt it possible to use the session id somehow to differentiate between users? How can i achieve that so my users get a principal which corresponds to the session-id?
tagged with: spring-websocket
tagged with: java
score: 17
linked to: http://stackoverflow.com/q/28009764
tagged with: spring-messaging

http://stackoverflow.com/q/25183780
upvote count: 1
has answer: http://stackoverflow.com/a/25183859
has title: How implement InternalFrameListener?
tagged with: jinternalframe
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25183891
tagged with: swing
has comment: http://stackoverflow.com/comment/39213555
downvote count: 0
score: 1
tagged with: java
type: Question
has body: As I am able to implement WindowListener for JFrame (code below) I wanted to do the same for my JInternalFrame, I tried many alternative out there but nothing works for me, any suggestions ? this.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent MyWindowEvent) { method.relayout(true); } });
answer count: 2
tagged with: windowlistener

http://stackoverflow.com/comment/39135165
score: 0
comment on: http://stackoverflow.com/q/25141087
type: Comment
type: QuestionComment
has text: @greg-449 Please take a look of the background to see if that is make sense to you

http://stackoverflow.com/comment/39072588
type: QuestionComment
score: 0
has text: provide some code so that someone can help you
comment on: http://stackoverflow.com/q/25107612
type: Comment

http://stackoverflow.com/comment/39039524
comment on: http://stackoverflow.com/q/25089689
type: Comment
has text: where is the error message come from? if it is a shell, you can try to open a new shell? if it is some IDE, you can try to restart the IDE
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39042223
type: Comment
has text: This is not working..neither any error is coming...i put one alert in this function which is coming fine but after that nothing is happening..
comment on: http://stackoverflow.com/a/25081413
score: 0
type: AnswerComment

http://stackoverflow.com/q/25188014
tagged with: push
tagged with: egit
type: UnansweredQuestion
score: 2
downvote count: 0
favorite count: 0
tagged with: pull
has title: eclipse egit, repository unable to push, pull or fetch, after sharing the project
type: Question
has comment: http://stackoverflow.com/comment/39256309
has comment: http://stackoverflow.com/comment/39247928
has answer: http://stackoverflow.com/a/25188649
has body: I shared my project in eclipse, by Right Click -> Team -> Share. In the wizard: Add the URL, user, password. Advanced -> set master remote and local -> Save and Push. Then I tested by making some changes, and push, and it was working. My friend used clone to get the same project. She made some changes, I tried fetch/pull, both of them gives the error: Nothing to fetch. I tried Push, which gives the error: rejected-non fast forward! My Error Log View: eclipse.buildId=4.3.2.M20140221-1700 java.version=1.8.0_20-ea java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US Framework arguments: -product org.eclipse.epp.package.jee.product Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product Error Thu Aug 07 10:28:51 EDT 2014 Can't connect to any repository: https://Andisheh86@bitbucket.org/Andisheh86/semanticsearch.git (Nothing to push.) Warning Thu Aug 07 10:57:38 EDT 2014 Keybinding conflicts occurred. They may interfere with normal accelerator operation. The content of ".git/config" [core] repositoryformatversion = 0 filemode = false logallrefupdates = true [remote "origin"] url = https://Andisheh86@bitbucket.org/Andisheh86/semanticsearch.git push = refs/heads/master:refs/heads/master [branch "master"] remote = origin merge = refs/heads/master
upvote count: 2
tagged with: java
tagged with: eclipse
answer count: 1
has comment: http://stackoverflow.com/comment/39273384

http://stackoverflow.com/q/25173441
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: Evict and contains on Cache in JPA
type: Question
has answer: http://stackoverflow.com/a/25177139
accepted answer: http://stackoverflow.com/a/25177139
upvote count: 1
answer count: 1
tagged with: jpa
has body: In JPA,if I have two entity classes Account and CheckingAccount,such that CheckingAccount extends Account.I have a CheckingAccount entity instance with primary key of 10. Cache c=//get a reference to caache from entity manager factory c.evict(Account.class,10); boolean flag1=c.contains(Account.class,10); boolean flag2=c.contains(CheckingAccount.class,10); will the value of both flags be false.
favorite count: 0

http://stackoverflow.com/comment/39203872
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25177379
has text: @Concentrated_Attitude You can find them in SO: http://stackoverflow.com/questions/1394265/what-is-the-difference-between-a-javabean-and-a-pojo
score: 0

http://stackoverflow.com/a/25224555
answers question: http://stackoverflow.com/q/25224498
type: Answer
accepted answer of: http://stackoverflow.com/q/25224498
downvote count: 1
has comment: http://stackoverflow.com/comment/45556501
upvote count: 5
score: 4
has body: Something like this: Arrays.sort(products, new Comparator&lt;Product&gt;() { @Override public int compare(Product p1, Product p2) { if (p1.getPrice() &gt; p2.getPrice()) return -1; if (p1.getPrice() &lt; p2.getPrice()) return 1; return 0; } });
type: AcceptedAnswer

http://stackoverflow.com/q/25109460
tagged with: java
has title: Export strings to email body
tagged with: string
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25109858
tagged with: android
tagged with: email
tagged with: android-activity
has body: I have searched and I only found a similar question that was unanswered. I have a final report made of answers that have been input throughout the app. Now I've reached the end and I want to, basically, export the report to the email body. package com.toc.maintenancereport; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView; public class Report extends Activity { Button sendmail; TextView elec1out, elec2out, elec3out, gasout, waterout, item1out, item2out, item3out, item4out, item5out, item6out, glsout, golfout, candlesout, gu10out, mr16out, g4capsout, fridgeout, cookhoodout, lamp1out, lamp2out, lamp3out, postout, cleanout, ironout, hairdryerout, hooverout, binsout, roofout, garageout, spaceout, outsideout, orderout, siliconeout, handlesout, furnitureout, wallsout, curtainsout, drawsout, itemsout, showerout, holesout, leaksout, tapsout, toiletsout, radout, thermoout, heatingout, wtanksout, hwaterout, boilerout, ovenout, clocksout, bulbsout, name, kettleout, tvout, fblanket, phoneout, fdoor, salarm, fescape, windowsout, consumerout, callout, internetout, issuesout; String reportemail, elec1, elec2, elec3, gas, water, stockitem1, stockitem2, stockitem3, stockitem4, stockitem5, stockitem6, priceitem1, priceitem2, priceitem3, priceitem4, priceitem5, priceitem6, item1, item2, item3, item4, item5, item6, gls, golf, candles, gu10, mr16, g4caps, fridge, cookhood, lamp1, lamp2, lamp3, lamp1price, lamp2price, lamp3price, post, clean, iron, hairdryer, hoover, bins, roof, garage, space, outside, order, silicone, handles, furniture, walls, curtains, draws, items, shower, holes, leaks, taps, toilets, rad, thermo, heating, wtanks, hwater, boiler, oven, clocks, name2, internet, phone, kettle, tv, windows, consumer, firedoor, smok…
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25109858

http://stackoverflow.com/comment/105965553
has text: Sorry this is an old topic but what about multi commands in this case not only one single echo command?
type: Comment
comment on: http://stackoverflow.com/a/35144372
score: 1
type: AnswerComment

http://stackoverflow.com/q/25097212
has answer: http://stackoverflow.com/a/25097237
has comment: http://stackoverflow.com/comment/39055935
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39056857
has comment: http://stackoverflow.com/comment/39053289
linked to: http://stackoverflow.com/q/40480
linked to: http://stackoverflow.com/q/11912406
has comment: http://stackoverflow.com/comment/39054799
has comment: http://stackoverflow.com/comment/39053138
duplicate of: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/39053125
has comment: http://stackoverflow.com/comment/39070607
tagged with: java
type: UnansweredQuestion
has body: I referred to this question but it does not offer what I am asking about. I have some variables which are declared globally and, initially, they are assigned to NULL. Inside the constructor I call a function called "newGame()", this function initialise the variables. And inside onDraw() I am trying to draw a text contains the size of one of the variables that I have initialised inside the newGame() function, and when I run the app, it crashes, and logCat says: NPE. So, i think, if the constructor is called first, my variables should have been initialsed, so that there should be no NPE. But, since there is NPE, it seems that, onDraw() is called before the constructor, is that true? Update_1 I have also placed the newGame() function inside onSizeChanged() but, I receive the same NPE Update_2 I am checking if an object of a hashmapis null or not like this in the following: if (obj == null) is it correct to check whether or not an object is null? Update_3 here is how I initialise the "hand" if (hand == null) { Log.i(TAG, "@dealCards: Hand hashMap was NULL, it will be initialised"); hand = new HashMap&lt;Integer, Card&gt;(); } Code private HashMap&lt;Integer, Card&gt; deck = null; private HashMap&lt;Integer, Card&gt; tableHand = null; private HashMap&lt;Integer, Card&gt; myHand = null; private HashMap&lt;Integer, Card&gt; compHand = null; .... .... //CONSTRUCTOR public GameView(Context context) { super(context); // TODO Auto-generated constructor stub mContext = context; scale = mContext.getResources().getDisplayMetrics().density; textPaint = new Paint(); textBounds = new Rect(); deckSize_String = "Deck_Size: "; cardArraySize_String = "cardsArraySize: "; textPaint.setAntiAlias(true); textPaint.setColor(Color.RED); textPaint.setStyle(Paint.Style.STROKE); textPaint.setTextAlign(Paint.Align.LEFT); textPaint.setTextSize(scale*15); newGame(); } .... .... //OnDraw() protected void onDraw(Canvas canvas) { // TODO Auto-generated method stub super.onDraw(canvas); canvas.drawText(…
has comment: http://stackoverflow.com/comment/39054739
has comment: http://stackoverflow.com/comment/39056882
has comment: http://stackoverflow.com/comment/39053295
tagged with: ondraw
has comment: http://stackoverflow.com/comment/39055779
has comment: http://stackoverflow.com/comment/39053320
has answer: http://stackoverflow.com/a/25097463
has title: Which is called first the constructor or onDraw()
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/39053148
has comment: http://stackoverflow.com/comment/39054293

http://stackoverflow.com/comment/39147806
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25147435
has text: @jww Updated with openssl output
score: 0

http://stackoverflow.com/comment/43905318
comment on: http://stackoverflow.com/a/25217113
type: AnswerComment
has text: @gyoder - as you found, I think http://stackoverflow.com/questions/26538156 is your best bet for now.
type: Comment
score: 2

http://stackoverflow.com/q/25128024
linked to: http://stackoverflow.com/q/22807912
has answer: http://stackoverflow.com/a/25128604
has answer: http://stackoverflow.com/a/25129027
answer count: 2
downvote count: 0
has body: Today I found strange code into jdk8 sources and couldn't find any explanation. static final Comparator&lt;ChronoLocalDate&gt; DATE_ORDER = (Comparator&lt;ChronoLocalDate&gt; &amp; Serializable) (date1, date2) -&gt; { return Long.compare(date1.toEpochDay(), date2.toEpochDay()); }; Can anyone explain me why &amp; Serializable out of &lt;&gt; ? And it would be great to provide link on documentation. Link to source: AbstractChronology
tagged with: generics
favorite count: 0
upvote count: 8
type: UnansweredQuestion
tagged with: interface
has comment: http://stackoverflow.com/comment/39111161
tagged with: java-8
score: 8
has title: Interface in generic type Java
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39123173

http://stackoverflow.com/a/25114274
score: 2
upvote count: 2
has body: Yes, it is possible. Why wouldn't it be (a million is a relatively small number)? The limit is 2^29 which is 546,870,912 (the number of stored XML documents). The limit for XML elements is 2^31 which is 2,147,483,648 (although this includes all nodes including attributes, texts, etc.). Here is a web page on BaseX statistics regarding example existing databases, the first row of the table also contains the limits (#Files represents the number of stored XML documents, #Nodes represents the number of XML nodes like elements, attributes, texts, etc.): http://docs.basex.org/wiki/Statistics
accepted answer of: http://stackoverflow.com/q/25113900
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25113900
type: Answer

http://stackoverflow.com/q/25175027
score: 0
has answer: http://stackoverflow.com/a/25176515
tagged with: selenium-webdriver
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39197901
tagged with: selenium
has comment: http://stackoverflow.com/comment/39197964
type: Question
has title: How to get the selected value from the dropdown
tagged with: java
has body: I am trying to get the value selected from the dropdown using the below snippet of code: Select dropdown = new Select(driver.findElement(By.xpath(prop.getProperty("items")))); WebElement tmp = dropdown.getFirstSelectedOption(); tmp.getText(); String s = tmp.getText(); System.out.println(s); When I run the application it gives me following error: org.openqa.selenium.StaleElementReferenceException: Element not found in the cache - perhaps the page has changed since it was looked up Thank You
has comment: http://stackoverflow.com/comment/39198066
answer count: 1
has comment: http://stackoverflow.com/comment/39198252

http://stackoverflow.com/comment/39167071
score: 0
has text: Junit was in classpath and it was working fine on my local machine but i am not aware if we need to set again Junit classpth after pushing code to repo. and how ? i am very new to this.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25158522

http://stackoverflow.com/q/25184104
has body: Hi I am using Apache http-components in Java for invoking REST calls. When I attempt a POST on a form, the request is not going through. I figured that is because I am not setting the CSRF token. Could you guys please clarify how I can get the csrf token using apache httpcomponents in a Java Rest Client?. Thanks in Advance.
type: Question
has title: Acquire CSRF token using apache http-components
tagged with: apache-httpcomponents
has comment: http://stackoverflow.com/comment/39214252
score: 1
tagged with: java
downvote count: 0
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/39289879
score: 0
type: Comment
type: QuestionComment
has text: @owlstead for that I would refer you to MSE: [Does the new guidance on duplicate questions suggest closing a question as duplicate, if the original answers the OP's question?](http://meta.stackexchange.com/q/217401/) Note the wording on the duplicate message is "This question already has an answer here". Also look at [Changes to “close as duplicate” (part deux)](http://meta.stackexchange.com/q/166707/) in which its stated that "Now, notice that this is subtly different from saying "If that other question isn't asking the exact same thing as yours." That's because the proof is in the answers."
comment on: http://stackoverflow.com/q/25222406

http://stackoverflow.com/q/25137186
tagged with: java
has title: Java program controlled by Console?
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/17255549
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39127301
has comment: http://stackoverflow.com/comment/39127329
tagged with: console
has answer: http://stackoverflow.com/a/25137242
has body: I want to know if its possible to control my game with arrow keys. It is basic version of "2048" game as a console output. My idea: if(arrowKeyRight is pressed) { moveNumbersToRight } The same for the other arrow keys. Is it possible for my program to read the arrow keys as an output?
score: 2
has comment: http://stackoverflow.com/comment/39127251
has comment: http://stackoverflow.com/comment/39127272
favorite count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/39253344
type: QuestionComment
score: 0
has text: @DavidConrad and what is it? can you explain me?
comment on: http://stackoverflow.com/q/25204619
type: Comment

http://stackoverflow.com/comment/39237705
score: 0
type: QuestionComment
type: Comment
has text: Can you put that as an answer? I replaced it with: android:background="@android:drawable/btn_default"
comment on: http://stackoverflow.com/q/25195988

http://stackoverflow.com/comment/39054594
type: QuestionComment
has text: It would be fairly useless if it did...
comment on: http://stackoverflow.com/q/25097928
score: 6
type: Comment

http://stackoverflow.com/comment/39018592
type: Comment
comment on: http://stackoverflow.com/q/25078810
has text: where you have a button and where is your listener?
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39049069
has text: Use [PrintStringTable](https://github.com/puneetlakhina/javautils/blob/master/src/com/blogspot/sahyog/PrintStringTable.java), I print all the strings in constant pool, thanks.
comment on: http://stackoverflow.com/q/25093340
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25143040
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25130781
has comment: http://stackoverflow.com/comment/42856650
upvote count: 1
type: AcceptedAnswer
has body: I have found a solution, and hope it may save others some grief. It is necessary to tell the SQL Anywhere JDBC driver to use the TCP/IP protocol explicitly. You also don't need to go through ODBC. I run the database server as a stand-alone process, braodcasting a server name "testweb". Then I use the following connection string in my Resource definition: url="jdbc:sqlanywhere:Server=testweb;UID=xxx;PASSWORD=xxx;port=2638;LINKS=tcpip(PORT=2638)" And that does the trick.
answers question: http://stackoverflow.com/q/25130781
type: Answer

http://stackoverflow.com/comment/39259458
has text: @TolgayToklar You always add a new List in the Hashtable. You should create an `ArrayList`, add all your messages in there, and then store this `ArrayList` in the `Hashtable` (look at the other answers)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25205974

http://stackoverflow.com/comment/39056366
has text: For matching this suffices, but for replacing you need to get rid of the spaces. hwnd's `.trim()` is a bit sneaky - it works, but only because there is only one word remaining.
type: AnswerComment
comment on: http://stackoverflow.com/a/25098436
type: Comment
score: 1

http://stackoverflow.com/comment/39025261
type: Comment
type: QuestionComment
has text: Is it in the target folder? IF it is I'm assuming it's the Assembly plug-in that may be messing something up. Maybe you would have better luck with the Shade plugin?
comment on: http://stackoverflow.com/q/25081479
score: 0

http://stackoverflow.com/comment/39226785
has text: Won't that interfere with socket.BeginReceive?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25188231
type: Comment

http://stackoverflow.com/comment/39238594
has text: So are you doing anything with the `mCannyOutArray` output data in `onClick()`? I don't see any evidence of that.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25107427

http://stackoverflow.com/q/25160151
duplicate of: http://stackoverflow.com/q/25157153
downvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/22269623
upvote count: 0
has comment: http://stackoverflow.com/comment/39170735
tagged with: java
has body: I am new to GWT, I want to read a property file, which stores database host, port, username, password. I have placed a config.properties files in server package. Properties prop = new Properties(); prop.load(new FileInputStream("DBConfig.properties")); string host = prop.getProperty("host"); property file... host=127.0.0.1 port=3306 username=root password=root I used constants as well. That didn't work for me. I would really appreciate another approach. Thanks in advance.
type: Question
tagged with: gwt
has title: Read .properties file on Server Side in GWT
has answer: http://stackoverflow.com/a/25160631
score: -1

http://stackoverflow.com/q/25076813
tagged with: google-maps
tagged with: google-maps-api-3
downvote count: 0
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 1
has body: I am developing an android project with google maps and it has custom images for the markers of google map.But instead of downloading the images each time, the first time the marker images are downloaded into internal memory, from the second time onwards i check if the images are downloaded and then they are retrieved from memory. But the code works fine on my phone (Android version 2.6.3) , But when i tried on newer devices (Android 4 and above) the code for retrieving the downloaded bitmap image returns null. The code for checking if the images have been downloaded: public void checkcategoryimagesavailable() { path_file=MainActivity.this.getFilesDir().getAbsolutePath(); for(int i=0;i&lt;catprearr.size();i++) { File file = new File(path_file+File.separator+catprearr.get(i)+".png"); if(file.exists()) { } else { downloadfile(URL_image+catprearr.get(i)+".png",path_file+File.separator+catprearr.get(i)+".png"); } } setvaluesonmap(); } The code for downloading the images: public void downloadfile(String path,String filepath) { try { URL url = new URL(path); URLConnection ucon = url.openConnection(); ucon.setReadTimeout(5000); ucon.setConnectTimeout(10000); InputStream is = ucon.getInputStream(); BufferedInputStream inStream = new BufferedInputStream(is, 1024 * 5); File file = new File(filepath); file.createNewFile(); FileOutputStream outStream = new FileOutputStream(file); byte[] buff = new byte[5 * 1024]; int len; while ((len = inStream.read(buff)) != -1) { outStream.write(buff, 0, len); } outStream.flush(); outStream.close(); inStream.close(); } catch(Exception e) { e.printStackTrace(); } } The code for setting the markers: public void setvaluesonmap() { for(int i=0;i&lt;list.size();i++) { final Store_data s=list.get(i); Bitmap obj=getImageBitmap(MainActivity.this,s.category+".png"); obj=Bitmap.createScaledBitmap(obj,68,62,false); iv_category_logo.setImageBitmap(obj); googleMap.addMarker(new MarkerOptions().title(s.store_name) .icon(BitmapDescriptorFactory.fromBitmap(c…
score: 1
tagged with: java
type: Question
has title: Retrieving bitmap from internal memory fails on newer android versions

http://stackoverflow.com/q/25077431
tagged with: java
tagged with: youtube-data-api
has title: How can I get valid Credential for Google service account?
has body: Hi I am developing a web application where end user will be able to upload video, and that video I want to upload in YouTube server using YouTube data API-V3. So that I am using YouTube data API V3 java library But I am unable to run the code, it gives me runtime Exception . Please help me . I am waiting for your valuable responses .. Here is my code import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson.JacksonFactory; import com.google.api.services.youtube.YouTube; import com.google.api.services.youtube.YouTube.Activities; import java.io.File; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class ServiceAuthToken { final static HttpTransport TRANSPORT = new NetHttpTransport(); static JsonFactory JSON_FACTORY = new JacksonFactory(); public static void main(String []g) throws Exception { List&lt;String&gt;scops = new &lt;String&gt;ArrayList(); scops.add("https://www.googleapis.com/auth/youtube"); GoogleCredential credential = new GoogleCredential.Builder() .setTransport(TRANSPORT) .setJsonFactory(JSON_FACTORY) .setServiceAccountId(Constants.SERVICE_ACCOUNT_ID) .setServiceAccountScopes(scops) .setServiceAccountPrivateKeyFromP12File(new File("key.p12")) //.setClientSecrets("*******.apps.googleusercontent.com","") .setClientSecrets(GoogleClientSecrets.load(JSON_FACTORY,new InputStreamReader(java.io.Reader.class.getResourceAsStream("client_secrets.json")))) .build(); YouTube youtube = new YouTube.Builder(TRANSPORT, JSON_FACTORY,credential).setApplicationName("gleaming-scene-655").build(); Activities act = youtube.activities(); Activities.List list = act.list("s"); } } Exception : run: Exception in thread "main" java.lang.NoSuchMethodError: org.co…
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/11784051
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39043283
has answer: http://stackoverflow.com/a/25078820
tagged with: youtube-api
tagged with: youtube
type: Question
tagged with: jwt

http://stackoverflow.com/comment/39074353
type: Comment
comment on: http://stackoverflow.com/a/25108476
has text: @peeskillet Yes, I am trying to change the code to use Shapes. Once it works with basic functionality.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39152640
score: 0
type: AnswerComment
has text: I dug through JInput's source code for how it actually receives gamepad state, and as an operation, it's very inexpensive to poll an individual state due to internal caching when generating events. If I were to change to processing events instead of checking the individual values, it wouldn't have solved the issue because `poll()` (the method in which JInput determines when to look for events to generate) was happening too frequently on different threads due to hidden functionality within `Display.update()` (see my answer).
comment on: http://stackoverflow.com/a/25149142
type: Comment

http://stackoverflow.com/comment/39258629
score: 0
type: QuestionComment
has text: Thanks to all of you. As I have said in reply to @William, I should have thought of retrieval and not just storage.
type: Comment
comment on: http://stackoverflow.com/q/25206897

http://stackoverflow.com/comment/39033023
comment on: http://stackoverflow.com/q/25085630
has text: @ErstwhileIII kind of, but not quite, what i am doing is this, i need to remote to a linux server, run an awk on a csv file, pull that output back from the linux and process it on my windows machine. :/ I know how i want to use my awk, but do i use the generic print function of awk and read that using the ProcessBuilder? or is there a better way? i'm new to awk and not sure of the right means of getting it. worst comes to worst i'll just write it to a file, and scp the file over to my machine and read from there.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25213058
answer count: 1
has comment: http://stackoverflow.com/comment/39302757
favorite count: 0
has comment: http://stackoverflow.com/comment/39287983
has title: libGDX 3D shadow artifacts
has comment: http://stackoverflow.com/comment/39740710
has comment: http://stackoverflow.com/comment/39302496
has comment: http://stackoverflow.com/comment/39288036
has answer: http://stackoverflow.com/a/25231522
upvote count: 1
tagged with: shadows
linked to: http://stackoverflow.com/q/24724359
type: AnsweredQuestion
tagged with: libgdx
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39301278
has comment: http://stackoverflow.com/comment/39300728
has comment: http://stackoverflow.com/comment/39753517
has comment: http://stackoverflow.com/comment/39276077
type: Question
has comment: http://stackoverflow.com/comment/39283161
tagged with: api
tagged with: 3d
accepted answer: http://stackoverflow.com/a/25231522
downvote count: 0
has comment: http://stackoverflow.com/comment/39269325
has body: I am having some troubles with libgdx 3d shadows. In my game I implemented the experimental DirectionalShadowLight. And everything works great on desktop however when I run it on android there are a lot of artifacts on the ground. Picture (left-android, right-desktop): I took the rendering code almost directly from tests in libgdx's github repositories. Gdx.gl.glClearColor(ExtendedEnvironment.FarBackgroundColor.r,ExtendedEnvironment.FarBackgroundColor.g,ExtendedEnvironment.FarBackgroundColor.b,1); Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); terrain.prepareForShadows(); environment.shadowLight.begin(new Vector3(cam.position.x+10,0,0), cam.direction); shadowBatch.begin(environment.shadowLight.getCamera()); ball.draw(shadowBatch, null); terrain.draw(shadowBatch, null); shadowBatch.end(); environment.shadowLight.end(); terrain.recoverFromShadows(ball.getPosition().x); Theres not much to it. Also considering that it works on desktop I would think that theres something wrong with shadow implementation itself. Is there anything I can do to fix this? Considering that I had never touched a shader in my life. Some simple hack maybe? If not maybe someone could recommend other working shadow implementation for libgdx? Thank you. EDIT: additional code: BlendingAttribute blendAttribute = new BlendingAttribute(1f) IntAttribute intAttribute = IntAttribute.createCullFace(GL20.GL_FRONT); public void prepareForShadows(){ batchedCubesInstance.materials.first().remove(blendAttribute.type); batchedCubesInstance.materials.first().remove(intAttribute.type); } public void recoverFromShadows(float posX){ batchedCubesInstance.materials.first().set(blendAttribute); batchedCubesInstance.materials.first().set(intAttribute); } //creating the batchedMesh: ModelBuilder builder = new ModelBuilder(); builder.begin(); MeshPartBuilder mpb = builder.part("cubes", GL20.GL_TRIANGLES, (Usage.Position | Usag…

http://stackoverflow.com/q/25178402
score: -1
accepted answer: http://stackoverflow.com/a/25178621
has comment: http://stackoverflow.com/comment/39203763
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/39203670
answer count: 3
downvote count: 3
has comment: http://stackoverflow.com/comment/39203723
has body: I am looking for a piece of code in java using which I can get string starting with a # symbol in a sentence or paragraph. This is what I have tried but it didn't work for me. String str = "You can use a Matcher to find all matches to a regular repression #myString"; Pattern p = Pattern.compile("\\b(#)\\w*"); Matcher m = p.matcher(str); while (m.find()) { String match = m.group(); System.out.println(match); } System.out.println("Matches: " + m.matches());
has comment: http://stackoverflow.com/comment/39203720
has answer: http://stackoverflow.com/a/25179286
has comment: http://stackoverflow.com/comment/39203640
has comment: http://stackoverflow.com/comment/39203600
has title: Find a string in a sentence starting with # symbol in java
has answer: http://stackoverflow.com/a/25178621
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25179122
has answer: http://stackoverflow.com/a/25179122
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39203669

http://stackoverflow.com/a/25203757
score: 0
has comment: http://stackoverflow.com/comment/39251662
answers question: http://stackoverflow.com/q/25203501
has comment: http://stackoverflow.com/comment/39251419
has comment: http://stackoverflow.com/comment/131680352
type: Answer
has body: Try out below drawable file. Create file named "circle" in your res/drawable folder and copy below code: <?xml version="1.0" encoding="utf-8"?> <solid android:color="#FFFFFF" /> <stroke android:width="1dp" android:color="#4a6176" /> <padding android:left="10dp" android:right="10dp" android:top="10dp" android:bottom="10dp" /> <corners android:radius="10dp" /> Apply it in your TextView as below:

http://stackoverflow.com/a/25230243
has comment: http://stackoverflow.com/comment/39301015
has comment: http://stackoverflow.com/comment/39301097
type: Answer
answers question: http://stackoverflow.com/q/25230213
has body: You can use the size() of the list: for (int i = 0; i &lt; fullNames.size(); i++) { resultList.add(new Person(fullNames.get(i).getText(), professions.get(i).getText(), streets.get(i).getText(), null, null, null, null, null)); //here I get the nullpointer exception }
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/25187843
type: Question
answer count: 1
downvote count: 0
tagged with: jsp
has body: I am new in jsp and faced with one problem. I need to create jsp page, that displays data from servlet. Servlet code: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { CustomersDao customersDao = new CustomersDaoImpl(); List<Customers> custList = customersDao.getAllCustomers(); request.setAttribute("customersList", custList); request.getRequestDispatcher("/test.jsp").forward(request, response); } jsp page code: <%@page contentType="text/html" pageEncoding="UTF-8"%> JSP Test Page <%--> ${requestScope['customers'].name} ${requestScope['customers'].lastname} ${requestScope['customers'].totalAmount} <--%> <c:forEach var="element" items="${requestScope['customersList']}"> <c:out value="${element.name}" /> TEST.name ${element.lastname} TEST.lastname ${element.totalAmount} TEST.totalAmount ololo </c:forEach> When I send single object to jsp it's work normally (commented part of code). But when I try to send list, I can not separate object and browser shows me only test messages. So how do I fix it?
has comment: http://stackoverflow.com/comment/39221420
accepted answer: http://stackoverflow.com/a/25188510
has title: Display data in jsp
favorite count: 0
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25188510
tagged with: servlets

http://stackoverflow.com/q/25100122
possible better answer: http://stackoverflow.com/a/25100156
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/25100136
tagged with: servlets
has answer: http://stackoverflow.com/a/25100158
answer count: 3
upvote count: 0
tagged with: jsp
favorite count: 0
has title: Why can't I insert into the database with this code? - JSP
has body: I'm trying to insert data into a table based on information from the previous jsp but I keep getting errors. I had print statements to check if the data is transferring and they are. So I think it has something to do with the query statement... &lt;%= session.getAttribute("userid")%&gt; &lt;%= session.getAttribute("deptid")%&gt; &lt;%= session.getAttribute("pid")%&gt; &lt;%= session.getAttribute("sec")%&gt; &lt;% Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; Class.forName(driverName); conn = DriverManager.getConnection(url, user, password); Statement statement = conn.createStatement(); String userdbid = (String)session.getAttribute("userid"); String userdbdeptid = (String)session.getAttribute("deptid"); String userdbpid = (String)session.getAttribute("pid"); String userdbsec = (String)session.getAttribute("sec"); String query = "INSERT INTO request VALUES("+userdbdeptid+","+userdbpid+","+userdbsec+","+userNetID+")"; statement.executeUpdate(query); %&gt; I'm getting this error: org.apache.jasper.JasperException: An exception occurred processing JSP page at statement.executeUpdate(query) But when I run something like: String query = "INSERT INTO request VALUES("575",'76' '01', 'root')"; it works just fine Please help!
accepted answer: http://stackoverflow.com/a/25100136
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25100156
downvote count: 2
tagged with: mysql
type: Question

http://stackoverflow.com/a/31482888
has comment: http://stackoverflow.com/comment/60858412
has comment: http://stackoverflow.com/comment/70009379
answers question: http://stackoverflow.com/q/25102627
has body: I had this same problem with a fresh install of Eclipse Mars on OSX. I had installed the JRE from https://java.com/en/download/ (which is the top google search result for "java download" for me. This failed for me with the same message "version 1.6.0_65 of the JVM is not suitable for this product, version 1.7 or greater is required" Then I saw a comment that I should get the JRE/JDK from oracle instead: http://www.oracle.com/technetwork/java/javase/downloads/index.html After downloading the most recent JDK from Oracle Eclipse starts fine.
downvote count: 0
upvote count: 32
score: 32
type: Answer
has comment: http://stackoverflow.com/comment/55934509
has comment: http://stackoverflow.com/comment/52438186

http://stackoverflow.com/a/25175291
upvote count: 9
has body: When you call sc.close() it closes your underlying stream, which is System.in; once you close System.in the only way to get it back is to restart your program. Per the close() Javadoc, If this scanner has not yet been closed then if its underlying readable also implements the Closeable interface then the readable's close method will be invoked
downvote count: 0
score: 9
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25175249
answers question: http://stackoverflow.com/q/25175249
has comment: http://stackoverflow.com/comment/39198449
type: Answer

http://stackoverflow.com/q/25082688
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25082784
type: Question
score: -2
linked to: http://stackoverflow.com/q/20790900
downvote count: 4
answer count: 1
duplicate of: http://stackoverflow.com/q/20790900
favorite count: 0
has answer: http://stackoverflow.com/a/25082784
has body: I know that java virtual machine make things easier by making our code system independent.But the thing I don't understand is why cannot we use compilers for each platform just like Jvms for each platform??I mean there are Jvms which are system dependent.So why cant we write system dependent compilers instead of Jvms.If it is better and easier to write Jvm than compiler ,in what way it is??? I am sorry if there is anything wrong in my question . Thanks in advance.
upvote count: 2
has comment: http://stackoverflow.com/comment/39025861
has title: Why java virtual machines?

jsp
tags question: http://stackoverflow.com/q/25219263
tags question: http://stackoverflow.com/q/25134774
tags question: http://stackoverflow.com/q/25216951
tags question: http://stackoverflow.com/q/25226343
tags question: http://stackoverflow.com/q/25182650
tags question: http://stackoverflow.com/q/25196926
tags question: http://stackoverflow.com/q/25149243
tags question: http://stackoverflow.com/q/25221545
tags question: http://stackoverflow.com/q/25150470
tags question: http://stackoverflow.com/q/25193278
tags question: http://stackoverflow.com/q/25123031
tags question: http://stackoverflow.com/q/25199107
tags question: http://stackoverflow.com/q/25223175
tags question: http://stackoverflow.com/q/25156974
tags question: http://stackoverflow.com/q/25155040
tags question: http://stackoverflow.com/q/25198224
tags question: http://stackoverflow.com/q/25132680
tags question: http://stackoverflow.com/q/25226308
tags question: http://stackoverflow.com/q/25209015
tags question: http://stackoverflow.com/q/25078885
tags question: http://stackoverflow.com/q/25216152
tags question: http://stackoverflow.com/q/25196984
tags question: http://stackoverflow.com/q/25215984
tags question: http://stackoverflow.com/q/25104978
tags question: http://stackoverflow.com/q/25182986
tags question: http://stackoverflow.com/q/25215379
tags question: http://stackoverflow.com/q/25134814
tags question: http://stackoverflow.com/q/25187843
tags question: http://stackoverflow.com/q/25179720
tags question: http://stackoverflow.com/q/25146811
tags question: http://stackoverflow.com/q/25092202
tags question: http://stackoverflow.com/q/25158798
tags question: http://stackoverflow.com/q/25205517
tags question: http://stackoverflow.com/q/25129245
tags question: http://stackoverflow.com/q/25133954
tags question: http://stackoverflow.com/q/25136412
tags question: http://stackoverflow.com/q/25208220
tags question: http://stackoverflow.com/q/25100122
tags question: http://stackoverflow.com/q/25152296
tags question: http://stackoverflow.com/q/25194496
tags question: http://stackoverflow.com/q/25103254
tags question: http://stackoverflow.com/q/25137791
tags question: http://stackoverflow.com/q/25217734
tags question: http://stackoverflow.com/q/25180615
tags question: http://stackoverflow.com/q/25198367
tags question: http://stackoverflow.com/q/25110478
tags question: http://stackoverflow.com/q/25131719
tags question: http://stackoverflow.com/q/25165047
tags question: http://stackoverflow.com/q/25114192
type: Tag
tags question: http://stackoverflow.com/q/25076469
tags question: http://stackoverflow.com/q/25151693
tags question: http://stackoverflow.com/q/25222409
tags question: http://stackoverflow.com/q/25097435
tags question: http://stackoverflow.com/q/25209084
tags question: http://stackoverflow.com/q/25094873
tags question: http://stackoverflow.com/q/25183443
tags question: http://stackoverflow.com/q/25158481
tags question: http://stackoverflow.com/q/25202581
tags question: http://stackoverflow.com/q/25108836
tags question: http://stackoverflow.com/q/25190267
tags question: http://stackoverflow.com/q/25219135
tags question: http://stackoverflow.com/q/25140571
tags question: http://stackoverflow.com/q/25073790
tags question: http://stackoverflow.com/q/25204889
tags question: http://stackoverflow.com/q/25200052
tags question: http://stackoverflow.com/q/25107612
tags question: http://stackoverflow.com/q/25215719
tags question: http://stackoverflow.com/q/25161586
tags question: http://stackoverflow.com/q/25124816
tags question: http://stackoverflow.com/q/25100777
tag name: jsp
tags question: http://stackoverflow.com/q/25139069
tags question: http://stackoverflow.com/q/25148584
tags question: http://stackoverflow.com/q/25204160
tags question: http://stackoverflow.com/q/25136860
tags question: http://stackoverflow.com/q/25156341
tags question: http://stackoverflow.com/q/25159404
tags question: http://stackoverflow.com/q/25109826
tags question: http://stackoverflow.com/q/25123240

http://stackoverflow.com/a/51185679
downvote count: 0
answers question: http://stackoverflow.com/q/25128219
type: Answer
has body: Add this is work for me codelds https://code.lds.org/nexus/content/groups/main-repo
upvote count: 1
score: 1

http://stackoverflow.com/q/25119269
has comment: http://stackoverflow.com/comment/39094850
type: UnansweredQuestion
has title: Calculating the average word length
has answer: http://stackoverflow.com/a/25119560
has comment: http://stackoverflow.com/comment/39095684
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39094406
linked to: http://stackoverflow.com/q/24649971
tagged with: average
type: Question
tagged with: mean
has answer: http://stackoverflow.com/a/25119577
has answer: http://stackoverflow.com/a/25119405
has body: I am a java beginner with very weak understanding of java. To my already working code which already calculates the number of words in a sentence, total number of characters of a sentence and the total number of characters for each word, I would like to add another function. I would like to add a piece of code which calculates the average of word length, for example if I type in 'hey hi cat dog i', the output would be 2.4. (Because the total number of characters for this sentence is 12, divided by the number of words (5 words) gives the average of 2.4). Underneath there is my piece of code I'm working on and this is what I created based on many tutorials, but they all teach the average for numbers, not word lengths. My thinking is that my code should firstly count the sum of characters for each words (word.length) and then divide it by the sum of words (sentence.length). But it seems not to work. Can you please help me to correct this piece of code? { //prints out average word length int length = wordcount / word.length ; sum = sum + word.length / sentence length; //this counts the sum of characters of words and divides them by the number of words to calculate the average System.out.println("The average word length is " + sum);} //outputs the sum calculated above { Underneath there is my full code to help you understand better what I mean. Thank you for all your help! public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); //This adds a scaner/text window to the program. while(true) { // have created infinite loop. System.out.print("Enter your text or enter 'quit' to finish the program: "); String sentence = in.nextLine(); if(sentence.equals("quit")) { // if enterd value is 'quit' than it comes out of loop break; } else { //else if 'quit' wasn't typed it, the program displays whats underneath. System.out.println("You have entered: " + sentence); // to print what the user has entered in the text window/scanner. System.out.prin…
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/39094321
favorite count: 0

http://stackoverflow.com/q/25114626
type: Question
has answer: http://stackoverflow.com/a/25114752
has body: I am getting an exception java.lang.ArrayStoreException: I am posting my full code. This is the code of encoding a wav file. ArrayStoreException package org.xiph.speex; import static java.nio.file.Files.size; /** * Main Speex Encoder class. * This class encodes the given PCM 16bit samples into Speex packets. * * @author Marc Gimpel, Wimba S.A. (mgimpel@horizonwimba.com) * @version $Revision: 1.6 $ */ public class SpeexEncoder { /** * Version of the Speex Encoder */ public static final String VERSION = "Java Speex Encoder v0.9.7 ($Revision: 1.6 $)"; private Encoder encoder; private Bits bits; private float[] rawData; private int sampleRate; private int channels; private int frameSize; /** * Constructor */ public SpeexEncoder() { bits = new Bits(); } /** * initialization * @param mode the mode of the encoder (0=NB, 1=WB, 2=UWB). * @param quality the quality setting of the encoder (between 0 and 10). * @param sampleRate the number of samples per second. * @param channels the number of audio channels (1=mono, 2=stereo, ...). * @return true if initialisation successful. */ public boolean init(final int mode, final int quality, final int sampleRate, final int channels) { switch (mode) { case 0: encoder = new NbEncoder(); ((NbEncoder)encoder).nbinit(); break; //Wideband case 1: encoder = new SbEncoder(); ((SbEncoder)encoder).wbinit(); break; case 2: encoder = new SbEncoder(); ((SbEncoder)encoder).uwbinit(); break; //*/ default: return false; } /* initialize the speex decoder */ encoder.setQuality(quality); /* set decoder format and properties */ this.frameSize = encoder.getFrameSize(); this.sampleRate = sampleRate; this.channels = channels; rawData = new float[channels*frameSize]; bits.init(); return true; } /** * Returns the Encoder being used (Narrowband, Wideband or Ultrawideband). * @return the Encoder being used (Narrowband, Wideband or Ultrawideband). */ public Encoder getEncoder() { return encoder; } /** * Returns the sample rate. * @return the sample rate. */ publi…
has comment: http://stackoverflow.com/comment/39085611
has comment: http://stackoverflow.com/comment/39085621
has comment: http://stackoverflow.com/comment/39085553
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25114763
has comment: http://stackoverflow.com/comment/39085509
has title: Exception: java.lang.ArrayStoreException
favorite count: 0
has comment: http://stackoverflow.com/comment/39085596
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39085497
downvote count: 2
has comment: http://stackoverflow.com/comment/39085873
tagged with: java
has answer: http://stackoverflow.com/a/25119879

http://stackoverflow.com/a/25113127
has comment: http://stackoverflow.com/comment/39084495
type: Answer
has body: add more data to the list and one ends up overwriting the other. This is how files work by default, in fact the ObjectOutputStream doesn't support an "append" mode. Once you have closed the stream, you can't alter it. How do I make it so I can save data to my file from two different computers at a similar time, without one overwriting the other? You have two problems here how to write to a file twice without losing information. how to co-ordinate writes between processes without one impacting the other. For the first part, you need to read the contents of the list first, add the entries you wand to add, and write out the contents again. OR you can change the file format to one which supports appending. For the second part, you need to use locking of some kind. A simple way to do this is to create a lock file. You can create a second file atomically e.g. file.lock and the one which succeeds in creating the file holds the lock, that process alters the file and deletes the lock which finished. Some care needs to be taken to ensure you always remove the lock. Another approach is to use file locks. You have to take care not to delete the file in the process however this has the benefit that the OS will clean up the lock if your process dies.
answers question: http://stackoverflow.com/q/25112745
has comment: http://stackoverflow.com/comment/39083293
has comment: http://stackoverflow.com/comment/39084027
score: 0
has comment: http://stackoverflow.com/comment/39083221

http://stackoverflow.com/a/25082711
type: Answer
has comment: http://stackoverflow.com/comment/39025954
has body: You may want to add in adapter.notifyDatasetChanged() whenever you change the data displayed.
score: 0
answers question: http://stackoverflow.com/q/25082631
has comment: http://stackoverflow.com/comment/39025926

http://stackoverflow.com/comment/39291088
type: Comment
has text: sorry i take that back i made a syntax error this has actually worked thanks
comment on: http://stackoverflow.com/a/25224568
type: AnswerComment
score: 0

http://stackoverflow.com/q/25208239
score: 4
tagged with: xmltype
possible better answer: http://stackoverflow.com/a/29703014
linked to: http://stackoverflow.com/q/26370270
answer count: 3
tagged with: oracle-database
upvote count: 4
favorite count: 0
has body: I am following the below tutorial to retrieve XMLType data from a stored procedure http://docs.oracle.com/cd/B19306_01/appdev.102/b14259/xdb11jav.htm#g1039140 Example 13-4 XMLType Java: Returning XMLType Data When I run the code, I get this error, Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/parser/v2/XMLParseException at oracle.xdb.XMLTypeFactory.create(XMLTypeFactory.java:67) at oracle.sql.OPAQUE.toClass(OPAQUE.java:328) at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:278) at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:259) at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:190) at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:117) at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:1579) at oracle.jdbc.driver.OracleCallableStatementWrapper.getObject(OracleCallableStatementWrapper.java:815) at com.example.TestXMLDAO.main(TestXMLDAO.java:48) Caused by: java.lang.ClassNotFoundException: oracle.xml.parser.v2.XMLParseException 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) ... 9 more Java code snippet: import java.io.IOException; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import oracle.jdbc.OracleTypes; import oracle.xdb.XMLType; ............. // Prepare to call the stored procedure get_group_details. String sql = "{call mypackage.get_records(?,?,?,?,?,?,?,?)}"; callableStatement = conn.prepareCall(sql); callableStatement.setString(1, ""); callableStatement.setString(2, ""); callableStatement.setString(3, ""); callableStatement.setString(4, ""); callableStatement.setString(5, "abb%"); callableStatement.setString(6, "F"); call…
accepted answer: http://stackoverflow.com/a/25210130
has title: Java: Returning XMLType Data from StoredProcedure, Usage of ojdbc6.jar xdb6.jar xmlparserv2.jar for Java to PLSQL interaction
type: AnsweredQuestion
tagged with: stored-procedures
has answer: http://stackoverflow.com/a/29703014
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25208495
has answer: http://stackoverflow.com/a/25210130
type: Question

http://stackoverflow.com/q/25143837
tagged with: opengl
tagged with: java
possible better answer: http://stackoverflow.com/a/25144814
has answer: http://stackoverflow.com/a/25145723
type: Question
has comment: http://stackoverflow.com/comment/39143161
has title: Converting RGB565 to RGB888 and back
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25144814
has comment: http://stackoverflow.com/comment/39140759
has comment: http://stackoverflow.com/comment/39142247
has comment: http://stackoverflow.com/comment/39140732
has body: I am using 16 bit colors. When I convert the color to rgb888 (8bits per color) and then back to rgb565 (5 bits for red, 6 for green and 5 for blue) I get a slightly darker/grayer image, even when no operations performed on the color. Below are my functions: private static Vector3 col = new Vector3(); public static Vector3 ShortToRGB888( short color ) { float r = (float)((color &amp; 0xF800) &gt;&gt; 8); float g = (float)((color &amp; 0x07E0) &gt;&gt; 3); float b = (float)((color &amp; 0x001F) &lt;&lt; 3); col.set(r, g, b); return col; } public static short RGB888ToShort( Vector3 col ) { col.clamp(0f, 255f); int result = (((int)col.x) &lt;&lt; 8) &amp; 0xF800; result |= (((int)col.y) &lt;&lt; 3) &amp; 0x07E0; result |= (((int)col.z) &gt;&gt; 3) &amp; 0x001F; return (short)result; } What can be the problem? As I cannot find any problems with the bitshifting, after having looked at a similar question here: Why does converting RGB888 to RGB565 many times cause loss of colour? I am beginning to suspect there is something going on in the conversion to and from float. Edit: short orig = data[tx][ty][tz]; // 16 bit short Vector3f color = ColorConversion.ShortToRGB888(orig); short ne = ColorConversion.RGB888ToShort(color); if (ne != orig) { ErrorHandler.log("Orig: " + orig + " New: " + ne); } Yields the following mismatches: Canvasland: CL-ERROR - Orig: 23900 New: 19608 Canvasland: CL-ERROR - Orig: 23864 New: 21750 Canvasland: CL-ERROR - Orig: 23831 New: 21750 Canvasland: CL-ERROR - Orig: 23742 New: 19449 Canvasland: CL-ERROR - Orig: 23870 New: 19545 Canvasland: CL-ERROR - Orig: 23768 New: 21687 Canvasland: CL-ERROR - Orig: 23707 New: 21561 Canvasland: CL-ERROR - Orig: 23802 New: 21656 Canvasland: CL-ERROR - Orig: 23549 New: 21402 Canvasland: CL-ERROR - Orig: 23165 New: 21084 Canvasland: CL-ERROR - Orig: 23069 New: 20988 Canvasland: CL-ERROR - Orig: 22395 New: 15796 Canvasland: CL-ERROR - Orig: 22223 New: 20142 Canvasland: CL-ERROR - Orig: 23679 New: 19386 Canvasland: CL-ERR…
linked to: http://stackoverflow.com/q/11007997
accepted answer: http://stackoverflow.com/a/25145723
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39139959

http://stackoverflow.com/q/25168731
score: 0
has comment: http://stackoverflow.com/comment/39320193
answer count: 0
tagged with: jenkins
type: UnansweredQuestion
has body: I am building a maven project in my local machine. When I connected my project to SVN, the SVN URL starts with "file:///". When I am trying to use the same URL to configure repository URL in jenkins, it is showing error as " unable to access"
tagged with: svn
tagged with: java
has comment: http://stackoverflow.com/comment/39262053
type: Question
has comment: http://stackoverflow.com/comment/39203437
has comment: http://stackoverflow.com/comment/39299664
has title: not able to configue repository URL in jenkins

http://stackoverflow.com/a/25075879
upvote count: 9
has comment: http://stackoverflow.com/comment/39013527
type: Answer
answers question: http://stackoverflow.com/q/25075683
has comment: http://stackoverflow.com/comment/39015132
has body: Well for me you have to delete the @InitBinder protected void initBinder(final WebDataBinder binder) { binder.setValidator(validator); } Leave the @Valid @ModelAttribute("user") final User user, BindingResult result And after in the function make validator.validate(user,result) This way you will use the validation basic with the @Valid and after you will put make the more complex validation. Because with the initBinder you are setting the validation with your complex logic and putting a way the basic logic. Maybe is wrong, i use always the @Valid without any validator.
score: 7
has comment: http://stackoverflow.com/comment/39013607
has comment: http://stackoverflow.com/comment/58520212
downvote count: 2

http://stackoverflow.com/q/25139131
answer count: 1
tagged with: intuit-partner-platform
score: 0
has title: Error while reconnecting Intuit on java
type: UnansweredQuestion
tagged with: java
type: Question
has body: I am working on intuit integration on my application. Now I am stuck on reconnecting process of it. While working on reconnecting, I am getting following exception: Message: Token Refresh Window Out of Bounds Caused By: null Actually, While testing i used the keys which are not expired. It that the reason I am getting this exception? I am working on java and my java code is: public void renewQBOAccessToken(HttpServletRequest req, HttpServletResponse resp) { LOGGER.info("Inside renewQBOAccessToken method."); HttpSession session = req.getSession(); Intuit intuit; try { intuit = IntuitLocalServiceUtil.getIntuit(PortalUtils.getCompanyId(req), PortalUtils.getOrganisationId(req)); LOGGER.info("Values before ::::::::::::::::"); IAPlatformClient client = new IAPlatformClient(); client.reConnect(PropsUtil.get(CommonConstants.INTUIT_QB_OAUTH_CONSUMER_KEY), PropsUtil.get(CommonConstants.INTUIT_QB_OAUTH_CONSUMER_SECRET), intuit.getOauthToken(), intuit.getOauthTokenSecret()); getAccessToken(req, resp); LOGGER.info("&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; values after reconnect: "); LOGGER.info("accesstoken: +" + session.getAttribute(CommonConstants.INTUIT_QB_OAUTH_ACCESS_TOKEN_KEY)); LOGGER.info("access token secret:" + session.getAttribute(CommonConstants.INTUIT_QB_OAUTH_ACCESS_TOKEN_SECRET)); } catch (PortalException | SystemException e1) { LOGGER.error(e1.getClass().getName() + " Exception while reconnecting #renewQBOAccessToken Class: " + e1.getClass().getSimpleName() + " Message: " + e1.getMessage() + " Caused By: " + e1.getCause()); } catch (ConnectionException e) { LOGGER.error(e.getClass().getName() + " ConnectionException while reconnecting #renewQBOAccessToken Class: " + e.getClass().getSimpleName() + " Message: " + e.getMessage() + " Caused By: " + e.getCause()); } } Thank you.
has answer: http://stackoverflow.com/a/25139884

xamarin.android
type: Tag
tag name: xamarin.android
tags question: http://stackoverflow.com/q/25208659

http://stackoverflow.com/q/25223496
has comment: http://stackoverflow.com/comment/39288246
tagged with: conventions
accepted answer: http://stackoverflow.com/a/25223527
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25223564
has answer: http://stackoverflow.com/a/25223527
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39288266
has title: Java Exceptions: Should an exception contain its message inside or take it as parameter
has body: Whenever I need to define a custom exception, if it's message will not change depending on context, I put the message inside that exception. Like this: public class UserNotFoundException extends RuntimeException { public UserNotFoundException() { super("User with given name is not found!"); } } Instead of this: public class UserNotFoundException extends RuntimeException { public UserNotFoundException(String message) { super(message); } } So I don't need to provide a message each time I throw this exception, I know that the message should be same in every place. Do you think there is a problem in my approach? Which one would you prefer, and why?
score: 0
tagged with: exception
upvote count: 1
downvote count: 1
tagged with: custom-exceptions
has answer: http://stackoverflow.com/a/25223564
favorite count: 0

http://stackoverflow.com/q/25072798
has body: i have a null pointer exception in my computePaths() method, please help me find the reason why. below is my code and below my code is the output i have Vertex class: class Vertex implements Comparable&lt;Vertex&gt; { String name; Double minDistance = Double.POSITIVE_INFINITY; Vertex previous; Edge[] adjacencies; public String toString() { return name; } public Vertex(String argName) { name = argName; } @Override public int compareTo(Vertex other) { return Double.compare(minDistance, other.minDistance); } } Edge class: class Edge { Double weight; Vertex target; public Edge(Vertex argTarget, Double argWeight) { target = argTarget; weight = argWeight; } } Class for the algorithm: public class BellmanFord { public static void computePaths(Vertex source, Vertex[] vertices) { source.minDistance = 0.0; PriorityQueue&lt;Vertex&gt; vq = new PriorityQueue&lt;Vertex&gt;(); vq.add(source); for (int i = 1; i &lt; vertices.length - 1; i++) { while (!vq.isEmpty()) { Vertex u = vq.poll(); for (Edge e : u.adjacencies) { Vertex v = e.target; System.out.println(u + " " + e.target); Double weight = e.weight; Double distanceThroughU = u.minDistance + weight; if (distanceThroughU &lt; v.minDistance) { vq.remove(v); v.minDistance = distanceThroughU; v.previous = u; vq.add(v); } } } } } public static List&lt;Vertex&gt; getShortestPathTo(Vertex target) { List&lt;Vertex&gt; path = new ArrayList&lt;Vertex&gt;(); for (Vertex v = target; v != null; v = v.previous) { path.add(v); } Collections.reverse(path); return path; } public static void main(String[] args) { Vertex a = new Vertex("A"); Vertex b = new Vertex("B"); Vertex c = new Vertex("C"); Vertex d = new Vertex("D"); Vertex e = new Vertex("E"); a.adjacencies = new Edge[] { new Edge(b, -1.0), new Edge(c, 4.0) }; b.adjacencies = new Edge[] { new Edge(d, 2.0), new Edge(c, 3.0), new Edge(e, 2.0) }; d.adjacencies = new Edge[] { new Edge(b, 1.0) }; e.adjacencies = new Edge[] { new Edge(d, -3.0) }; Vertex[] vertices = { b, c, d, e }; computePath…
has comment: http://stackoverflow.com/comment/39007467
has comment: http://stackoverflow.com/comment/39007521
tagged with: bellman-ford
favorite count: 0
possible better answer: http://stackoverflow.com/a/25072863
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25072863
tagged with: java
has answer: http://stackoverflow.com/a/25072841
downvote count: 1
tagged with: dijkstra
type: Question
tagged with: shortest-path
score: -1
answer count: 2
accepted answer: http://stackoverflow.com/a/25072841
upvote count: 0
has comment: http://stackoverflow.com/comment/39007454
has title: null-pointer exception when coding bellmanFord algo
has comment: http://stackoverflow.com/comment/39007471

http://stackoverflow.com/a/25088110
answers question: http://stackoverflow.com/q/25088081
has body: The problem is that only the methods in HibCentral class are transactional, which means that the database connection opens and closes for the execution of those methods only. After that, the connection will be closed and any interaction with an Hibernate element like Query outside those methods won't have a valid connection and you will get those errors. Solution: move the @Transactional annotation to a higher level. This should be usually at service layer. If your classes in the service layer interact between each other, then move the @Transactional to a higher level in order to avoid opening and closing many connections.
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/25112517
score: 0
has comment: http://stackoverflow.com/comment/39081625
type: Answer
answers question: http://stackoverflow.com/q/25112365
has body: int number = 0b1; //the proper way to start a binary number int sum = 0; while(number &lt;= 1000){ if ((number % 13 == 0 || number % 15 == 0 || number % 17 == 0) &amp;&amp; number % 30 != 0 ) { sum+= number; } number++; } System.out.println("Answer: " + sum); In the question you said numbers that are divisible by 13 or 15 or 17 and not by 30, so apply that same logic to the if statement. That would give you the right result. Answer: 76795

http://stackoverflow.com/comment/39043873
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25092105
has text: `enum` will be my choice
score: 0

http://stackoverflow.com/q/25224604
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/98983632
score: 0
has title: Download a file without buffer: Nio is faster than io?
tagged with: java
has comment: http://stackoverflow.com/comment/39301432
type: Question
has comment: http://stackoverflow.com/comment/39295414
tagged with: nio
has comment: http://stackoverflow.com/comment/39301779
tagged with: io
answer count: 1
has answer: http://stackoverflow.com/a/25224889
has body: I'm developping an updater for my project, and i want to download files quickly. Per update, there are some files, which have a different size. So i think i don't needed a Buffer, or surely not defined. I've so write that: File file = new File.. InputStream input = new InputStream... OutputStream output = new OutputStream(..).write(input.read()); This one running perfectly ! But my friend said to me; "hey, we've got FileChannel from jdk7". I've then thought about it, but we can't create &amp; import data into a FileChannel without a ByteBuffer. FileChannel channel = new FileOutputStream(file).getChannel(); ByteBuffer buffer = ByteBuffer.allocateDirect(..); buffer.putInt(inputstream.read()); channel.write(buffer); So what's faster ? Better ? Thank you ! UPDATE: (best solution i think, very quickly) URLConnection connection = new URL(url).openConnection(); File file = new File(connection.getURL().getPath().substring(1)); if (file.getParentFile() != null) file.getParentFile().mkdirs(); FileChannel output = new FileOutputStream(file).getChannel(); output.transferFrom(Channels.newChannel(connection.getInputStream()), 0, connection.getContentLengthLong()); It works !
accepted answer: http://stackoverflow.com/a/25224889

http://stackoverflow.com/q/25136021
has comment: http://stackoverflow.com/comment/39149486
tagged with: ejb-3.1
has body: we are upgrading our web application to Oracle WebLogic 12c with EJB 3.x, and we got an issue. This is the scenario... We have a simple EJBs that we are going to call MyService, defined with its bean and local/remote interfaces defined by the EJB 3.x annotations. Here is a pseudo code of the scenario: class MyListener implements ServletContextListener { @EJB private MyService myService; public void contextInitialized(ServletContextEvent arg0) { // Here myService is correctly instantiated, so we do something... } } Now we have to move the contextInitialized method logic inside an utility class, so the new scenario will be: class MyUtility { @EJB private MyService myService; public void doSomething() { // Here myService is NULL!!!!! } } class MyListener implements ServletContextListener { public void contextInitialized(ServletContextEvent arg0) { new MyUtility().doSomething(); } } I have read a lot of documentation about that problem, and I discovered that only some kind of classes are scanned by the Application Server to resolve the injected EJBs ( Java EE 6, 5, 7 | List of managed beans or classes: EJBs , JSF beans and ..? ). Is there a workaround to force the scanning of a custom class like mine with WebLogic? Thank you very much.
answer count: 1
tagged with: jakarta-ee
tagged with: weblogic
has comment: http://stackoverflow.com/comment/39128193
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39126882
has answer: http://stackoverflow.com/a/47632550
has comment: http://stackoverflow.com/comment/39126724
linked to: http://stackoverflow.com/q/11122127
type: Question
has title: EJB injection into non managed objects
tagged with: ejb-3.0
score: 0

http://stackoverflow.com/a/25203649
score: 4
has comment: http://stackoverflow.com/comment/39285229
has body: You need to update Google Play Services from Play store on you device, if you don't see any update wait until comes out Play Store - Google Play Services Alternatively search on Google and installed the new apk or use an older version like 5.0.77 or 5.0.89
type: Answer
upvote count: 6
downvote count: 2
accepted answer of: http://stackoverflow.com/q/25203415
has comment: http://stackoverflow.com/comment/39253625
answers question: http://stackoverflow.com/q/25203415
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39253414

http://stackoverflow.com/q/25144489
has title: NullPointerException in Selenium WebDriver Instance When Using in TestNG
tagged with: testng
tagged with: selenium-webdriver
downvote count: 2
has comment: http://stackoverflow.com/comment/39161553
tagged with: annotations
has comment: http://stackoverflow.com/comment/39159995
answer count: 1
has comment: http://stackoverflow.com/comment/39161587
tagged with: java
has answer: http://stackoverflow.com/a/25158488
has comment: http://stackoverflow.com/comment/39171497
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/39143445
has comment: http://stackoverflow.com/comment/39141341
favorite count: 0
has body: I have created a Selenium test suite using TestNG for my website. The name of my project is Test My Website. In order to execute my Selenium test script and create a test report, I execute the TestNG.xml file directly from the command prompt. For different modules of my website, I have created different Java classes for different modules and have kept them in one package. The source code of my files is given as follows: TestNG.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;suite name="Test My Website"&gt; &lt;test name="My Website Test"&gt; &lt;packages&gt; &lt;package name="testmywebsite" /&gt; &lt;/packages&gt; &lt;/test&gt; &lt;/suite&gt; TestLogin.java public class TestLogin { public static WebDriver driver; @BeforeTest public void setup() { driver = new ChromeDriver(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.manage().window().maximize(); } @Test void loginTest() { //Code to perform the login test } @AfterClass public void setupWorkHistory() { TestModule1.driver = driver; } } TestModule1.java public class TestModule1 { public static WebDriver driver; @Test void module1Test() { //Code to perform the module 1 test driver.getTitle(); } @AfterClass public void setupModule2() { TestModule2.driver = driver; } } TestModule2.java public class TestModule2 { public static WebDriver driver; @Test void module2Test() { //Code to perform the module 2 test driver.getTitle(); } @AfterTest public void tearDown() { driver.close(); driver.quit(); } } Note that in the first two Java classes I have added the setup&lt;Next Class's name&gt;() method to pass my driver instance. The problem here is that the driver instance gets successfully passed from TestLogin.java to TestModule1.java. However it throws a NullPointerException in the module2Test() method and hence it shows a failed TestNG report for module2Test() despite creating the setupModule2() method in TestModule1.java and adding the @AfterClass annotation to it. Can anyone tell me why exactl…
has comment: http://stackoverflow.com/comment/39142441
tagged with: nullpointerexception
type: Question
accepted answer: http://stackoverflow.com/a/25158488
score: -2

http://stackoverflow.com/comment/39227063
type: AnswerComment
comment on: http://stackoverflow.com/a/25190598
score: 0
type: Comment
has text: I wanted to avoid the database hit for verification before commit.Don't know if it is possible.

http://stackoverflow.com/comment/39008865
comment on: http://stackoverflow.com/q/25071656
type: Comment
type: QuestionComment
has text: @user3897744 Did u initialized the Context variable in the constructor of the Adapter class
score: 0

http://stackoverflow.com/comment/39317357
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25199262
has text: @StuartMarks, that comment will certainly help others to pick by their sense of style. Weird that there is no java.util.Action/SideEffect or so. so.
type: AnswerComment

http://stackoverflow.com/comment/39290020
type: QuestionComment
type: Comment
has text: Define a class that implements `Comparator<Product>` and use `Arrays.sort()` or use any sorted collection.
score: 0
comment on: http://stackoverflow.com/q/25224498

http://stackoverflow.com/comment/39194866
comment on: http://stackoverflow.com/q/25173043
type: Comment
type: QuestionComment
score: 2
has text: [In this question someone had a similar issue][1]. Apparently that happens since 3.0. [1]: http://stackoverflow.com/questions/11301061/null-keyevent-and-actionid-0-in-oneditoraction-jelly-bean-nexus-7

http://stackoverflow.com/comment/39195701
type: Comment
has text: @MadProgrammer what you mean? it must be ordered by date ? so how can i change what I want to satisfy what op wants?
score: 0
comment on: http://stackoverflow.com/a/25173290
type: AnswerComment

http://stackoverflow.com/comment/101628651
type: Comment
comment on: http://stackoverflow.com/a/25207565
score: 1
has text: It looks like `sonar.exclusions` doesn't exclude the multiple paths like `**/enums/**,**/entity/**,**/constant/**`
type: AnswerComment

http://stackoverflow.com/a/25187834
has comment: http://stackoverflow.com/comment/39745562
type: Answer
has comment: http://stackoverflow.com/comment/39257336
has comment: http://stackoverflow.com/comment/39768402
downvote count: 2
answers question: http://stackoverflow.com/q/25187532
has comment: http://stackoverflow.com/comment/39260138
upvote count: 0
score: -2
has body: The interface Person lack the @Entity annotation and hence is not recognized as a managed object. I think that putting the @Entity annotation on the Person interface will not help either as this annotation is not inherited. I think you should either forget about the Person interface or just use the PersonEntity instead in the repository declaration. Did not actually check in code - so very sorry if this answer is wrong...
has comment: http://stackoverflow.com/comment/39238970

http://stackoverflow.com/q/25172195
linked to: http://stackoverflow.com/q/1372113
score: 3
accepted answer: http://stackoverflow.com/a/25172276
tagged with: oop
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/25172415
has body: For those who are unfamiliar with Magic (as it's often called informally), casting costs are values that represent the "mana" needed to cast a "spell". Mana comes from different sources, and has certain colors assigned to each type of mana. For example, a hypothetical "blue" spell may require 2 blue mana, and two mana of any color, whereas another spell may require 1 green mana, 2 red mana, and 3 mana of any color. There is a finite number of mana colors (red, blue, green, black, white, and colorless (which is agnostic of mana color, in other words, colorless casting costs can be paid for by any color of mana). So, supposing we had a spell that costs 2 green, 1 blue, and 3 colorless, it could only be paid for with 2 green, 1 blue, and 3 of any combination of colors. What would be some effective ways to represent this in a program? I'm currently writing this in Java, but generic advice would also be nice. If you have any questions, comment, and I will clarify my question if need be.
answer count: 3
has answer: http://stackoverflow.com/a/25172235
possible better answer: http://stackoverflow.com/a/25172415
downvote count: 0
tagged with: data-structures
has title: How May One Represent Magic The Gathering Casting Costs Programmatically?
favorite count: 0
has comment: http://stackoverflow.com/comment/39193610
has answer: http://stackoverflow.com/a/25172276
type: AnsweredQuestion
upvote count: 3
type: Question

http://stackoverflow.com/a/25129590
upvote count: 2
type: Answer
score: 2
has body: From the design perspective it is better to avoid use of instanceof operator and use a declared interface type as the obj parameter type. Declare an interface, let say MyCustomInterface public interface MyCustomInterface { public void setBackgroundColor(int color); public void setForegroundColor(int color); } and declare private static ColoredItem createItem(MyCustomInterface obj) { ColoredItem item = new ColoredItem(); int bgColor = .... int color = .... obj.setBackgroundColor(bgColor); obj.setForegroundColor(color); return item; } or even better way: Add MyCustomInterface parameter to the ColoredItem constructor. In the class ColoredItem declare default background and foreground colors. And use them if these colors are not specified in the parameter. Then use: private static ColoredItem createItem(MyCustomInterface obj) { return new ColoredItem(obj); }
accepted answer of: http://stackoverflow.com/q/25129540
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25129540
downvote count: 0

http://stackoverflow.com/comment/39162878
has text: Maybe your input file uses a different character encoding than the default that is used by `InputStreamReader`? Try specifying encoding explicitly.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25156122

http://stackoverflow.com/comment/39082734
score: 0
has text: What do you mean "other pages"? Each page has it's own structure. It would be pure coincidental luck if a page has the same class names etc. on it's HTML elements.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25107690

http://stackoverflow.com/q/25081064
linked to: http://stackoverflow.com/q/2793150
accepted answer: http://stackoverflow.com/a/25081302
tagged with: google-maps
has body: I write an android app And I get from the server a list of addresses. How can I measure the distance between a mobile client and a given address? I guess I first have to convert the address to coordinates? how would you suggest doing this?
answer count: 6
score: -1
has answer: http://stackoverflow.com/a/25081217
has answer: http://stackoverflow.com/a/25081162
has answer: http://stackoverflow.com/a/25081245
upvote count: 2
tagged with: distance
has answer: http://stackoverflow.com/a/25081322
has answer: http://stackoverflow.com/a/25081302
downvote count: 3
has title: how can I measure distance between my current location and a given address?
favorite count: 0
has answer: http://stackoverflow.com/a/25081214
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/25081245

instantiation
type: Tag
tags question: http://stackoverflow.com/q/25168396
tag name: instantiation

http://stackoverflow.com/q/25070537
has body: This code is pretty much what I want to do: import java.util.Random; public class TestClass { protected int testVarA; protected int testVarB; public TestClass() { Random r = new Random(); this(r.nextInt(),r.nextInt()); } public TestClass(int testVarA, int testVarB) { this.testVarA = startTestVarA; this.testVarB = startTestVarB; } } However, this doesn't compile, since the this() statement has to be at the beggining of the function. I could do something like this((new Random()).getNextInt(),(new Random()).getNextInt()) But that feels very improper. What is the proper way of doing this?
has answer: http://stackoverflow.com/a/25070588
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25070606
possible better answer: http://stackoverflow.com/a/25070588
has title: Java custom optional values for constructor
has answer: http://stackoverflow.com/a/25070676
accepted answer: http://stackoverflow.com/a/25070676
favorite count: 0
tagged with: constructor
answer count: 4
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25070691

http://stackoverflow.com/a/25124241
upvote count: 1
has comment: http://stackoverflow.com/comment/39104043
score: 1
accepted answer of: http://stackoverflow.com/q/25123695
answers question: http://stackoverflow.com/q/25123695
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39104008
has comment: http://stackoverflow.com/comment/39104024
type: Answer
has body: Check my comment to the question... I've specified in the comment to Try Intent nextScreen = new Intent(youractivityname.this, MainMenu.class); instead of Intent nextScreen = new Intent(view.getContext(), MainMenu.class); Because you will have to pass the current Context as the argument.

http://stackoverflow.com/a/25080061
has body: Instead of doing: arithmeticTerm : arithmeticFactor (op=(MULT|DIVIDE) arithmeticFactor)* ; do something like this: expression : MINUS expression #unaryMinusExpression | expression MULT expression #multExpression | expression DIVIDE expression #divideExpression | expression ADD expression #addExpression | expression MINUS expression #minusExpression | INTEGER #integerExpression | '(' expression ')' #parensExpression ; And then in your listener, you simply have to override the #...Expression methods: @Override public void enterMultExpression(@NotNull PredicateGrammarParser.MultExpressionContext ctx) { ... } Note that MULT and DIVIDE expressions have a higher precedence than ADD and MINUS since they are defined before the latter.
downvote count: 0
answers question: http://stackoverflow.com/q/25077236
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/39292820
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25225985
type: Comment
has text: ya clearly this is not the answer i was expecting. I already mentioned it in question that I knew about .

layout-manager
tags question: http://stackoverflow.com/q/25222404
tags question: http://stackoverflow.com/q/25151677
tags question: http://stackoverflow.com/q/25219423
tags question: http://stackoverflow.com/q/25188161
type: Tag
tags question: http://stackoverflow.com/q/25199578
tags question: http://stackoverflow.com/q/25179300
tags question: http://stackoverflow.com/q/25220465
tags question: http://stackoverflow.com/q/25125691
tags question: http://stackoverflow.com/q/25178478
tags question: http://stackoverflow.com/q/25115313
tags question: http://stackoverflow.com/q/25130250
tag name: layout-manager

http://stackoverflow.com/a/25144280
upvote count: 3
has comment: http://stackoverflow.com/comment/39144441
has comment: http://stackoverflow.com/comment/39143891
has comment: http://stackoverflow.com/comment/39214033
has comment: http://stackoverflow.com/comment/39177390
has body: To allow CardContainer to communicate up to the MainActivity, you define an interface in CardContainer and implement it in MainActivity. When the event occurs in CardContainer, it can then call Interface method in order to add the CardModel to the adapater. public class CardContainer extends ... { CardContainerEventListener mCallback; // Define a interface public interface CardContainerEventListener { public void addToAdapter(); } // Method to register callback void registerCallback(Activity callback) { mCallback = (CardContainerEventListener) callback; } void someFunction() { // Event got generated, invoke callback method mCallback.addToAdapter(); } } public class MainActivity extends Activity implements CardContainer.CardContainerEventListener { // Ensure you register MainActivity with CardContainer, by calling // cardContainer.registerCallback(this) public void addToAdapter() { adapter.add(...); } }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25080952
type: Answer
has comment: http://stackoverflow.com/comment/39143673
score: 3
accepted answer of: http://stackoverflow.com/q/25080952

http://stackoverflow.com/q/25071998
score: 1
has comment: http://stackoverflow.com/comment/39030876
linked to: http://stackoverflow.com/q/24404413
tagged with: pdf-generation
favorite count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39087320
tagged with: itext
upvote count: 1
has title: Dynamically changing field size in a pdf form using itext
tagged with: java
has body: I am using PDFStamper to populate a PDF form file. The PDF form has labels and a fields where you can enter values. The size of this field is fixed and when I try to input values into it programmatically, it chops off all data which overshoots the size of these fields. Is there a way to change the size of the fields when populating them using the java APIs ? P.S. setting the form flatterning to false does not help.
type: Question
downvote count: 0

http://stackoverflow.com/comment/39040989
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25090542
has text: If you were using the default settings it shouldn't have imported hbv7 into hbv8.
score: 0

http://stackoverflow.com/comment/39052801
has text: I've tried doing that already, but it will not stop adding accounts to the array - because it didn't find any duplicates
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25097018
score: 0

http://stackoverflow.com/a/25211994
upvote count: 2
answers question: http://stackoverflow.com/q/25211952
type: Answer
has body: add a Context to your MyButtonListener's constructor and use it to show the Toast. public MyButtonListener(Context c); from MainActivity: MyButtonListener l = new MyButtonListener(this);
score: 2
downvote count: 0

http://stackoverflow.com/comment/86025712
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25202635
type: Comment
has text: @zbig so will we have to add a new table to our DB? if yes, is it possible to have a alternate solution where we don't have to create a new table in the DB?

http://stackoverflow.com/a/25228564
has comment: http://stackoverflow.com/comment/39301879
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25223949
type: Answer
answers question: http://stackoverflow.com/q/25223949
has body: According to the FAQ: HDFS supports exclusive writes only. When the first client contacts the name-node to open the file for writing, the name-node grants a lease to the client to create this file. When the second client tries to open the same file for writing, the name-node will see that the lease for the file is already granted to another client, and will reject the open request for the second client.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39298743

http://stackoverflow.com/comment/39202127
type: Comment
comment on: http://stackoverflow.com/a/25176483
score: 0
type: AnswerComment
has text: I didn't think of copying/filtering resources, but the attach-artifact plugin did the trick, thanks!

http://stackoverflow.com/comment/39258421
comment on: http://stackoverflow.com/q/25207419
score: 0
type: Comment
type: QuestionComment
has text: @BackSlash with that logic, how can the single quoted switch case run, if `what` == 1 and the case is apparently, 49?

http://stackoverflow.com/comment/39053845
type: AnswerComment
has text: To authenticate this account you will need (probably) another one, used to connect to ldap server. To check it - connect to ldap server manually with some ldap browser like http://jxplorer.org/
type: Comment
comment on: http://stackoverflow.com/a/25097530
score: 0

http://stackoverflow.com/q/25108416
has answer: http://stackoverflow.com/a/25108591
downvote count: 0
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/25108456
has answer: http://stackoverflow.com/a/31889696
upvote count: 13
has answer: http://stackoverflow.com/a/41059101
type: UnansweredQuestion
score: 13
has body: I need to keep top N(&lt; 1000) integers while trying to add values from a big list of integers(around a million sized lazy list). I want to be try adding values to a collection but that needs to keep only the top N(highest values) integers. Is there any preferred data structure to use for this purpose ?
type: Question
has answer: http://stackoverflow.com/a/39212317
linked to: http://stackoverflow.com/q/5498865
tagged with: java
has title: Fixed-size collection that keeps top (N) values in Java
has comment: http://stackoverflow.com/comment/39075356
has answer: http://stackoverflow.com/a/25108525
has answer: http://stackoverflow.com/a/50176343

http://stackoverflow.com/a/25145776
answers question: http://stackoverflow.com/q/25145216
has body: I have tested the JSON string that is provided by you and it works using TypeReference and ObjectMapper that return Map&lt;String, Map&lt;String, String&gt;&gt; as per this JSON string. Here is the code: String jsonString = "{\"metadata\": {\"name\": \"test_server\",\"server_type\": \"test\"}}"; TypeReference&lt;Map&lt;String, Map&lt;String, String&gt;&gt;&gt; typeRef = new TypeReference&lt;Map&lt;String, Map&lt;String, String&gt;&gt;&gt;() {}; ObjectMapper mapper = new ObjectMapper(); try { Map&lt;String, Map&lt;String, String&gt;&gt; jsonObject = mapper.readValue(jsonString, typeRef); System.out.println(jsonObject.get("metadata")); } catch (Exception e) { System.out.println("Three might be some issue wiht the JSON string"); } output: {name=test_server, server_type=test}
has comment: http://stackoverflow.com/comment/39161304
score: 0
type: Answer

http://stackoverflow.com/comment/39158044
comment on: http://stackoverflow.com/q/25153208
type: Comment
type: QuestionComment
has text: are you using String contains? why not simply use List contains?
score: 0

http://stackoverflow.com/q/25083769
has answer: http://stackoverflow.com/a/25083850
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25084127
has comment: http://stackoverflow.com/comment/39028617
possible better answer: http://stackoverflow.com/a/25083972
score: 3
has title: Initializing static class members - some clarification please
has answer: http://stackoverflow.com/a/25084166
has answer: http://stackoverflow.com/a/25083972
tagged with: initialization
answer count: 4
favorite count: 0
tagged with: static
has body: I'm a bit of a novice with java and I would appreciate some clarification on when static class variables need to initialized. It a bit much to insert the code I have, so let me break it down to the essential elements. I have an object that performs a particular task. This task requires a number of parameters to be set. These parameters would ideally be static as any instance of the class would use the same parameters. The object is basically a robot that automates a task. The first instance of the robot must be "trained" to do the task (guided by user input). In this "training" it learns a few key parameters and, from those, calculates others that are needed (via a private method). The key parameters are then saved to file to be used by other instances and with subsequent runs of the program (i.e. training is done once only). The code is structured something like this... public class Master { static int[] keyPara; static int[] otherPara; public Master() { /* some defining stuff */ } void doGuidedTask() { /* some stuff that calls private methods, etc */ } void doTask() { /* some stuff that calls private methods etc */ } void calcOtherPara() { /* method to calculate other parameters given key parameters */ } void saveKeyPara() { /* method to save key parameters to File */ } } The question is what is the proper/best way to initialize these parameters in code? keyPara are determined by implementing the doGuidedTask method, and otherPara are found using the calcOtherPara method. After a single implementation of doGuidedTask, saveKeyPara can be invoked to save them to file and can be read in for subsequent runs of the application program. I could use a static initialization block: test if the file exists, if so load the key parameters. Not sure if this is allowed because it will require the use of the calcOtherPara method to determine the other parameters i.e. its using a class method in the initialization. Even the read in keyPara would be best implemented as a method (w…
accepted answer: http://stackoverflow.com/a/25084127

http://stackoverflow.com/q/25091547
tagged with: mysql
type: Question
tagged with: jersey
tagged with: sql
downvote count: 0
score: 1
has body: So a little about the web service before I present my issues. I am building a service for the local school for students to upload lecture notes for sharing on an open platform. First, I have a MySQL instance running on my local machine. My web service, REST JERSEY 2.0, connect to my database and can query it fine. I have an HTML page where I can type in a text field a parameter to search by, it hits a stored procedure and returns the results as expected. I have another stored procedure that accepts input parameters as part of a form and INSERTS a new record into my database. This also works successfully. What I WANT to happen now, is BEFORE I insert that new record into my database, I want to upload a file to a location, then after it successfully uploads, insert a record into the database about that upload. I have an HTML form setup, all files are posted below. I am having trouble implementing the required multipart stuffs I need. All of the examples and tutorials I am finding online are not much help. I'm not sure if file locations in jars have changed in this version of JERSEY or what but nothing I see from anyone else is working for me. Here is the error code: WARNING: No injection source found for a parameter of type public static void com.dylanlegendre.dbhelper.FilePaths.uploadNewFile(java.io.InputStream,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) at index 0. Aug 01, 2014 10:34:01 PM org.apache.catalina.core.ApplicationContext log SEVERE: StandardWrapper.Throwable org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization. [[FATAL] No injection source found for a parameter of type public static void com.dylanlegendre.dbhelper.FilePaths.uploadNewF…
favorite count: 0
has comment: http://stackoverflow.com/comment/39060140
tagged with: rest
has title: JERSEY 2.0 - Multipart @FormDataParam Issues
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: java

http://stackoverflow.com/q/25177255
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/39202065
score: 0
tagged with: java
has title: java Socket programming Server Client
has body: I'm trying to program a Server Client program where the CLIENT will be prompt if the SERVER closes or loses connection. What happens is once I connect the server and the client then disconnects the server it doesn't go to the ConnectException part example: I opened the Server and Client connects, in the Client it will show that "You are connected to the Server", then if the Server disconnects there should be a "Server is disconnected". and when the Server reopens it will prompt the Client that he's connected to the Server How can I continuously check if the Server is open or disconnected here's my code: SERVER public class Server { private static Socket socket; public static void main(String[] args) { try { int port = 25000; ServerSocket serverSocket = new ServerSocket(port); //Server is running always. This is done using this while(true) loop while(true) { //Reading the message from the client socket = serverSocket.accept(); System.out.println("Client has connected!"); InputStream is = socket.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String number = br.readLine(); System.out.println("Message received from client is "+number); //Multiplying the number by 2 and forming the return message String returnMessage; try { int numberInIntFormat = Integer.parseInt(number); int returnValue = numberInIntFormat*2; returnMessage = String.valueOf(returnValue) + "\n"; } catch(NumberFormatException e) { //Input was not a number. Sending proper message back to client. returnMessage = "Please send a proper number\n"; } //Sending the response back to the client. OutputStream os = socket.getOutputStream(); OutputStreamWriter osw = new OutputStreamWriter(os); BufferedWriter bw = new BufferedWriter(osw); bw.write(returnMessage); System.out.println("Message sent to the client is "+returnMessage); bw.flush(); } } catch (Exception e) { e.printStackTrace(); } } } CLIENT public class Client { private static Socket socket; …
type: Question
has comment: http://stackoverflow.com/comment/39202012
tagged with: network-programming
has answer: http://stackoverflow.com/a/25177568
answer count: 1

http://stackoverflow.com/comment/39106195
has text: @noobProgrammer happens all thetime
type: Comment
comment on: http://stackoverflow.com/a/25124414
score: 0
type: AnswerComment

http://stackoverflow.com/q/25166287
score: 0
has comment: http://stackoverflow.com/comment/39189397
tagged with: http://stackoverflow.com/tag/html
answer count: 0
type: UnansweredQuestion
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/8404464
has comment: http://stackoverflow.com/comment/39197375
has body: I am facing very strange problem when i am creating server socket event connection with java application deployed on tomcat .After making 6 server socket connection .it is not able to make new connection even when i am request simple url from ajax or from new tab it is not hitting application .I have checked through proxy tolls even request is not genearted from browser .if the same url i request from some other browser then request got submitted and response comes . This means issue is at browser side not application side . I have checked with both mozila and google chrome but still no success . Is there any kind of restriction with HTML 5 server socket Event .I am using following code eventSource.addEventListener('trigger', function(event){ var data=event.data; var oFormB = document.getElementById('a'+tabId); var audioEnable; var sound; if(oFormB!=null&amp;&amp;data.charAt(data.length-1)=='b'){ audioEnable=oFormB.elements.audibleAlarm[0].checked; if(audioEnable!=null&amp;&amp;audioEnable==true){ sound = new Howl({ urls: ['js/sounds.mp3'],buffer:false}).play(); //sound.stop(); }else{ // alert(" Alarm Id:"+event.data+" Triggered.Tabs Id: "+tabId); } alert(" Alarm Id:"+event.data+" Triggered. Tabs Id: "+tabId); if(sound!=null){ sound.stop(); } } Any help would be really appreciated
has title: After 6 Serversocket event connection with same application futher ajax request is not getting sumitted
tagged with: java
type: Question
tagged with: javascript

http://stackoverflow.com/comment/39205759
type: AnswerComment
has text: Thankyou Ruchira, your answer was very helpful and self explanatory. I can see now where i went wrong. I will tick you answer when its possible (6 minutes) Thankyou, once again!
type: Comment
comment on: http://stackoverflow.com/a/25179489
score: 0

http://stackoverflow.com/q/25188687
type: Question
has comment: http://stackoverflow.com/comment/39223186
has comment: http://stackoverflow.com/comment/39225661
score: 4
has answer: http://stackoverflow.com/a/25189941
answer count: 2
has body: I'm pretty new to java SWT, and while putting labels, it looks like i can't make the label background transparent. I'm using eclipse luna SWT desine form. this is what my window looks like: as you can see,all the label backgrounds are white. What should i do so the label backgrounds will be the same as the window background(grey) by default (meaning - not by changing each label background at runtime, which does work for me). it probably simple, but i just couldn't find on google how to do it. here is my code: import java.awt.Color; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.SWT; import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.swt.widgets.Label; import org.eclipse.wb.swt.SWTResourceManager; import org.eclipse.swt.widgets.Combo; import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.core.databinding.beans.PojoProperties; import org.eclipse.core.databinding.observable.Realm; import org.eclipse.jface.databinding.swt.SWTObservables; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.layout.RowData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.Canvas; public class WinApp2 { private DataBindingContext m_bindingContext; protected Shell shell; private Text destenation_ip; private final FormToolkit formToolkit = new FormToolkit(Display.getDefault()); private Label lblDestenationPortIp; private Label lblNewLabel; private Text ammount_of_packets; private Label lblNewLabel_1; private Text sorce_ip; private Text destenation…
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/20975980
upvote count: 5
has title: How to make label backgrounds transparent in SWT
has comment: http://stackoverflow.com/comment/39225119
possible better answer: http://stackoverflow.com/a/25189941
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25192041
accepted answer: http://stackoverflow.com/a/25192041
tagged with: java
tagged with: swt

http://stackoverflow.com/comment/39018882
type: Comment
type: QuestionComment
has text: @TugrulAsik: ConcurrentHashMap has no option to lock the whole thing, and using a separate lock defeats the benefit of using a ConcurrentHashMap. You might as well wrap a lock around a regular HashMap.
comment on: http://stackoverflow.com/q/25079093
score: 2

http://stackoverflow.com/a/55020136
answers question: http://stackoverflow.com/q/25078321
type: Answer
has body: The old SafariDriver implementation is no longer maintained and should not be used. You do not need to download anything besides Safari 10 to get the Apple-developed driver. This article explains everything https://webkit.org/blog/6900/webdriver-support-in-safari-10/
score: 0

http://stackoverflow.com/comment/39193810
type: Comment
has text: Thank you. Two followup questions come to mind. First - how did you find that 1920 is not supported? I couldn't find an external list and the device does report it as supported. Second - do you have any knowledge of a way to change the return size on data[], or otherwise recover it? To my surprise, it appears that I'm not getting a smaller image format. Instead, I'm getting as much of the 1920x1080 data as the data[] can hold, and the rest is being discarded. I realize that this likely can't be done, but I'm tantalized by the fact that the image is being shot at that resolution.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25172444

http://stackoverflow.com/comment/39252444
comment on: http://stackoverflow.com/a/25192760
score: 1
type: AnswerComment
has text: Check out [this link](http://www.eclipse.org/jetty/documentation/current/using-annotations-embedded.html) from Jetty themselves. In this example they use a war as the way to implement annotations. So it looks like they keep going back to WAR file when implementing standard features of servlets.
type: Comment

http://stackoverflow.com/q/25201602
has answer: http://stackoverflow.com/a/25201734
score: 6
has comment: http://stackoverflow.com/comment/39246985
type: Question
tagged with: format
has title: Android: format string and add bold style
has answer: http://stackoverflow.com/a/25201899
tagged with: java
has body: I have a string in my resource: Region: %1$s I am trying to set this text to a textview: tvRegion.setText(Html.fromHtml(R.string.region, "France")); The problem is that the string "region" is not bold !
has answer: http://stackoverflow.com/a/25201703
upvote count: 7
downvote count: 1
tagged with: string
favorite count: 0
answer count: 3
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/39289379
type: Comment
type: QuestionComment
has text: @CaseyT, do not vandalize your post.
score: 0
comment on: http://stackoverflow.com/q/25214658

http://stackoverflow.com/q/25093304
has comment: http://stackoverflow.com/comment/39093636
has comment: http://stackoverflow.com/comment/39086160
has comment: http://stackoverflow.com/comment/39084146
has comment: http://stackoverflow.com/comment/39080316
has body: I am trying to read embedded documents in a .doc file using POIFS file system. According to this there is an ObjectPool directory which contains all embedded documents especially for a doc file. I found the directory but don't know the way to read these documents. Please suggest any way to read these documents. If POIFS is not the suitable way then please suggest any other library. My code is: public static void ReadCSV(String fileName) throws IOException{ FileInputStream myInput = new FileInputStream(fileName); POIFSFileSystem fs = new POIFSFileSystem(myInput); HSSFWorkbook workbook = new HSSFWorkbook(fs); for (HSSFObjectData obj : workbook.getAllEmbeddedObjects()) { //the OLE2 Class Name of the object System.out.println("Objects : "+ obj.getOLE2ClassName()+ " 2 ."); String oleName = obj.getOLE2ClassName(); if (oleName.equals("Worksheet")) { // some code to process embedded excel file; } else if (oleName.equals("Document")) { System.out.println("Document"); DirectoryNode dn = (DirectoryNode) obj.getDirectory(); HWPFDocument embeddedWordDocument = new HWPFDocument(dn,fs); System.out.println("Doc : " + embeddedWordDocument.getRange().text()); // want to extract document not text into a doc file //************************ FileOutputStream fos = new FileOutputStream("E:\\log.txt"); fos.write(text.getBytes()); //************************ } else if (oleName.equals("Presentation")) { // some code to process embedded power point file; } else { // some code to process other kind of embedded files; } } }
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39092706
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39048868
has comment: http://stackoverflow.com/comment/39090022
has comment: http://stackoverflow.com/comment/39088251
has title: How to read embedded objects from a doc file?
tagged with: apache-poi
type: Question

http://stackoverflow.com/q/25222341
has answer: http://stackoverflow.com/a/45785175
linked to: http://stackoverflow.com/q/6810158
tagged with: spring
type: AnsweredQuestion
score: 2
has title: Write operations are not allowed in read-only mode - Issue while persisting
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25222460
accepted answer: http://stackoverflow.com/a/25222460
type: Question
tagged with: spring-transactions
answer count: 2
possible better answer: http://stackoverflow.com/a/45785175
downvote count: 0
has body: I have been facing the below error while trying to save the object to database. I tried the solution mentioned here1 and here2 but no good. I was following a tutorial but the only difference is versions of Spring and Hibernate. I am able to persist the object directly using the SessionFactory but it fails with below error if I try this with HibernateDaoSupport spring.xml <context:annotation-config/> org.hibernate.dialect.OracleDialect update true CustomerDAOImpl.java public class CustomerDAOImpl extends HibernateDaoSupport { public boolean insertCustomer(Customer cust){ try { getHibernateTemplate().saveOrUpdate(cust); } catch (DataAccessException e) { e.printStackTrace(); return false; } return true; } } Invoke it using. public class MainClass { public static void main(String[] args) { ApplicationContext appContext = new ClassPathXmlApplicationContext("spring.xml"); CustomerDAOImpl hdi=appContext.getBean("customerDAOImpl",CustomerDAOImpl.class); Customer customer=new Customer(); customer.setCustomerName("Sri"); boolean isUpdated = hdi.insertCustomer(customer); } } Error message. Aug 10, 2014 12:45:52 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute INFO: HHH000232: Schema update complete org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition. at org.springframework.orm.hibernate4.HibernateTemplate.checkWriteOperationAllowed(HibernateTemplate.java:1135) at org.springframework.orm.hibernate4.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:684) at org.springframework.orm.hibernate4.HibernateTemplate.doExecute(HibernateTemplate.java:340) at org.springframework.orm.hibernate4.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:308) at org.springframework.orm.hibernate4.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:681) at org.sri.sphiber.dao.CustomerDAOImpl.insert…
tagged with: persistence
favorite count: 0
upvote count: 2

http://stackoverflow.com/q/25105529
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25105580
favorite count: 0
has body: I am trying to get my head into Java 8 streams and still get stuck every now and then. I currently have a problem that I know it can be done with streams, I just can't seem to understand how to use them properly. I have a list of Strings A and try to find all elements a of A that match another element b of A by a certain rule, then create a Map&lt;String, List&lt;String&gt;&gt; out of it with all a's -> all matched b's. In detail: For each a in A, compare to each b in A using predicate P. If P(a,b) matches, generate a pair (x, y) from a and b. Group all pairs by x and return as a map. Can you please give me a working Java 8 stream example for this? Edit: How I would do it in an unnecessary expensive way: Pairs(x,y) = forEach(a,b in A) where (a != b &amp;&amp; P(a, b)) generatePairXY(a, b) Map(x -&gt; List(y)) = group(Pairs(x,y)) by x Problem in this approach is that I first need to construct a huge list of pairs, which - given my data-set of a few million words - could exhaust memory.
has comment: http://stackoverflow.com/comment/39089042
tagged with: java-8
has comment: http://stackoverflow.com/comment/39088921
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39089079
tagged with: java-stream
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25105580
has title: Stream, Map, Reduce... how is it done?
has comment: http://stackoverflow.com/comment/39089153
tagged with: mapreduce

http://stackoverflow.com/comment/39210713
score: 0
has text: Ah, not one I'm familiar with I'm afraid. Checking up on what [Oracle](http://www.oracle.com/us/technologies/java/overview/index.html) use for Java might help though.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25178387

http://stackoverflow.com/comment/39396623
comment on: http://stackoverflow.com/q/25198280
type: Comment
type: QuestionComment
has text: @ StanislavL, which layout do you suggest?
score: 0

http://stackoverflow.com/a/25179283
downvote count: 0
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25178969
accepted answer of: http://stackoverflow.com/q/25178969
score: 4
has body: System.out is not thread specific. There are two possibilities: The libraries read the System.out before you redirect it and cache the value. The fix is to redirect System.out before invoking third party library code. The libraries do not use System.out. For writing to the console there are alternatives like creating a new FileOutputStream(FileDescriptor.out) and writing to it. Or using System.console(). If this happens through one of the known logging APIs you can override the behavior by removing the default console-writing log handler and installing your own. Otherwise it’s rather hard to do. You will have to study the libraries and their API carefully to find out how to do it. Every sophisticated library will offer a way as writing messages directly to the console without offering an alternative is a really bad programming style, especially for a library. It’s very likely that the libraries you are using use a logging API.
type: AcceptedAnswer

http://stackoverflow.com/comment/39494568
type: QuestionComment
comment on: http://stackoverflow.com/q/25212490
has text: I suspect your DBA is having a joke with you. The whole point of SHA256 and other hash functions like it is that you CAN'T invert it.
score: 0
type: Comment

http://stackoverflow.com/comment/39160175
has text: It felt wrong so I changed it, now I'm wondering if it shouldn't be _sell an empty string as **a** bigint number_, however my sense of English is not sufficient to make that judgement.
comment on: http://stackoverflow.com/a/25152509
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25189778
favorite count: 0
upvote count: 2
answer count: 5
possible better answer: http://stackoverflow.com/a/25189858
has answer: http://stackoverflow.com/a/25189831
has answer: http://stackoverflow.com/a/25190059
has answer: http://stackoverflow.com/a/25189858
score: 2
has comment: http://stackoverflow.com/comment/39225429
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25189881
tagged with: java
has title: java Calendar format
accepted answer: http://stackoverflow.com/a/25190059
tagged with: calendar
has body: Please help me to format properly my String. I really need to display "10 November 2015" instead of 10/11/2015 Calendar now = Calendar.getInstance(); now.add(Calendar.MONTH, 10); textView1.setText(("date after 10 months : " + (now.get(Calendar.MONTH) + 1) + "-" + now.get(Calendar.DATE) + "-" + now.get(Calendar.YEAR)));
type: Question
has answer: http://stackoverflow.com/a/52108595
has comment: http://stackoverflow.com/comment/91167627
has comment: http://stackoverflow.com/comment/39225262
linked to: http://stackoverflow.com/q/38922754
tagged with: date
downvote count: 0

http://stackoverflow.com/q/25101994
tagged with: c++
upvote count: 3
tagged with: java
has body: Am on generating snippets for built-in functions to know how they are executed, and is a part of my research also. i successfully completed some string handling functions,split, substring,reverse etc.. but i stuck in random numbers how they ware generated? how the RND or Random functions are work? Thanks in advance
tagged with: vb6
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/39062041
has answer: http://stackoverflow.com/a/25102729
score: -2
downvote count: 5
has title: Generating random number without using built-in functions
answer count: 3
has comment: http://stackoverflow.com/comment/39062294
has answer: http://stackoverflow.com/a/25102027
has answer: http://stackoverflow.com/a/25104734
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39062269
tagged with: vb.net

http://stackoverflow.com/a/25154130
accepted answer of: http://stackoverflow.com/q/25154064
type: Answer
answers question: http://stackoverflow.com/q/25154064
score: 3
has comment: http://stackoverflow.com/comment/39159401
upvote count: 3
has comment: http://stackoverflow.com/comment/39159081
has body: Since you used BorderLayout you need the specify the location of each component of the layout what you are doing is that you are only adding all the component on the same position of the layout which by default is CENTER. solution: addUpperPane.add(itemBox,BorderLayout.EAST); addUpperPane.add(addItem,BorderLayout.WEST); addUpperPane.add(new JSeparator(JSeparator.HORIZONTAL)); //put everything together add(addUpperPane,BorderLayout.NORTH); add(addLowerPane,BorderLayout.SOUTH); Also this doesn't make since setLayout(new BorderLayout()); that JFrame's default layout is already BorderLayout so no need to set the layout to it again. EDIT: If you want your component to be side by side then FlowLayout is the way to go: addUpperPane = new JPanel(); //default component of JPanel is FlowLayout addUpperPane.add(itemBox); addUpperPane.add(addItemT); EDIT number 2: problem: getContentPane().setLayout(new GridLayout(0, 1)); //remove it sample: addItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if(itemBox.getSelectedItem().toString().equals("test1")) { addLowerPane.add(new Button("Lolonator")); revalidate(); } } });;
downvote count: 0
has comment: http://stackoverflow.com/comment/39159940
has comment: http://stackoverflow.com/comment/39159170
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39159326

http://stackoverflow.com/q/25216010
type: Question
accepted answer: http://stackoverflow.com/a/31625799
score: 0
tagged with: javacv
answer count: 1
has comment: http://stackoverflow.com/comment/39828871
tagged with: android
has title: Part of android devices have problems on "new FFmpegFrameRecorder(new File(filePath), 480, 480, 1);"
has body: When I use javacv - 0.8, found that can't fit all the android models.Errors often occur in FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(new File(filePath), 480, 480, 1); LogCat shows: 08-06 14:53:13.796: E/AndroidRuntime(8309): FATAL EXCEPTION: main&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): java.lang.ExceptionInInitializerError&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): at com.example.javacvtest.RecordActivity.onCreate(RecordActivity.java:57)&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): at android.app.Activity.performCreate(Activity.java:4470)&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1929)&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1990)&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): at android.app.ActivityThread.access$600(ActivityThread.java:124)&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1148)&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): at android.os.Handler.dispatchMessage(Handler.java:99)&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): at android.os.Looper.loop(Looper.java:137)&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): at android.app.ActivityThread.main(ActivityThread.java:4441)&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): at java.lang.reflect.Method.invokeNative(Native Method)&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): at java.lang.reflect.Method.invoke(Method.java:511)&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:788)&lt;br/&gt; 08-06 14:53:13.796: E/AndroidRuntime(8309): at com.android.internal…
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/31625799

http://stackoverflow.com/comment/39096392
score: 0
comment on: http://stackoverflow.com/q/25119447
type: Comment
type: QuestionComment
has text: describe data_sundrymatrix shows exactly the same on 5.5 and 5.6. So yes, DATETIME, not timestamp, in both, as shown in my post. Default new dates should not really matter as we insert a real date and not a null-value. Btw, Now() in the code works as expected, but with ? and setTimestamp instead, it gets converted to 0000-00-00 00:00:00 with truncate-warning. We cannot use Now() everywhere, often we have to define a given date and time.

http://stackoverflow.com/q/25225399
has title: How do I call a method from one class in another?
score: -1
type: Question
has answer: http://stackoverflow.com/a/25225436
upvote count: 0
has comment: http://stackoverflow.com/comment/39294137
has comment: http://stackoverflow.com/comment/39291726
has answer: http://stackoverflow.com/a/25225447
possible better answer: http://stackoverflow.com/a/25225436
answer count: 3
has answer: http://stackoverflow.com/a/25225500
has body: I am trying to call the statemotOfPhilosopy in my other class. There are two classes: First class SetUpSite: package setupsite; public class SetUpSite { public static void main(String[] args) { statementOfPhilosophy(); } public static void statementOfPhilosophy() { System.out.println("Even Handlers Incoroporated is"); System.out.println("dedicated to making your event"); System.out.println("a most memorable one."); } } And the second class CallingMethods: package callingmethods; public class CallingMethods { public static void main(String[] args) { System.out.println("Calling method from another class:"); SetUpSite.statementOfPhilosophy(); //Error here at the SetUpSite } }
has comment: http://stackoverflow.com/comment/39291733
favorite count: 0
tagged with: compiler-errors
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25225500
tagged with: java

http://stackoverflow.com/q/25086369
has body: I keep getting "java.lang.IllegalStateException" after using Scanner() this is what I have public void insertBook(){ //this method allows the user to insert a new book in the database Boolean select = false; Scanner input = new Scanner(System.in); File textFile = new File("src/newbooks.txt"); FileWriter fw = null; //FileWriter and BufferedWriter have to be initialized and used inside a try catch //to be used outside, initialize the objects as null BufferedWriter bw = null; try{ fw = new FileWriter(textFile);//check if it can read the textfile bw = new BufferedWriter(fw);//FileWriter has to be wrapped in BufferedWriter }catch(IOException e){ System.out.println("the file could not be found"); }//end catch System.out.println(" select is " +select);//if(text == "n") System.out.println("enter the book information below"); System.out.println("if the informatin is not available, enter\"information not available\""); System.out.print("do you wnat to enter a book? "); String text = input.next(); if(text.equals("n")) select = true; do{ String book = new String(); if(select == true) break; if(text.equals("n")){ System.out.print("inside if no\n"); select = true; //break;//break here so } else if (text.equals("y")){ System.out.println("inside if y"); try{ Scanner input2 = new Scanner(System.in); System.out.print("enter the title of the book: "); book = input2.next(); bw.write(book + ", "); System.out.println("after first write"); System.out.print("enter the author: "); book = input2.next(); bw.write(book + ", "); System.out.println(); System.out.print("enter the year of the book: "); book = input2.next(); bw.write(book + ", "); System.out.println(); System.out.print("enter the gender: "); book = input2.next(); bw.write(book + ", "); //System.out.println(); System.out.print("enter a description: "); book = input2.next(); bw.write(book + ", "); System.out.println(); bw.write("\n"); input2.close(); select = false; } catch(IOException e){ System.out.println("the text could not be re…
type: Question
upvote count: 0
answer count: 1
has title: Why do I get a IllegalStateException when using scanner?
favorite count: 0
tagged with: input
tagged with: java.util.scanner
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25086394
downvote count: 2
has comment: http://stackoverflow.com/comment/39033540
score: -2
tagged with: java

http://stackoverflow.com/q/25107048
has answer: http://stackoverflow.com/a/25107144
type: AnsweredQuestion
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/25107090
possible better answer: http://stackoverflow.com/a/25107093
type: Question
has answer: http://stackoverflow.com/a/25107093
has body: I have the below UML diagram: I've read that abstract methods should be overridden by a subclass. How should I override calculateMonthlyPay() when there is no calculateMonthlyPay() in either subclass? Can I create methods that aren't shown in the UML diagram? Here is my code for Employee and its subclasses PartTimeEmp and FullTimeEmp for reference. public abstract class Employee { Scanner keyboard = new Scanner(System.in); public String name; public String ID; //Employee constructor public Employee(String name, String ID) { this.name = name; this.ID = ID; } //ID setter public void setID(String ID) { ID = keyboard.nextLine(); this.ID = ID; } //name getter public String getName() { return name; } public abstract String getStatus(); public abstract double calculateMonthlyPay(); @Override public String toString() { return "Employee{" + "name=" + name + ", ID=" + ID + '}'; } } class PartTimeEmp extends Employee { public double hourlyRate; public int hoursPerWeek; //PartTimeEmp constructor public PartTimeEmp(String name, String ID){ super(name, ID); } public void setHours(int hoursPerWeek) { this.hoursPerWeek = hoursPerWeek; } public void setRate(double hourlyRate) { this.hourlyRate = hourlyRate; } @Override public String toString() { return "PartTimeEmp{" + "hourlyRate=" + hourlyRate + ", hoursPerWeek=" + hoursPerWeek + '}'; } } class FullTimeEmp extends Employee { double salary; //FullTimeEmp constructor public FullTimeEmp(String name, String ID) { super(name, ID); } //Set salary of employee public void setSalary(double salary) { this.salary = salary; } @Override public String toString() { return "FullTimeEmp{" + "salary=" + salary + '}'; } }
tagged with: inheritance
answer count: 3
tagged with: abstract
has title: Java: What should be done with abstract methods that are only in the superclass in the UML diagram?
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25107090

http://stackoverflow.com/comment/39210605
score: 0
comment on: http://stackoverflow.com/a/25182075
type: Comment
has text: When I run a map reduce job using "java -jar MyMapReduce.jar [args]" Not display job entry in YARN(WEB Service on port number 8088). But display all information about job in YARN service if run using YARN or HADOOP command
type: AnswerComment

http://stackoverflow.com/a/25076473
has comment: http://stackoverflow.com/comment/39014948
score: 3
has comment: http://stackoverflow.com/comment/39017107
has comment: http://stackoverflow.com/comment/39018086
answers question: http://stackoverflow.com/q/25075997
has comment: http://stackoverflow.com/comment/39014950
has comment: http://stackoverflow.com/comment/39014750
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39015014
upvote count: 3
has comment: http://stackoverflow.com/comment/39015207
has comment: http://stackoverflow.com/comment/39016924
has comment: http://stackoverflow.com/comment/39014838
type: Answer
has comment: http://stackoverflow.com/comment/39017342
has comment: http://stackoverflow.com/comment/39016661
downvote count: 0
has body: Your result set should return all the fields you need per result. You should not have to use two queries. Select individual fields like below select c.field1, c.field2, h.field1 ... from consolas c inner join hardware h on c.someField = h.someField I've never seen anyone do what you're trying to do. Maybe you should do over some sql tutorials. What happens when you do both, is not what you are expecting. Your first query will already return all the fields. That's the point of a join. You may not be getting all the results from the rs.getXxx() as you may not be expecting them. You could do a simple test using ResultSetMetaData class to get the column count, and print out all the values. Something like ResultSet rs = ... ResultSetMetaData md = rs.getMetaData(); int columnCount = md.getColumnCount(); Then loop through the result set using the column count as the max loop iteration. For example while(rs.next()) { for (int i = 1; i &lt;= columnCount; i++) { System.out.print(rs.getObject(i) + ", "); } System.out.println(); } UPDATE Here's a generic common way to accomplish what you're trying to do ResultSet rs = ... ResultSetMetaData md = rs.getMetaData(); int columnCount = md.getColumnCount(); String[] cols = new String[columnCount]; for (int i = 1; i &lt;= columnCount; i++) { col[i - 1] = md.getColumnName(i); } DefaultTableModel model = new DefaultTableModel(cols, 0); while(rs.next()) { Object[] row = new Object[columnCount]; for (int i = 1; i &lt;= columnCount; i++) { row[i - 1] = rs.getObject(i); } model.addRow(row); } table.setModel(model);
has comment: http://stackoverflow.com/comment/39017530
has comment: http://stackoverflow.com/comment/39015304
accepted answer of: http://stackoverflow.com/q/25075997
has comment: http://stackoverflow.com/comment/39017064

http://stackoverflow.com/comment/39235065
comment on: http://stackoverflow.com/q/25193648
has text: @Mshnik thanks! I fixed this issue and added a few print lines within the while and try brackets to locate the iterations of aforesaid errors.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39270465
type: AnswerComment
type: Comment
has text: @Qix Singleton is a Java pattern, but that doesn't mean it's a good one. People use singleton when they want unscoped global values, you know, just like C global variables! Also the static initialization block is not mean to help "instantiate" the `Class` class, it is meant to assure the __initialization order__ in edge cases where multiple static variables are entangled such that only a certain initialization order ensures correct state.
comment on: http://stackoverflow.com/a/25213700
score: 0

http://stackoverflow.com/comment/39267190
comment on: http://stackoverflow.com/q/25211986
has text: Where are you setting the color for the rectangles? Add "g.setColor(Color.RED);" to you paintComponent method. You don not need to extend JFrame if you are creating one in you constructor.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25084659
possible better answer: http://stackoverflow.com/a/25084707
has title: Java retrieve returned ArrayList to HashMap
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25084707
tagged with: arraylist
has comment: http://stackoverflow.com/comment/39030561
answer count: 3
has answer: http://stackoverflow.com/a/25084731
accepted answer: http://stackoverflow.com/a/25084731
upvote count: 1
has body: In my simple java application i have this function to return ArrayList: Items.java class: package com.example.Hadis; /** * Created by tux-world on 8/1/14. */ public class Items { public int id; public String content; } ArrayList function for fill and return result: DataBaseHelper.java class's getFavorite function : public ArrayList&lt;Items&gt; getFavorite(){ ArrayList&lt;Items&gt; arrayList = new ArrayList&lt;Items&gt;(); do { Items dbItems = new Items(); dbItems.id = cursor.getInt(0); dbItems.content = cursor.getString(1); arrayList.add(dbItems); } while (cursor.moveToNext()); return arrayList; } i want to fetch this return ArrayList and fill HashMap but i can not program this part of project Defined map as Method in class: static Map&lt;Integer,String&gt; map = new HashMap&lt;Integer,String&gt;(); retrive ArrayList and my problem is this: DatabaseHandler db = new DatabaseHandler(ApplicationHadith.this); ArrayList&lt;Items&gt; list = db.getFavorite(); Iterator&lt;Items&gt; it = list.iterator(); while(it.hasNext()) { // map.put( it.id , it.content ) } how to retrive getFavorite() and fill HashMap? please help me.Thanks
has comment: http://stackoverflow.com/comment/39029820
favorite count: 0
has answer: http://stackoverflow.com/a/25084747
has comment: http://stackoverflow.com/comment/39029794
tagged with: android

http://stackoverflow.com/q/25193563
type: Question
has body: I'm using &lt;sonar.exclusions&gt; in pom.xml to exclude certain packages for unit test code coverage. I have set up Sonar locally and the exclusions reflect on the report. But then, the same exclusions are not honored on the company server. I am using &lt;sonar.skippedModules&gt; which works as intended and skips the required modules perfectly fine on both environments. Local Sonar version is Version 4.3.1 Company's Sonar version is Version 4.1.2 An example of how I have written &lt;sonar.skippedModules&gt; in one of the modules: &lt;properties&gt; &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt; &lt;project.mainClass&gt;.....&lt;/project.mainClass&gt; &lt;sonar.exclusions&gt; /src/main/java/../../../../../Package1/*, /src/main/java/../../../../../Package2/*, /src/main/java/../../../../../JavaClass1.java &lt;/sonar.exclusions&gt; &lt;sonar.language&gt;java&lt;/sonar.language&gt; &lt;/properties&gt; Can you please help me understand why &lt;sonar.exclusions&gt; is honored only locally but not when I build the job (set up on Jenkins) to generate the Sonar report on the company server? Does the difference in the version matter? Would absence of new-line character following the comma to separate the package names make a difference?
tagged with: jenkins
answer count: 2
upvote count: 21
tagged with: maven
has title: <sonar.exclusions> in pom.xml (Maven multi-module project) works locally but not on company server
has answer: http://stackoverflow.com/a/25207565
tagged with: java
tagged with: sonarqube
has comment: http://stackoverflow.com/comment/39251925
type: AnsweredQuestion
downvote count: 0
score: 21
possible better answer: http://stackoverflow.com/a/25197731
accepted answer: http://stackoverflow.com/a/25207565
favorite count: 0
has answer: http://stackoverflow.com/a/25197731

http://stackoverflow.com/comment/39255112
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25205758
type: AnswerComment
has text: @JsonProperty is for Jackson is suppose.

http://stackoverflow.com/a/25152960
has comment: http://stackoverflow.com/comment/39157108
has comment: http://stackoverflow.com/comment/39157163
type: Answer
upvote count: 1
has body: The algorithm would go as follows: Perform an inorder traversal of your binary tree For every node which has 1 child node-&gt;parent-&gt;child = node-&gt;child The parent-&gt;child would be either the left or right child depending on the current nodes location
answers question: http://stackoverflow.com/q/25152899
score: 1
has comment: http://stackoverflow.com/comment/39157278
downvote count: 0

http://stackoverflow.com/q/25201409
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/39247603
type: Question
has body: my task: input parameter - path to file. This path may not contain any folders. I want create all folder structure and create file. my current decision: File file = new File("D:\\nonexistingFolder\\folder2\\1.txt"); file.getParentFile().mkdirs(); file.createNewFile(); Is it possible to simplify this code? For example to replace 2 second lines with single
has answer: http://stackoverflow.com/a/25202341
accepted answer: http://stackoverflow.com/a/25202341
has comment: http://stackoverflow.com/comment/39246618
answer count: 1
score: -1
has comment: http://stackoverflow.com/comment/39254217
has title: Does java io API allow to create file with all folder structure by single method invocation?
tagged with: io
downvote count: 1
tagged with: directory
favorite count: 0
has comment: http://stackoverflow.com/comment/39246634

http://stackoverflow.com/comment/39042748
score: 1
comment on: http://stackoverflow.com/q/25091384
type: Comment
type: QuestionComment
has text: Is this in an Activity or a Fragment? I would use getView() when appropriate in the Fragment lifecycle if you are in a Fragment. If you are in an Activity, do you access to the root layout? If so, "get your root View, cast it to a ViewGroup, call getChildCount() and getChildAt(), and recurse as needed." [CommonsWare]

hibernate
tags question: http://stackoverflow.com/q/25115053
tags question: http://stackoverflow.com/q/25158746
tags question: http://stackoverflow.com/q/25189257
tags question: http://stackoverflow.com/q/25074323
tags question: http://stackoverflow.com/q/25081611
tags question: http://stackoverflow.com/q/25125800
tags question: http://stackoverflow.com/q/25216951
tags question: http://stackoverflow.com/q/25181776
tags question: http://stackoverflow.com/q/25226741
tags question: http://stackoverflow.com/q/25086027
tags question: http://stackoverflow.com/q/25182505
tags question: http://stackoverflow.com/q/25210949
tags question: http://stackoverflow.com/q/25160903
tags question: http://stackoverflow.com/q/25132318
tags question: http://stackoverflow.com/q/25088081
tags question: http://stackoverflow.com/q/25223345
tags question: http://stackoverflow.com/q/25184332
tags question: http://stackoverflow.com/q/25178645
tags question: http://stackoverflow.com/q/25144438
tags question: http://stackoverflow.com/q/25074167
tags question: http://stackoverflow.com/q/25117318
tags question: http://stackoverflow.com/q/25210908
tags question: http://stackoverflow.com/q/25120962
tags question: http://stackoverflow.com/q/25143443
tags question: http://stackoverflow.com/q/25156886
tags question: http://stackoverflow.com/q/25114555
tags question: http://stackoverflow.com/q/25093682
tags question: http://stackoverflow.com/q/25208450
tags question: http://stackoverflow.com/q/25185023
tags question: http://stackoverflow.com/q/25073122
tags question: http://stackoverflow.com/q/25081029
tags question: http://stackoverflow.com/q/25225757
tags question: http://stackoverflow.com/q/25097768
tags question: http://stackoverflow.com/q/25197986
tags question: http://stackoverflow.com/q/25210534
tags question: http://stackoverflow.com/q/25180003
tags question: http://stackoverflow.com/q/25161068
tags question: http://stackoverflow.com/q/25211766
tags question: http://stackoverflow.com/q/25072653
tags question: http://stackoverflow.com/q/25177256
tags question: http://stackoverflow.com/q/25083537
tags question: http://stackoverflow.com/q/25184217
tags question: http://stackoverflow.com/q/25111422
tags question: http://stackoverflow.com/q/25178898
tags question: http://stackoverflow.com/q/25092797
tags question: http://stackoverflow.com/q/25212636
tags question: http://stackoverflow.com/q/25221332
tags question: http://stackoverflow.com/q/25085841
tags question: http://stackoverflow.com/q/25082984
tags question: http://stackoverflow.com/q/25096388
tags question: http://stackoverflow.com/q/25083295
tags question: http://stackoverflow.com/q/25155124
tags question: http://stackoverflow.com/q/25180880
tags question: http://stackoverflow.com/q/25188939
tag name: hibernate
tags question: http://stackoverflow.com/q/25118892
tags question: http://stackoverflow.com/q/25120751
tags question: http://stackoverflow.com/q/25187532
tags question: http://stackoverflow.com/q/25081475
tags question: http://stackoverflow.com/q/25099491
tags question: http://stackoverflow.com/q/25124595
tags question: http://stackoverflow.com/q/25076975
tags question: http://stackoverflow.com/q/25128155
tags question: http://stackoverflow.com/q/25090486
tags question: http://stackoverflow.com/q/25200310
tags question: http://stackoverflow.com/q/25080844
tags question: http://stackoverflow.com/q/25208678
tags question: http://stackoverflow.com/q/25205584
tags question: http://stackoverflow.com/q/25156510
tags question: http://stackoverflow.com/q/25173634
tags question: http://stackoverflow.com/q/25148293
tags question: http://stackoverflow.com/q/25161593
tags question: http://stackoverflow.com/q/25150270
tags question: http://stackoverflow.com/q/25106636
tags question: http://stackoverflow.com/q/25211252
tags question: http://stackoverflow.com/q/25077423
tags question: http://stackoverflow.com/q/25156341
tags question: http://stackoverflow.com/q/25184786
tags question: http://stackoverflow.com/q/25182540
tags question: http://stackoverflow.com/q/25185747

http://stackoverflow.com/q/25136754
linked to: http://stackoverflow.com/q/513832
has body: I have a GUI which works like the following: there are 2 buttons and 1 textField. The textField is used to hold double/float values, 1 of the buttons adds a value (in this case, 0.1) and the other one subtracts (adds -0.1). Here is my following problem: after pressing one of the buttons many times, the resulting value is not behaving the way I would like. In other words, instead of "1.5" turning into "1.6", it will be something like "1.5999998". I have tried many changes (like changing the variables types and the value to add/subtract), but none of these worked. Here's a piece of my code: public void sumTextField(){ try{ if(textField.getText() == "") textField.setText("0.1"); else{ float aux = Float.parseFloat(textField.getText()); aux += 0.10000000; textField.setText(String.valueOf(aux)); } } catch(NumberFormatException nfe){ nfe.printStackTrace(); JOptionPane.showMessageDialog(null, "Please, provide a valid value in the text field!", "Impossible sum", JOptionPane.INFORMATION_MESSAGE); } } public void subtractTextField(){ try{ if(textField.getText() == "") textField.setText("-0.1"); else{ float aux = Float.parseFloat(textField.getText()); aux -= 0.10000000; textField.setText(String.valueOf(aux)); } } catch(NumberFormatException nfe){ nfe.printStackTrace(); JOptionPane.showMessageDialog(null, "Please, provide a valid value in the text field!", "Impossible subtraction", JOptionPane.INFORMATION_MESSAGE); } } Any ideas are welcome
type: AnsweredQuestion
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25137063
answer count: 1
has title: Strange behaviour managing double and float values (Java)
has comment: http://stackoverflow.com/comment/39126513
score: -1
has comment: http://stackoverflow.com/comment/39126476
tagged with: java
has comment: http://stackoverflow.com/comment/39126738
downvote count: 1
has comment: http://stackoverflow.com/comment/39126709
has comment: http://stackoverflow.com/comment/39126472
linked to: http://stackoverflow.com/q/327544
upvote count: 0
has answer: http://stackoverflow.com/a/25137063
has comment: http://stackoverflow.com/comment/39126460

http://stackoverflow.com/comment/39099610
comment on: http://stackoverflow.com/q/25121026
score: 2
has text: You could use `igraph` for this. Split your string into vertices - you can then check for cycles and if none return the vertice names in topological order.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39145555
has text: You need to pass a reference from that Activity to other class. I dont know what your class is based on but you can get context or application context and reach activity from there
comment on: http://stackoverflow.com/q/25146738
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/79310916
comment on: http://stackoverflow.com/q/25197158
score: 0
type: QuestionComment
type: Comment
has text: Hey I'm facing the same issue... Have u resolved this problem ??@user3921002

http://stackoverflow.com/comment/39222298
comment on: http://stackoverflow.com/a/25168153
type: AnswerComment
type: Comment
has text: Just because a language feature is borrowed from or inspired by a corresponding feature in other languages doesn't mean it necessarily keeps the exact same underlying characteristics. Consider, for instance, the variety of `lambda` functions in different languages (e.g. the weakness of Python's `lambda` compared to true Lisp lambdas http://symbo1ics.com/blog/?p=1292). Even in C++, certain features taken from C aren't quite identical to their C counterparts, *despite* the fact that C++ is often thought to be backwards-compatible with C (http://www.cprogramming.com/tutorial/c-vs-c++.html).
score: 1

http://stackoverflow.com/comment/39202303
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25177600
has text: Turn it off and back on again
score: 7

http://stackoverflow.com/comment/39111948
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25128161
type: Comment
has text: hmm..can you access the link above? because i logged out and still can access the link.

http://stackoverflow.com/comment/39197958
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25175024
has text: @user3505725 Yeah. The `String` in the concatenation expression could've been anything, even `null` assuming it was cast to `String`.

http://stackoverflow.com/q/25187016
has answer: http://stackoverflow.com/a/25188560
accepted answer: http://stackoverflow.com/a/25188560
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/38801842
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: h2
has body: First my setup: JUnit version: 4.11 H2 version: 1.3.174 Spring version: 4.0.5.RELEASE Hibernate version: 4.1.0.Final A little context: I have a REST web service that is deployed on a Tomcat webserver and that has a h2 database underneath. I have a REST service that doesn't have any POST/PUT methods. When writing an integration test for it, I manually added the entries in the DB using the H2 console and placed the h2-file on the server. Finally my integration test calls the REST service and the data I manually injected in the DB is returned and the test succeeds. This is not maintainable and it would be great to inject for every test the data I need (this approach can be used for other integration tests later...). The goal is to inject data into the same database as the application deployed on Tomcat is using. I thought it would be very easy and I wrote an integration test reusing the same application context that is used on the server side: update org.hibernate.dialect.H2Dialect <tx:annotation-driven transaction-manager="transactionManager"/> where the database url is defined in a properties fil: database.url=jdbc:h2:file:${healthdata.working.dir}/database/database-catalogue;AUTO_SERVER=true Then I annotated the EntityManager as being my PersistenceContext and wrote a simple unit test: @Transactional @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(value = {"classpath:/applicationContext-it-test.xml"}) public class H2Test { @PersistenceContext private javax.persistence.EntityManager em; DataCollectionDefinition dcd = new DataCollectionDefinitionBuilder() .withId(Long.valueOf(1)) .build(); @Before public void init() { em.persist(dcd); em.flush(); em.clear(); } @Test public void testGet() { DataCollectionDefinition found = em.find(DataCollectionDefinition.class, 1); Assert.assertEquals(found, dcd); } } This test runs fine! However when I put a breakpoint after the data is flushed using the EntityManager and I connect to my H2 filesystem database, nothing …
type: Question
score: 5
linked to: http://stackoverflow.com/q/9817388
answer count: 2
tagged with: junit
favorite count: 0
linked to: http://stackoverflow.com/q/5370736
has title: Spring junit test using Entity Manager doesn't insert data in H2 filesystem database
upvote count: 5
has answer: http://stackoverflow.com/a/38801842
tagged with: spring

http://stackoverflow.com/q/25185357
tagged with: android
tagged with: android-intent
answer count: 0
has body: According to CommonsWare's answer on this question, when serializing and deserializing an object and passing it around via Intent, on the receiving end a new Object is created with identical values. So in theory, when passing an object via intent through 10 Activities, I will have 10 objects that are identical but will take 10 times the memory of just one object. Thus my question: should I try to avoid passing objects around or keep them as small as possible to save on memory usage of my app? Note: question is not about performance of the serialization process or serializable vs parcelable, but purely on trying to keep memory usage low.
has comment: http://stackoverflow.com/comment/39216644
tagged with: java
has comment: http://stackoverflow.com/comment/39217089
linked to: http://stackoverflow.com/q/24630639
type: Question
tagged with: android-memory
score: 0
has comment: http://stackoverflow.com/comment/39217248
has title: Effects on memory of passing serializable objects around
type: UnansweredQuestion

http://stackoverflow.com/a/25112661
accepted answer of: http://stackoverflow.com/q/25111116
answers question: http://stackoverflow.com/q/25111116
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You need to let applet know about library with jdbc driver. Here is how to do it: Adding a Third Party Library to Java Applet
score: 1

tablemodel
type: Tag
tags question: http://stackoverflow.com/q/25103373
tag name: tablemodel

http://stackoverflow.com/comment/39179886
comment on: http://stackoverflow.com/q/25163172
has text: As `sbt` is used to build Play-based applications you can just add `libraryDependencies += "com.auth0" % "auth0-servlet" % "1.4"` to your `build.sbt` file in your project and then you will get the dependency
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25089234
has comment: http://stackoverflow.com/comment/39038700
tagged with: android
has answer: http://stackoverflow.com/a/25089621
has comment: http://stackoverflow.com/comment/39040441
has comment: http://stackoverflow.com/comment/39038792
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39038910
has comment: http://stackoverflow.com/comment/39038721
has title: Android/Java Loop Not Working Properly
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25089273
has body: I have 2 array lists ArrayList&lt;Character&gt; answer = new ArrayList&lt;Character&gt;(); ArrayList&lt;Button&gt; buttons = new ArrayList&lt;Button&gt;(); Answer one contains a bunch of chars from the String correctA and the buttons has 20 buttons saved in to it. What i am trying to do is grab each letter from the answers array and assign each letter to an individual button. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); buttonStuff(); //split string and add to array String correctA = "TestAnswer"; for(char a : correctA.toCharArray()){ answer.add(a); } Collections.shuffle(answer); Button btn; //in this case will loop 10 times as there are 10 characters in "testAnswer" for(int i = 0; i &lt; answer.size(); i++){ Random myRandomizer = new Random(); btn = buttons.get(myRandomizer.nextInt(buttons.size())); char a = answer.get(myRandomizer.nextInt(answer.size())); btn.setText(String.valueOf(a)); } } I have tried a few different ways with random and everytime i run the app only 7 or 8 buttons are filled with a letter instead of the 10 that it should, what am i doing wrong?
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25097365
tagged with: agent
upvote count: 1
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/57005524
downvote count: 0
score: 1
tagged with: agents-jade
favorite count: 0
has body: In my agent program(using jade), I have 5 agents, in which one agent is a coordinator others are device agents. All 4 device agents send a array to coordinator. I want coordinator to receive all 4 arrays and store them as single array. How can I do it? I send messages via ACLmessage(strings)
has comment: http://stackoverflow.com/comment/39642257
type: UnansweredQuestion
has title: JADE agent data communication
tagged with: java
has answer: http://stackoverflow.com/a/27488603

http://stackoverflow.com/q/25149938
type: AnsweredQuestion
tagged with: java
has title: Aligning objects with GridBagLayout
has comment: http://stackoverflow.com/comment/39151827
type: Question
tagged with: gridbaglayout
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25155761
has body: I'm trying to create a calculator that computes the area and circumference/perimeters of triangles, circles, and rectangles. I have almost everything done but can't for the life of me figure out how to get the GridBagLayout to work. Here is an album of what I currently have and what I want it to look like. I've pasted my GridBagLayout for just my triangle calculations since that is giving me the most difficult time. final JPanel triPanel = new JPanel(new GridBagLayout()); final GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(10, 10, 0, 0); gbc.gridx = 0; gbc.gridy = 0; triPanel.add(heightInt); //height instructions gbc.gridx = 1; gbc.gridy = 0; triPanel.add(triHeight); //height textfield gbc.gridx = 2; gbc.gridy = 0; triPanel.add(baseInt); //base instructions gbc.gridx = 3; gbc.gridy = 0; triPanel.add(triBase); //base textfield gbc.gridx = 0; gbc.gridy = 1; triPanel.add(side2Int); //side2 instructions gbc.gridx = 1; gbc.gridy = 1; triPanel.add(triSide2); //side2 textfield gbc.gridx = 2; gbc.gridy = 1; triPanel.add(side3Int); //side3 instructions gbc.gridx = 3; gbc.gridy = 1; triPanel.add(triSide3); //side3 textfield gbc.gridx = 0; gbc.gridy = 2; triPanel.add(rectCalc); //calculate button gbc.gridx = 0; gbc.gridy = 3; triPanel.add(Triangle); //image In between here I have an ActionListener set up for the "Calculate" button. In the ActionListener I have another panel that shows up after the calculate button is pressed. Then finally I add the panel to the frame and set the frame as visible. triJFRame.add(triPanel); triJFRame.setVisible(true);
has answer: http://stackoverflow.com/a/25155761
has comment: http://stackoverflow.com/comment/39152066

http://stackoverflow.com/comment/39133058
score: 0
comment on: http://stackoverflow.com/q/25139872
type: Comment
type: QuestionComment
has text: @xedo what is that you want to store in your "Set<String> countries"

http://stackoverflow.com/comment/39173101
comment on: http://stackoverflow.com/q/25161758
has text: Isn't LocateRegistry.getRegistry(...) code from client side?
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/q/25187524
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/39222048
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39221239
has comment: http://stackoverflow.com/comment/39223410
has body: I'm editing a class in eclipse like this one: class C { void m2() { m1(); } } Eclipse's Quick Fix feature offers to create method m1() for me. When I do that, eclipse places m1() after m2(). Often that's exactly what I want, but sometimes I want eclipse to place the generated method stub before the current method. How do I do that?
score: 0
has comment: http://stackoverflow.com/comment/39224916
has comment: http://stackoverflow.com/comment/39222029
favorite count: 0
has comment: http://stackoverflow.com/comment/39220925
has title: How do I configure eclipse to generate a missing method before the current method?
answer count: 0

http://stackoverflow.com/a/25228998
accepted answer of: http://stackoverflow.com/q/25225312
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: Your handle() method is invoked every time the user presses "Enter" in the pwBox. This means that each time this happens, you create a brand new Label and add it into the same cell in the grid, placing it on top of anything that was previously placed there. Instead, create the Label once, and update its text in the event handler: final Label message = new Label(); grid.add(message, 1, 7); pwBox.setOnAction(new EventHandler&lt;ActionEvent&gt;() { public void handle(ActionEvent e) { if (!pwBox.getText().equals("T2f$Ay!")) { message.setText("Your password is incorrect!"); message.setTextFill(Color.rgb(210, 39, 30)); //Red } else { message.setText("Your password has been confirmed"); message.setTextFill(Color.rgb(21, 117, 84)); //Green } pwBox.clear(); } });
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25225312

http://stackoverflow.com/comment/39193023
type: AnswerComment
has text: +1 Always nice to answer the question instead of chewing someone out for something irrelevant like not using an IDE.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25172196

http://stackoverflow.com/a/25146637
score: 5
has body: Support for Redis Sentinel is added to Spring Data Redis 1.4. It will be in the upcoming Evans RC1, allowing configuration of JedisConnectionFactory to make use of JedisSentinelPool. RedisSentinelConfiguration sentinelConfig = new RedisSentinelConfiguration() .master("mymaster") .sentinel("127.0.0.1", 26379) .sentinel("127.0.0.1", 26380); JedisConnectionFactory factory = new JedisConnectionFactory(sentinelConfig); factory.afterPropertiesSet(); You can already have a look at the current snapshot build: compile(group: 'org.springframework.data', name: 'spring-data-redis', version: '1.4.0.BUILD-SNAPSHOT')
accepted answer of: http://stackoverflow.com/q/25131166
answers question: http://stackoverflow.com/q/25131166
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/49203161
upvote count: 5
type: Answer
downvote count: 0

http://stackoverflow.com/q/25073790
possible better answer: http://stackoverflow.com/a/25074354
has answer: http://stackoverflow.com/a/25074896
tagged with: jsp
has answer: http://stackoverflow.com/a/25077357
has body: I am trying to iterate a list of objects in my jsp using jstl. I want that for each param name, a dropdown containing the param values appear. jsp code: <c:if test="${fn:length(listOfParams) gt 0}"> Yo YO <c:forEach var="param" items="${listOfParams}"> ${param.paramName} <c:forEach var="listOfParamValue" items="${param.listOfParamValue}"> <c:out value="${listOfParamValue}" /> </c:forEach> </c:forEach> </c:if> Controller Code: DTEJob dteJob2 = new DTEJob(); dteJob2.setParamName("ABC"); dteJob2.addTolistOfParamValue("val1"); dteJob2.addTolistOfParamValue("val2"); dteJob2.setDefault(true); paramList.add(dteJob2); model.addAttribute("listOfParams", paramList); OUTPUT: Yo YO and 2 empty drop downs. Can anyone help why I am unable to retrieve the values in jstl? Any help will be appreciated as I am new to jsp and jstl. My bean class is: private String paramName; private List<String> listOfParamValue=new ArrayList<String>(); public List<String> getListOfParamValue() { return listOfParamValue; } public String getParamName() { return paramName; }
answer count: 3
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25074896
has comment: http://stackoverflow.com/comment/39010002
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39009936
score: 2
upvote count: 2
has title: How to iterate a list of objects in jstl inside jsp
tagged with: java
has answer: http://stackoverflow.com/a/25074354
type: Question
tagged with: jstl

http://stackoverflow.com/a/25083972
downvote count: 0
answers question: http://stackoverflow.com/q/25083769
type: Answer
score: 1
upvote count: 1
has body: You should use a static method to initialize static variables. You can call this static method from the static initializer of the class. static { staticMethodThatInitializesStaticMembers (); }

http://stackoverflow.com/q/25175511
has comment: http://stackoverflow.com/comment/39198698
has comment: http://stackoverflow.com/comment/39198707
score: 0
answer count: 2
has title: Are wildcards in java only applicable to collections?
tagged with: generics
has answer: http://stackoverflow.com/a/25175549
has body: I am not able to figure out how to declare a parameter in a function or a field in a class using ? wildcard without using any collection. For eg. I can write something like List l1 but how do I use ? without using List or any such collection.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25175574
tagged with: java
type: Question
tagged with: bounded-wildcard

http://stackoverflow.com/comment/39182006
type: Comment
comment on: http://stackoverflow.com/q/25142059
type: QuestionComment
has text: Can you post the stacktrace?
score: 0

http://stackoverflow.com/q/25088730
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39038979
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Example data in POJO for JSON documentation
type: Question
tagged with: json-api
has body: I'm trying to document my JSON API. My API returns Java POJOs which get serialized by Jackson. I'm writing a service to return example JSON for each service. What I'd like to do is something like this: class MyPojo { @Example("Bob") public String name; @Example(42) public Integer myInt; public String noExample; } I'll need some method to get Jackson to serialize this as: { "name": "Bob", "myInt": 42 "noExample": "string" } when I need an example. What's the easiest way to make this happen?
tagged with: jackson
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25093229
accepted answer: http://stackoverflow.com/a/25093229

http://stackoverflow.com/comment/39045206
score: 0
comment on: http://stackoverflow.com/q/25092650
type: QuestionComment
type: Comment
has text: final String TESTSTRING =jsonBranchArray.toString(); --224th line

http://stackoverflow.com/q/25194854
has body: I have a Spring Boot server which includes a webjar with my client code. I would like to serve this webjar at the root of my service and not in the /webjar/name/version location. I was able to remap using this configuration: @Configuration public class ClientResourceConfiguration extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/webjars/my-client/1.0-SNAPSHOT/"); } } Still two problems here: - I encode the version in the path, which I would like to avoid - The resources in the webjar are still also available on the /webjar/name/version path Any suggestions?
upvote count: 3
type: UnansweredQuestion
tagged with: spring-mvc
tagged with: spring-boot
score: 3
tagged with: java
has title: Serve webjar as root resource
has comment: http://stackoverflow.com/comment/39252930
type: Question
has answer: http://stackoverflow.com/a/26994186
answer count: 1
downvote count: 0
favorite count: 0
tagged with: webjars

http://stackoverflow.com/comment/39281681
type: Comment
comment on: http://stackoverflow.com/q/25219841
score: 0
type: QuestionComment
has text: I don't see what you are producing or consuming? Needs more code. I just did a problem like this and the trick for the consumer is to test for the item(s) to be available first, then wait only if the buffer is empty. With no items here to look for, I don't know what you are really trying to do.

http://stackoverflow.com/q/25070788
has body: I am writing a basic program that has 3 menu options: Create User, Sign In, and Exit. The user can then choose one of these menu options. If they choose Create User, they will be prompted to enter a User ID and password (which must follow patterns), and will then check against a .DAT file to ensure the User ID has not already been taken. After successful completion, the program will write the new User ID and password to the end of the .DAT file. If they choose Sign In, they will be prompted to enter their User ID, followed by their Password, and the program will then read the .DAT file to validate they are on record. Choosing exit will display a message, "You have signed out." I am fairly new at java programming just as a forewarning. Issues I am encountering with my code: Choosing new user does not append to the .DAT file Choosing Sign In - program does not seem to correctly check .DAT file because even- though I am entering an existing account information it still gives my error "Invalid User ID." import java.io.*; import java.util.*; /** * This program will utilize a menu structure and validate input if the user doesn't choose * a correct option. Writes a new ID and password to .dat file when user chooses to * create new user from menu. * * @author CMS * @Date 7/28/2014 */ public class Passwordv2 { static boolean answer = true; static final String MENUANSW = "[1-3]{1}", USERID = "[A-Z,a-z]{6}-[0-9]{2}"; //, PASSWORD = ""; static String iMenuOption="", iID, recPassword, recUserID, password; static Scanner scanner,scannerDat; static PrintWriter pw; public static void main(String[] args) { init(); while (answer == true) { menu(); if (iMenuOption.equals("1")) createUser(); else if (iMenuOption.equals("2")) signIn(); else {answer = false;} } closing(); } // end of main public static void init(){ //User input scanner scanner = new Scanner(System.in); //PrintWriter try { pw = new PrintWriter(new FileOutputStream (new File ("account.dat"),true) ); } catch(FileNotFoundExc…
has answer: http://stackoverflow.com/a/25070963
has answer: http://stackoverflow.com/a/25070938
score: 0
has answer: http://stackoverflow.com/a/25408790
possible better answer: http://stackoverflow.com/a/25070938
has title: Java does not append to the .DAT file
tagged with: file-io
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25408790
has answer: http://stackoverflow.com/a/25071002
type: Question
tagged with: java

http://stackoverflow.com/q/25099811
tagged with: web
tagged with: tomcat
favorite count: 0
has title: intercepting session set attribute call
has body: We have a third party Java web application which needs to run in a cluster (we need to replicate session across the cluster), session attributes within the application are not serializable and we do not are access to the source code, are their clean, non intrusive ways to intercept session.set attribute calls and change the objects before they are put in session
tagged with: replication
has answer: http://stackoverflow.com/a/25100095
accepted answer: http://stackoverflow.com/a/25100095
type: AnsweredQuestion
downvote count: 0
score: 1
type: Question
tagged with: jakarta-ee
tagged with: java
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/55149702
comment on: http://stackoverflow.com/a/25192607
score: 0
has text: this.setFinishOnTouchOutside(false); is working fine
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25216235
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/39377657
has comment: http://stackoverflow.com/comment/39354231
downvote count: 0
has body: Add a listener for the SWT.FocusOut event which will be notified when the table loses the focus.
has comment: http://stackoverflow.com/comment/39376877
answers question: http://stackoverflow.com/q/25213086
upvote count: 2
has comment: http://stackoverflow.com/comment/39378048
has comment: http://stackoverflow.com/comment/39345192

http://stackoverflow.com/comment/39306703
type: Comment
comment on: http://stackoverflow.com/a/25230422
has text: When I used this method, it reports error: "Entity must be null for http method DELETE". Why is that?
score: 5
type: AnswerComment

http://stackoverflow.com/q/25116597
tagged with: java
has answer: http://stackoverflow.com/a/25120752
answer count: 2
has comment: http://stackoverflow.com/comment/39091077
has comment: http://stackoverflow.com/comment/39090873
has comment: http://stackoverflow.com/comment/39089465
has comment: http://stackoverflow.com/comment/39089651
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25269158
tagged with: android
has comment: http://stackoverflow.com/comment/39092547
possible better answer: http://stackoverflow.com/a/25120752
has comment: http://stackoverflow.com/comment/39089267
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/25269158
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/39090892
has body: I'm unsure on how complicated or easy this issue might be since this is my first project with XML parsing and therefore using the SAX parser. When pulling down XML from a server, I can see in the XML there are a few &amp;#13; in the text, a carriage return character, or new line. After the XML has gone through the SAX parser it comes out the other end without those characters. It comes out as a string and when I add it to a TextView it's just one big block of text, which is obviously not something I want. Is there a way for me to parse the XML and still keep the &amp;#13; characters? My idea was to do a String.replace("&amp;#13;", "\n"); right before adding it to the TextView, therefore making use of new lines. If there is a better way I would love to know but just being able to use &amp;#13; would be helpful too. Thanks in advance for any advice you can offer.
tagged with: sax
upvote count: 1
has title: SAX Parser, new lines being removed after parsing, can I keep them in? (&#13;)
type: Question

http://stackoverflow.com/comment/39061349
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25101575
has text: Can you just add `continue` in the catch block?
score: 0

http://stackoverflow.com/comment/39084837
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25105305
score: 0
has text: @OlegEstekhin No, if you can create a signed provider, you should just create a CipherSpi and a Service within the provider (I have created providers before). Thanks for your questions, I'll try and update this evening when I get back from work.

http://stackoverflow.com/q/25211853
has answer: http://stackoverflow.com/a/25233972
has answer: http://stackoverflow.com/a/25291860
type: AnsweredQuestion
tagged with: javaplot
score: 1
possible better answer: http://stackoverflow.com/a/25233972
favorite count: 0
tagged with: gnuplot
type: Question
answer count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/25291860
has body: I'm having trouble passing GNUplot parameters through JavaPlot. I've been able to use JavaPlot for several different graphs, but I can't seem to get JavaPlot to activate the "polar" setting in GNUPlot. The GNUPlot command to change to polar mode is simply "set polar". I understand that I probably need to give a .set("polar") command to some PropertyHolder object of the JavaPlot. But which object? Intuitively, I would try (after creating an image terminal called png): GNUPlotParameters params = new GNUPlotParameters(); params.set("polar"); GNUPlot p = new GNUPlot(params); p.setTerminal(png); FunctionPlot func = new FunctionPlot("sin(x)"); p.addPlot(func); But this does not work - the build fails on addPlot(). I also tried setting the GNUPlot object itself, but GNUPlot.set() requires a ("keyword","value") argument set, and the command i'd like to sent to GNUPlot is simply "set polar". But doing it this way: p.set("polar",""); also results in a build failure. Anyone have a clue how to set a specific GNUPlot parameter (such as polar)?
has title: Create Polar plot in JavaPlot
tagged with: java
downvote count: 0

http://stackoverflow.com/comment/39111181
type: AnswerComment
score: 0
type: Comment
has text: Thanks for your comment sanj. You're right, I'm sending both a file and data. The backend is in Java. There is a `HttpServletResponse.setHeader()` but no getter? Also, even if there is a `getHeader()` or equivalent api, it is still in the .java component and there is no explicit call made to it by the .js component, in order for it to be able to use a returned json/xml. Any hints?
comment on: http://stackoverflow.com/a/25127892

http://stackoverflow.com/a/25203272
downvote count: 0
has body: The “java.lang.OutOfMemoryError: Java heap space” error you are facing is triggered when you try to add more data into the heap space area in memory, but the size of this data is larger than the JVM can accommodate in the Java heap space. The heap size is a threshold set at JVM intialization. If you do not set it yourself, platform-specific default is used. It is a reasonable safety net to guard against for example leaking processes otherwise bringing the whole machine down to its knees. The easiest way to overcome the issue is just to increase (or add, if missing) the following parameter setting the maximum heap size for your java process, similar to the following example where 1GB heap is allowed: java -Xmx1024m com.mycompany.MyClass
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25127339

http://stackoverflow.com/comment/39114680
comment on: http://stackoverflow.com/q/25130042
score: 0
has text: It is a huge performance issue. That's part of the problem. I would rather do an array for sure but the task says to rewrite it not convert it.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39038357
comment on: http://stackoverflow.com/a/25088945
has text: @T.J.Crowder I'd say you should consider overriding it only if you are going to use your `Iterable` to create parallel Streams.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/64166803
score: 7
has body: For anyone willing to achieve this with the ubiquitous Apache Commons StringUtils: String parsed = StringUtils.substringAfter(yourString, "no ");
downvote count: 0
type: Answer
upvote count: 7
answers question: http://stackoverflow.com/q/25225475

http://stackoverflow.com/comment/39241957
has text: Its use in this case is what makes the speed the same. A compiler worth it's weight in bits will optimize it away. IOW, the assembly code will be identical in C/C++.
type: Comment
comment on: http://stackoverflow.com/a/25198735
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39263525
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25210193
type: QuestionComment
has text: @MarcB - Assuming that data is clean, what is the good solution for this?

sign
tags question: http://stackoverflow.com/q/25156143
type: Tag
tag name: sign

http://stackoverflow.com/comment/39253536
has text: Hi @anubhava, I am using which ever flavor Java uses. I have removed the extra escape slashes for readability.
comment on: http://stackoverflow.com/q/25204979
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25084690
has comment: http://stackoverflow.com/comment/39062472
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25084517
has comment: http://stackoverflow.com/comment/39059768
answers question: http://stackoverflow.com/q/25084517
has comment: http://stackoverflow.com/comment/39066075
downvote count: 0
has body: If the server that sends the photo and the message is a java application I would suggest using kryonet. You can send a packet to the server when the app starts and then program the server to send a packet to the client that contains the message and the image. Then just get the client to display the image and message just like you want! If you need more help just comment and I could explain more.
has comment: http://stackoverflow.com/comment/39043758

versions-maven-plugin
type: Tag
tags question: http://stackoverflow.com/q/25153426
tag name: versions-maven-plugin

http://stackoverflow.com/comment/39283166
type: QuestionComment
has text: sorry for being so noobish but what does stacktrace mean?
comment on: http://stackoverflow.com/q/25220592
score: 0
type: Comment

http://stackoverflow.com/comment/39217228
type: Comment
type: QuestionComment
has text: I added my POJO classes. @PhilippSander, it's a personal preference.
comment on: http://stackoverflow.com/q/25185545
score: 0

http://stackoverflow.com/q/25117718
has comment: http://stackoverflow.com/comment/39091334
downvote count: 4
has comment: http://stackoverflow.com/comment/39091212
upvote count: 0
has body: I would like to write a game about who would take the last marble and I've successfully run it. But when I attempted to add some error messages to it, such as showing "Incorrect range" when the inputs are out of range, it doesn't work properly. I know the problem is due to the incorrect recognition of variable "totalNum", but how to solve it? Thanks in advance :) public static void main(String[] args) { Scanner in = new Scanner(System.in); int pn = 1; System.out.print("Intial no. of marbles [10 ~ 100]: "); int totalNum = in.nextInt(); int input = 0; int from = 1; int to = totalNum/2; if (totalNum &lt; 10||totalNum &gt; 100) { System.out.println("Incorrect range. Try again!"); System.out.print("Intial no. of marbles [10 ~ 100]: "); totalNum = in.nextInt(); } else { while (totalNum &gt; 1) { totalNum = in.nextInt(); System.out.print("Player" + pn + " [" + from + " ~ " + to + "]: "); input = in.nextInt(); if (input &lt; from||input &gt; to) { System.out.println("Incorrect range. Try again!"); continue; } totalNum = totalNum - input; System.out.println("Remaining no. of marbles: " + totalNum); if (pn == 1) { pn = 2; } else { pn = 1; } } } System.out.println("Player" + pn + " takes the last marble."); if (pn == 1) { pn = 2; } else { pn = 1; } System.out.println("Player" + pn + " wins!"); }
tagged with: java
score: -4
has title: Java Unexpected Programming Result
type: Question
tagged with: if-statement
has answer: http://stackoverflow.com/a/25117911
has comment: http://stackoverflow.com/comment/39091211
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39091413
type: UnansweredQuestion

http://stackoverflow.com/comment/39166121
comment on: http://stackoverflow.com/a/25158110
score: 0
type: AnswerComment
type: Comment
has text: @ccjmne I added another test case for this, and it works as expected. Note that the `equalSequence` method implicitly checks whether the sequences have the same length, by returning `true` only when the sequences arrive again at their first element *at the same time*.

http://stackoverflow.com/a/25207559
has body: The chars '1' &amp; '2' in this care are being interpreted as their UTF-16 value. So '1' is really being evaluated as 49, '2' as 50, and so on. I need more rep to post pictures but here's an ASCII code chart. http://asciiset.com/asciitable.gif.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39258644
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39258621
has comment: http://stackoverflow.com/comment/39258578
answers question: http://stackoverflow.com/q/25207419

http://stackoverflow.com/a/25104396
score: 2
upvote count: 2
has body: You may be able to achieve this using Power Mockito (https://code.google.com/p/powermock/wiki/MockitoUsage) @RunWith(PowerMockRunner.class) @PrepareForTest({ MyResource.class }) public class MyResourceTest { @Test public void testGetIt()() { MyResource mr = new MyResource(); //Setup mock A mockA = PowerMockito.mock(A.class); String mockReturn = "Some String"; //Stub new A() with your mock PowerMockito.whenNew(A.class).withAnyArguments().thenReturn(mockA); PowerMockito.doReturn(mockReturn).when(mockA).getWeather(); String ret = mr.getIt(); //asserts go here } } Note that you can mock a local variable creation using PowerMockito's whenNew - this should take care of your concern for A a = new A() code in getIt() method.
has comment: http://stackoverflow.com/comment/43270819
has comment: http://stackoverflow.com/comment/39124349
has comment: http://stackoverflow.com/comment/39069694
answers question: http://stackoverflow.com/q/25104045
accepted answer of: http://stackoverflow.com/q/25104045
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39171766
type: Answer

akka
type: Tag
tags question: http://stackoverflow.com/q/25221698
tags question: http://stackoverflow.com/q/25154253
tags question: http://stackoverflow.com/q/25212937
tag name: akka
tags question: http://stackoverflow.com/q/25141202
tags question: http://stackoverflow.com/q/25094568
tags question: http://stackoverflow.com/q/25095487

http://stackoverflow.com/q/25084420
tagged with: java
type: UnansweredQuestion
has title: How to Automate Web Login in Website abelhas.pt using Java
tagged with: web
type: Question
has body: I am having a hard time trying to figure out the correct process for automating login for the following website: http://abelhas.pt I have used Firefox's HttpFox plugin to discover the login form and action page url, in the generated HTML code and have found out that to perform login, I will need to post the following parameters: Login=theLogin Password=thePassword Redirect=True RedirectUrl= RememberMe=false FileId=0 The url to which the parameters are being passed when the user presses the submit button, is the following: "/action/login/login" (which is the one shown on the "action" attribute of the html element) However, when generating and posting it using the following URL: http://abelhas.pt/action/login/login?Login=theLogin&amp;Password=thePassword&amp;Redirect=True&amp;RedirectUrl=&amp;RememberMe=false&amp;FileId=0 (Please note that the the values of "theLogin" and "thePassword" should be replaced by a valid login and password) I am always getting "http://abelhas.pt/Error404.aspx", meaning that the following webpage was not found... In the past, I have already been able to successfully automate logging-in in websites such as Google, filefactory, zippyshare, Imageshack, etc..however this one seems to be playing tricks on me... Can someone help me understanding what is happening or what am I doing wrong? Many thanks guys! Gizmo
score: 0
tagged with: authentication
answer count: 1
has answer: http://stackoverflow.com/a/29666899
tagged with: automation

http://stackoverflow.com/comment/39034049
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25086632
has text: The serialVersionUID of the writer is actually in the data, and the reader checks it's serialVersionUID matches. If you don't specify it, it is generated based on the fields, constructors and methods of the class. The writer data structure should be the same as the readers but java is pedantic if you don't override the field.
type: AnswerComment

http://stackoverflow.com/comment/39242814
type: Comment
comment on: http://stackoverflow.com/q/25193738
has text: @MadProgrammer I've gone throug several links and I won't warm this up just for evidence. But if you can find a question/tutorial on how to load/split/save multiple fragments, I would be pleased. :) But since ccjme's answer, thats ok. :)
score: 0
type: QuestionComment

http://stackoverflow.com/q/25228615
type: AnsweredQuestion
upvote count: 2
score: 1
downvote count: 1
type: Question
has body: Appium version is: 1.2.0.1 I saw a few codes for that, like: // click back button HashMap swipeObject = new HashMap(); swipeObject.put("keycode", 82); ((JavascriptExecutor)driver).executeScript("mobile: keyevent", swipeObject); // click back button HashMap&lt;String, Integer&gt; keycode = new HashMap&lt;String, Integer&gt;(); keycode.put("keycode", 4); ((JavascriptExecutor)driver).executeScript("mobile: keyevent", keycode); But they don't work , any idea how ?
tagged with: appium
possible better answer: http://stackoverflow.com/a/56110632
tagged with: java
accepted answer: http://stackoverflow.com/a/25241428
has answer: http://stackoverflow.com/a/56110632
answer count: 3
has comment: http://stackoverflow.com/comment/39298014
has answer: http://stackoverflow.com/a/34649872
has comment: http://stackoverflow.com/comment/39323415
favorite count: 0
has comment: http://stackoverflow.com/comment/39312528
tagged with: android
has title: How to create an appium android device "back button" in java
has answer: http://stackoverflow.com/a/25241428
tagged with: selenium-webdriver

http://stackoverflow.com/q/25176033
has comment: http://stackoverflow.com/comment/39199710
has comment: http://stackoverflow.com/comment/39199691
tagged with: arraylist
has answer: http://stackoverflow.com/a/25176097
downvote count: 0
has comment: http://stackoverflow.com/comment/39199685
favorite count: 0
possible better answer: http://stackoverflow.com/a/25176097
has answer: http://stackoverflow.com/a/25176089
has comment: http://stackoverflow.com/comment/39199621
has answer: http://stackoverflow.com/a/25176204
has body: public static void main(String[] args) { ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); String s = "nope"; String v = "nopenopes"; list.add(s); list.add(v); keywordCount(list, "nope"); } public static int keywordCount(ArrayList&lt;String&gt; str , String keyword){ int count = 0; for (int i = 0;i&lt;str.size();i++){ while ((i= str.indexOf(keyword,i)) != -1) { // here is where I found the error count++; i += keyword.length(); }} System.out.println(count); return count; } hello, I'm writing a piece of code that counts the occurrences of a specific keyword inside an array list. It worked for a line of string but did not when trying to do the same thing for an arraylist. Can someone please point out what I did incorrectly and help me fix it. Thanks in advance.
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25176089
has comment: http://stackoverflow.com/comment/39199594
has title: Count the number of occurrences of keywords in an Array list
has answer: http://stackoverflow.com/a/25176287

http://stackoverflow.com/comment/39256608
comment on: http://stackoverflow.com/q/25204423
score: 0
type: QuestionComment
type: Comment
has text: Thats exactly what I need and I didnt find :(

http://stackoverflow.com/comment/39105588
has text: Can you get the location of the mouse and display the context menu at it's coordinates?
comment on: http://stackoverflow.com/q/25125222
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25179465
has comment: http://stackoverflow.com/comment/39205990
downvote count: 0
has comment: http://stackoverflow.com/comment/39206282
has comment: http://stackoverflow.com/comment/39206333
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39205758
score: 15
has comment: http://stackoverflow.com/comment/39206600
accepted answer of: http://stackoverflow.com/q/25179055
type: Answer
has body: A MenuInflater is an object that is able to create Menu from xml resources (of course only menus resources), that is : construct a new instance of Menu given a menu resource identifier. The onCreateOptionMenu(Menu) is called when the menu button of the device is pressed, or either Activity.openOptionsMenu() is called. The actual rendering of the menu is handled by the activity. Just before it is shown, the Activity passes to you the menu so that you can fill it with your own items, then shows it. So Android undertakes that since it's not your business to render the menu, you shall not control what menu is actually passed to you inside onCreateOptionsMenu. As for the ActionBar, the onCreateOptionsMenu is called when filling ActionBar, so that options from the menu be available in the ActionBar. This method is only called once after the Activity be created. If you want to modify the menu later, you should instead override Activity.onPrepareOptionsMenu
upvote count: 15
has comment: http://stackoverflow.com/comment/39205673
answers question: http://stackoverflow.com/q/25179055

http://stackoverflow.com/comment/39217104
has text: @AhouraGhotbi If you still get a `NullPointerException` with that while loop, it means that `tempEdge` is `null`.
type: AnswerComment
comment on: http://stackoverflow.com/a/25184943
type: Comment
score: 1

http://stackoverflow.com/a/25203683
downvote count: 0
has comment: http://stackoverflow.com/comment/131681071
has body: use this in your drawable <?xml version="1.0" encoding="utf-8"?> <solid android:color="#55ff55"/> <size android:height="60dp" android:width="60dp"/> Set background for the textview as this
type: Answer
has comment: http://stackoverflow.com/comment/39250980
has comment: http://stackoverflow.com/comment/39250714
upvote count: 5
answers question: http://stackoverflow.com/q/25203501
score: 5

http://stackoverflow.com/comment/40110203
has text: but in Google drive GUI, there's no folder. there's nothing !
comment on: http://stackoverflow.com/q/25080884
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39305005
has text: And casting an object reference *does not* change the class of the referenced object. Unlike casting, eg, `float` with `(int)`, which actually modifies the value cast, casting an object reference modifies nothing.
comment on: http://stackoverflow.com/q/25228474
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25159118
downvote count: 0
has comment: http://stackoverflow.com/comment/39993096
answers question: http://stackoverflow.com/q/25157153
has body: GWT.Create can be used only in client mode. Are you sure that code execute in server side? If i write in my application GWT.Create in server side i get this error: java.lang.UnsupportedOperationException: ERROR: GWT.create() is only usable in client code! It cannot be called, for example, from server code. If you are running a unit test, check that your test case extends GWTTestCase and that GWT.create() is not called from within an initializer or constructor. You can read a properties files in java. The file is similar that Constants files in GWT. Example of Properties file: key = value host = 127.0.0.1 port = 80 username = guest password = guest EOF You can read this file, see the next code: import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; String fileToRead = "MY_PATH"+File.separator+"MY_FILE.properties"; Properties prop = new Properties(); try { File propertiesFile = new File(fileToRead); prop.load(new FileInputStream(propertiesFile)); String host = prop.getProperty("host"); String port = prop.getProperty("port"); String username = prop.getProperty("username"); String password = prop.getProperty("password"); System.out.println(host); System.out.println(port); System.out.println(username); System.out.println(password); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } If the key doesnt exists getProperty(String key) return null. You can use prop.containsKey(String key); to see if the key exists. This function return a boolean (True if exists False in other case). Greetings
accepted answer of: http://stackoverflow.com/q/25157153
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39169898
type: AcceptedAnswer

http://stackoverflow.com/q/25152105
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/25152489
score: -1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39159138
tagged with: java
has comment: http://stackoverflow.com/comment/39170479
tagged with: output
downvote count: 1
has comment: http://stackoverflow.com/comment/39176064
type: Question
has body: I got a weird case. I tried two different method to output the double number in Java. Let the result be a double number. The first one is : DecimalFormat resFormat = new DecimalFormat("0.00E00f\n"); String strRes = resFormat.format(result); if (strRes.contains("E-")) strRes = strRes.replace("E", "e"); else strRes = strRes.replace("E", "e+"); The second one is: String strRes = String.format("%3.2ef\n",result); I am working on an OJ challenge for interest (in Chinese, http://ac.jobdu.com/problem.php?pid=1514). I tried. Keep all the other code completely the same, the first output passed all the test, while the second one lead to some error. One output passed the test, while another failed. So the output of these two solutions must be different in some case, right? Why and when they are different? PS: the input for both code segments is valid double numbers, neither NaN nor Infinity.
upvote count: 0
accepted answer: http://stackoverflow.com/a/25152489
has title: Java Output double in Scientific Notation
has comment: http://stackoverflow.com/comment/39155548
answer count: 1
has comment: http://stackoverflow.com/comment/39155609

http://stackoverflow.com/comment/39274269
score: 0
type: Comment
has text: using `binder.bind(new TextField(), "endereco.cidade");` it works but using `binder.buildAndBind("Cidade", "endereco.cidade");` isn't work. Do you know why ?
comment on: http://stackoverflow.com/a/25206119
type: AnswerComment

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/25119125
tags question: http://stackoverflow.com/q/25219031
tags question: http://stackoverflow.com/q/25080554
tags question: http://stackoverflow.com/q/25070041
tags question: http://stackoverflow.com/q/25193058
tags question: http://stackoverflow.com/q/25216955
tags question: http://stackoverflow.com/q/25224454
tags question: http://stackoverflow.com/q/25125553
tags question: http://stackoverflow.com/q/25108040
type: Tag
tags question: http://stackoverflow.com/q/25211002
tags question: http://stackoverflow.com/q/25124282
tags question: http://stackoverflow.com/q/25190791
tags question: http://stackoverflow.com/q/25099290

http://stackoverflow.com/a/25117274
score: 0
has body: The first one is explicit call to an activity where as the other one as Vann said used to call to activities related to other apps if found in manifest. You can also call implicitly like that: Intent i = new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.so.com"));
type: Answer
has comment: http://stackoverflow.com/comment/39091162
has comment: http://stackoverflow.com/comment/39091446
has comment: http://stackoverflow.com/comment/39090534
answers question: http://stackoverflow.com/q/25117002

http://stackoverflow.com/q/25141604
has comment: http://stackoverflow.com/comment/39135748
tagged with: java
has body: I have an enum which is quite weird for me. enum PoolType { FIXED(4), CACHED, SINGLE; private int threadsAmount; private PoolType(int threadsAmount) { this.threadsAmount = threadsAmount; } private PoolType() { } public int getThreadsAmount() { return threadsAmount; } public PoolType withThreads(int threadsAmount) { this.threadsAmount = threadsAmount; return this; } } Actually I want to know is it OK by design or maybe there are some errors? PS I cau use it in a way like this new ExecutionStarter(PoolType.CACHED.withThreads(5));
has comment: http://stackoverflow.com/comment/39135733
possible better answer: http://stackoverflow.com/a/25141772
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25141772
has title: Need advice in enum design structure in Java
has answer: http://stackoverflow.com/a/25141865
has answer: http://stackoverflow.com/a/25142127
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25141865
has comment: http://stackoverflow.com/comment/39137945
has comment: http://stackoverflow.com/comment/39135735
type: Question
tagged with: enums

http://stackoverflow.com/a/28048620
upvote count: 9
has body: Or in Spring 4 flavour ;) @Bean public JmsTemplate jmsTemplate() { return Mockito.mock(JmsTemplate.class); } Exactly as @Stephane said, but without xml. But still I would recommend you use an embedded broker for your integration tests. As it would allow you to check what exactly is coming to the queue.
answers question: http://stackoverflow.com/q/25178454
downvote count: 0
score: 9
type: Answer

http://stackoverflow.com/comment/39036078
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25087483
type: Comment
has text: @codebreaker: Note that you can improve it by testing that the last match is at the end of the string with a little trick.

http://stackoverflow.com/comment/39066615
type: QuestionComment
has text: The first problem is that `Animal` is apparently not an abstract class. There goes your entire hierarchy. You should follow a tutorial on OOP first, they have this exact situation everywhere.
comment on: http://stackoverflow.com/q/25104550
score: 0
type: Comment

http://stackoverflow.com/q/25204481
has answer: http://stackoverflow.com/a/35269214
has answer: http://stackoverflow.com/a/70141237
has answer: http://stackoverflow.com/a/25204581
has answer: http://stackoverflow.com/a/35256610
tagged with: java
has title: Separating the Digits in an Integer - exercise from Deitel's Java book
has answer: http://stackoverflow.com/a/25204591
answer count: 11
type: Question
has answer: http://stackoverflow.com/a/64273270
has answer: http://stackoverflow.com/a/51288077
upvote count: 0
score: -3
possible better answer: http://stackoverflow.com/a/64273270
favorite count: 0
has answer: http://stackoverflow.com/a/60924929
has body: Exercise from Deitel's "Java How To Program" 10th edition: 2.30 (Separating the Digits in an Integer) Write an application that inputs one number consisting of five digits from the user, separates the number into its individual digits and prints the digits separated from one another by three spaces each. For example, if the user types in the number 42339, the program should print 4 2 3 3 9 Assume that the user enters the correct number of digits. What happens when you enter a number with more than five digits? What happens when you enter a number with fewer than five digits?[Hint: It's possible to do this exercise with the techniques you learned in this chapter. You'll need to use both division and reminder operations to "pick off" each digit.] Could someone explain to me how should I go about "picking off" individual integers using division and reminder operators? EDIT: control structures (if / else and the like) are not allowed yet, those are explored in future chapters. Variables, arithmetic operators and comparison operators only.
accepted answer: http://stackoverflow.com/a/25204591
has answer: http://stackoverflow.com/a/63861369
has comment: http://stackoverflow.com/comment/39252430
downvote count: 3
has answer: http://stackoverflow.com/a/26680622
has answer: http://stackoverflow.com/a/25204783
type: AnsweredQuestion

http://stackoverflow.com/comment/39350116
comment on: http://stackoverflow.com/a/25251963
has text: Website servers modify their content based on your browser User-Agent setting. This is so, for example, the server can provide appropriate content depending on whether you're using a PC or a mobile device for example. Whatever default User-Agent was being sent by your code was being interpreted as a mobile device. That's why I linked to the SO question on setting your User-Agent value.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/25222061
type: UnansweredQuestion
has title: [Microsoft][ODBC Microsoft Access Driver] '(unknown)' is not a valid path
has body: I have created DSN for Mapped drive like this:- Y:\\192.168.2.5\data\db.accdb Now i am accessing this database from java application using sun jdbc odbc drivers. Application is running on Window 2008 64-bit system and database is running on Window Server 2012 64-bit system. When I ran this application with Java 64-bit it throw error of architecture mismatch. Then i install java of 32-bit and the above problem is resolved. But getting another problem as java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that yo u are connected to the server on which the file resides. How to resolve this problem? See the database path witch is not valid for my program. This path is mapped with Y:\192.168.2.5\shared drive.
has answer: http://stackoverflow.com/a/78382485
has answer: http://stackoverflow.com/a/56837822
tagged with: java
type: Question
score: 5
tagged with: jdbc-odbc
upvote count: 5
answer count: 6
has answer: http://stackoverflow.com/a/33375438
tagged with: ms-access-2007
downvote count: 0
has answer: http://stackoverflow.com/a/47987520
has answer: http://stackoverflow.com/a/25222122
favorite count: 0
has answer: http://stackoverflow.com/a/43234817

http://stackoverflow.com/comment/39277264
comment on: http://stackoverflow.com/a/25217419
has text: Well what you are doing is sort of hard to make secure. If you make the authentication happen server-side, anyone can still authenticate with it because there is no other form of authentication. If you want the easiest way you can do what @BenjaminJB said and hope nobody figures it out.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25221849
answers question: http://stackoverflow.com/q/25221823
type: Answer
upvote count: 1
score: 1
has body: public static void main(String[] args) { Thread t = new Thread(); t.start(); t.start(); } Produces: Exception in thread "main" java.lang.IllegalThreadStateException at java.lang.Thread.start(Thread.java:682) at quicktest.CopyOnWrite.main(CopyOnWrite.java:23) Java Result: 1
accepted answer of: http://stackoverflow.com/q/25221823
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39241433
score: 0
type: Comment
type: QuestionComment
has text: I was hoping someone would have commented on this - I wanted to see the answer. Have you got any nearer?
comment on: http://stackoverflow.com/q/25142625

http://stackoverflow.com/q/25218343
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25218393
has comment: http://stackoverflow.com/comment/39279220
type: Question
score: 3
has comment: http://stackoverflow.com/comment/39279188
has title: Get number of columns using OpenCSV
downvote count: 0
answer count: 1
tagged with: opencsv
favorite count: 0
has body: I have a txt file and I want to count the number of columns. (I use openCSV) public class demoTable { public demoTable(){ read(); JOptionPane.showMessageDialog(null, "number of columns inside file: " + getNumberOfColumnsFromFile(), null, JOptionPane.INFORMATION_MESSAGE); close(); } private void read(){ try { this.fileInputStream = new FileInputStream("D:\\Book3.txt"); UTF8_CHARSET = StandardCharsets.UTF_8.newDecoder(); UTF8_CHARSET.onMalformedInput(CodingErrorAction.REPLACE); this.fileReader = new InputStreamReader(this.fileInputStream, UTF8_CHARSET); this.reader = new CSVReader(this.fileReader, '\t'); } catch (FileNotFoundException ex) { Logger.getLogger(VJTable.class.getName()).log(Level.SEVERE, null, ex); } } private int getNumberOfColumnsFromFile(){ //Estimating number of rows from file (Googled that). this.numberOfColumns = 0; try { while( (this.nextLine = this.reader.readNext()) != null){ this.numberOfColumns++; } } catch (IOException ex) { Logger.getLogger(VJTable.class.getName()).log(Level.SEVERE, null, ex); } return this.numberOfColumns; } private void close(){ try { this.fileInputStream.close(); this.fileReader.close(); this.reader.close(); } catch (IOException ex) { Logger.getLogger(VJTable.class.getName()).log(Level.SEVERE, null, ex); } } } Unfortunately, the getNumberOfColumnsFromFile() method returns the number of rows instead of columns. Could you please tell me what I don't do well in here? Thank you in advance.
has answer: http://stackoverflow.com/a/25218393
type: AnsweredQuestion

http://stackoverflow.com/a/25123146
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25122639
has comment: http://stackoverflow.com/comment/39212192
has body: It is there, see http://repo1.maven.org/maven2/org/neo4j/neo4j-kernel/2.1.3/ having a neo4j-kernel-2.1.3-tests.jar. I've just verified that the equivalent dependency in gradle just works fine: testCompile group: 'org.neo4j', name: 'neo4j-kernel', version: '2.1.3', classifier: 'tests' Maybe you're using Maven central behind a proxy that has not yet been updated?
has comment: http://stackoverflow.com/comment/39101589
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25122639

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/25151991
type: Tag
tags question: http://stackoverflow.com/q/25151268
tags question: http://stackoverflow.com/q/25152899
tags question: http://stackoverflow.com/q/25215225
tags question: http://stackoverflow.com/q/25215345
tags question: http://stackoverflow.com/q/25214701
tags question: http://stackoverflow.com/q/25090447
tags question: http://stackoverflow.com/q/25121668

http://stackoverflow.com/comment/39129951
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25138587
has text: possible duplicate of [String is immutable. What exactly is the meaning?](http://stackoverflow.com/questions/8798403/string-is-immutable-what-exactly-is-the-meaning)
type: Comment

http://stackoverflow.com/a/25145695
answers question: http://stackoverflow.com/q/25145634
has body: Create compareToReversed method that will return -compareTo result. Have a look here for inspiration
score: 0
type: Answer

http://stackoverflow.com/comment/39239242
type: Comment
has text: @RuchiraGayanRanaweera Yes,thx, but I have read it and found no answers on that.
type: QuestionComment
comment on: http://stackoverflow.com/q/25197269
score: 0

http://stackoverflow.com/a/25226898
answers question: http://stackoverflow.com/q/25226832
score: 5
has comment: http://stackoverflow.com/comment/39294540
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/39294698
has comment: http://stackoverflow.com/comment/39294609
downvote count: 1
has comment: http://stackoverflow.com/comment/39294812
has comment: http://stackoverflow.com/comment/39294632
has comment: http://stackoverflow.com/comment/39294661
has body: class Main { public static void main(String[] args) { String str = "aasbkllzzzs"; // create frequency table for 128 - ASCII Characters int[] freq = new int[128]; // For each character, increment count in the frequency table for (char ch : str.toCharArray()) { freq[ch]++; } System.out.println("Frequencies : "); for (int i = 0; i &lt; freq.length; i++) { // Print results for which count &gt; 0 // (char) i =&gt; Character // freq[i] =&gt; Frequency of character if (freq[i] != 0) { System.out.println("Char : " + (char) i + ", Count : " + freq[i]); } } } } output : Frequencies : Char : a, Count : 2 Char : b, Count : 1 Char : k, Count : 1 Char : l, Count : 2 Char : s, Count : 2 Char : z, Count : 3
has comment: http://stackoverflow.com/comment/39294504
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39294605
has comment: http://stackoverflow.com/comment/39294700
has comment: http://stackoverflow.com/comment/39294684
accepted answer of: http://stackoverflow.com/q/25226832
has comment: http://stackoverflow.com/comment/39294559

http://stackoverflow.com/q/25151373
tagged with: android
tagged with: android-intent
type: AnsweredQuestion
has title: [Android][Tab-Intent] How to open to a specific tab in tabactivity from Intents?
score: 1
tagged with: java
upvote count: 1
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25151501
accepted answer: http://stackoverflow.com/a/25151501
has body: How would I set up my code so when I start the tabactivity it opens to a specific tab depending on what intents I started it from? ie. click a squat button from mainactivity -> opens tabactivity with squat-tab selected and showing Most googling resulted in people using tabhost so I don't know what I can do here. Thanks public class tabtry extends Activity implements ActionBar.TabListener { /** * The {@link android.support.v4.view.PagerAdapter} that will provide * fragments for each of the sections. We use a * {@link android.support.v13.app.FragmentPagerAdapter} derivative, which will keep every * loaded fragment in memory. If this becomes too memory intensive, it * may be best to switch to a * {@link android.support.v13.app.FragmentStatePagerAdapter}. */ SectionsPagerAdapter mSectionsPagerAdapter; /** * The {@link android.support.v4.view.ViewPager} that will host the section contents. */ ViewPager mViewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tabtry); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i &lt; mSectionsPagerAdapter.getCount();…
answer count: 1
favorite count: 0
tagged with: tabs

http://stackoverflow.com/comment/39197960
type: AnswerComment
has text: No that does not work, thanks for the answer though, ( I get the same result)
type: Comment
comment on: http://stackoverflow.com/a/25175005
score: 0

http://stackoverflow.com/comment/39221937
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/25174460
type: Comment
has text: My job as a troll is not to troll, and that's the troll :P

http://stackoverflow.com/q/25070294
has answer: http://stackoverflow.com/a/25070708
answer count: 5
possible better answer: http://stackoverflow.com/a/25070587
type: AnsweredQuestion
has body: I want to sort a list that contains objects that are unrelated by providing a custom order. For example, the list I want to sort contains objects of the class Animal. An animal object has an object called type which may be a Cat, Mouse or Dog. I have a custom order Mouse &lt; Cat &lt; Dog. How can I achieve that the list containing animals is sorted with my custom order? In particular, given the following code, I do not know how to implement the comparator. In addition this is a simplified example, I cannot modify the classes Dog, Cat, Mouse nor Animal. // Cat and Mouse are similar public class Dog { ... } public class Animal { Object type; public Animal(Object aType) { type = aType; } // getter , setter etc. } public class Comparison { List&lt;Animal&gt; animals; public Comparison() { Dog dog1 = new Dog(); Animal animal1 = new Animal(dog); animals.add(animal1); Cat cat1 = new Cat(); Animal animal2 = new Animal(cat); animals.add(animal2); // add other elements of type dog, cat or mouse .... // sort the list with custom order: mouse&lt;cat&lt;dog Collections.sort(animals,intComparator()); } private Comparator&lt;Animal&gt; intComparator() { return new Comparator&lt;Animal&gt;() { @Override public int compare(Animal first, Animal second) { return ???; } }; } } One solution would be to manually check the class of type (via instanceof) and hard code the order in the comparator. However I have too many classes that can be contained in Animal (not only three as in this example), so this would yield a significant amount of if cases. private Comparator&lt;Animal&gt; intComparator() { return new Comparator&lt;FXNode&gt;() { @Override public int compare(Animal first, Animal second) { // if first is a mouse, return -1 because it is the 'smallest' object if (first.getType() instanceof Mouse) return -1; // if first is a cat and second a mouse, return 1 etc., a lot of if cases }
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25070592
tagged with: comparator
accepted answer: http://stackoverflow.com/a/25070592
has answer: http://stackoverflow.com/a/25070821
tagged with: sorting
has answer: http://stackoverflow.com/a/25070587
score: 0
has answer: http://stackoverflow.com/a/25070393
has title: Java - Comparing unrelated objects with a custom order

http://stackoverflow.com/q/25074351
tagged with: java
tagged with: javascript
accepted answer: http://stackoverflow.com/a/25076862
linked to: http://stackoverflow.com/q/16889950
has comment: http://stackoverflow.com/comment/39015965
upvote count: 0
answer count: 1
favorite count: 0
type: AnsweredQuestion
downvote count: 2
has title: Executing phantom.exit() in java script from JAVA program
type: Question
has body: How to execute phantom.exit() in java script from JAVA program. Actually the scenario is Java program calls a java script program using PhantomJs, java script program is returning some values to that Java program. Refer to this link : Running Phantomjs from javascript, JSP or Java After getting values from javascript I need to stop javascript. For that I used phantom.exit() in javascript, which is not executing when I call it from Java Program. But it works fine when I execute the same javascript program from command promt using the command 'phantomjs myscript.js'. The code is getting stuck in this line.. int exitStatus = process.waitFor(); It keep on waiting and it is not terminating. So what is the way to terminate javascript from JAVA program?
tagged with: phantomjs
has answer: http://stackoverflow.com/a/25076862
has comment: http://stackoverflow.com/comment/39019322
score: -2

http://stackoverflow.com/q/25196884
tagged with: wso2
downvote count: 0
tagged with: java
has title: curl errors: could not resolve host, java.lang.StringIndexOutOfBoundsException: String index out of range: -1
tagged with: wso2-data-services-server
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/25196914
answer count: 1
has body: Sorry for posting this as this might be a simple problems to experts but to me as a beginner it is an important issue to resolve. I have created a WSO2 DSS service where it has a MYSQL table datasource named users(userid(auto_increment),first_name,last_name,password). I created specific queries for GET, POST, PUT, DELETE and also resources to accommodate these request. When I started testing the service using cURL GET and DELETE, it was working and I was able to retrieve and delete data. However when I was trying to insert (POST) and update (PUT) data I'm getting multiple errors shown below: curl: (6) Could not resolve host: first_name curl: (6) Could not resolve host: last_name curl: (6) Could not resolve host: password HTTP/1.1 500 Internal Server Error Access-Control-Allow-Headers: authorization,Access-Control-Allow-Origin,Content-Type Vary: Accept-Encoding Content-Type: text/html;charset=utf-8 Date: Fri, 08 Aug 2014 05:05:43 GMT Server: WSO2-PassThrough-HTTP Transfer-Encoding: chunked Apache Tomcat/7.0.34 - Error report HTTP Status 500 - String index out of range: 1 type Exception report message String index out of range: -1 description The server encountered an internal error that prevented t from fulfilling this request. exception java.lang.StringIndexOutOfBoundsException: String index out of range: -1 java.lang.String.substring(String.java:1911) rg.apache.axis2.builder.XFormURLEncodedBuilder.extractParametersFromRequest(XFormURLEncodedBilder.java:174) rg.apache.axis2.builder.XFormURLEncodedBuilder.processDocument(XFormURLEncodedBuilder.java:12) rg.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:188) org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:146) org.apache.axis2.transport.http.util.RESTUtil.processXMLRequest(RESTUtil.java:65) org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processXMLRequest(AxisServlet.java:826) org.apache.axis2.transport.http.AxisServlet.doPut(AxisServlet.…
has answer: http://stackoverflow.com/a/25196914
favorite count: 0
tagged with: curl
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/39183937
has text: given that the question is about the wallpaper manager, and that the answers given in the duplicate question are a/ different from the accepted answer and b/ irrelevant in this case, and given that the accepted answer for this question is not applicable to the duplicate question, I vote for reopening the question.
score: 0
comment on: http://stackoverflow.com/q/25166024
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25115789
has body: I want to run unit test on file in this format: Target; targeT; true Targe1; targe2; true I saw these two open source projects: junitparams - cannot set a non CSV-file as an input zohhak - can customize the separator but not set a file as an input I have tried to implement my own file reader but it fails sometimes and also assert "false" on one line crashes the whole test (in contrast to junitparams framework). How can I insert a non-CSV-file as batch input (with a delimiter different than ,)
tagged with: junit
score: 1
has comment: http://stackoverflow.com/comment/39362536
has comment: http://stackoverflow.com/comment/39356927
favorite count: 0
type: Question
has title: How to run parameterized jUnit tests with a custom delimiter/separator
upvote count: 2
tagged with: java
downvote count: 1
answer count: 1
tagged with: unit-testing
tagged with: testing
has comment: http://stackoverflow.com/comment/39091272
tagged with: junit4
has answer: http://stackoverflow.com/a/29668868
type: UnansweredQuestion

http://stackoverflow.com/comment/39142705
has text: My LG Optimus L9 handles 10 multitouches so yes it does.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25125285
type: Comment

http://stackoverflow.com/comment/39264395
comment on: http://stackoverflow.com/q/25207802
type: QuestionComment
type: Comment
score: 0
has text: `Bitmap a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, a42, a43, a44, a45, a46, a47, a48, a49, a50, a51, a52, a53, a54, a55, a56, a57, a58, a59, a60, a61, a62, a63, a64, a65, a66, a67, a68, a69, a70, a71, a72, a73, a74, a75, a76, a77, a78, a79, a80, a81, a82, a83, a84, a85, a86, a87, a88, a89, a90, a91, a92, a93, a94, a95, a96, a97, a98, a99, a100;` It is insane to declare so many variables. Use an array instead. You are fired ;-).

http://stackoverflow.com/a/25215602
type: Answer
has comment: http://stackoverflow.com/comment/39282208
has body: Your question is if we have any ideas why cron isn't working. Based on what you wrote, I think that you probably recently moved the input or output file. It may run when you execute it manually but cron runs from a different location, so you have to use full paths to all files and commands, please try this. Source: Experienced same problem Best Regards
has comment: http://stackoverflow.com/comment/39610881
answers question: http://stackoverflow.com/q/25183729
has comment: http://stackoverflow.com/comment/39274664
score: 0
accepted answer of: http://stackoverflow.com/q/25183729
type: AcceptedAnswer

http://stackoverflow.com/comment/39128035
has text: I don't really understand what to do here. Could you provide an example?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25136840
score: 0

http://stackoverflow.com/q/25162510
favorite count: 0
has comment: http://stackoverflow.com/comment/39174554
has body: I want to have 2 buttons on my application with a transparent background and I "almost" done it. This is what I've done : public class PanelMenu extends JPanel{ //VARIABLES private JButton buttonFightSimulator, buttonMatchUp; //CONSTRUCTORS public PanelMenu () { this.setBounds(0,0,240,768); this.setLayout(new FlowLayout(0, 0, 0)); //BUTTON CREATION buttonFightSimulator = new JButton("FIGHT SIMULATOR"); buttonMatchUp = new JButton("MATCH UP"); buttonFightSimulator.setBackground(new Color(255,255,255,128)); buttonFightSimulator.setFocusPainted(false); buttonFightSimulator.setBorderPainted(false); buttonFightSimulator.setPreferredSize(new Dimension(240,60)); buttonMatchUp.setBackground(new Color(255,255,255,128)); buttonMatchUp.setFocusPainted(false); buttonMatchUp.setBorderPainted(false); buttonMatchUp.setPreferredSize(new Dimension(240,60)); add(buttonFightSimulator); add(buttonMatchUp); this.setBackground(new Color(0,0,0,90)); } And this is what I visually have : Well that's great that's what I wanted. But when I pass my mouse over the 2 buttons, this is what happen : So first the background get less and less transparent every time the mouse moves over it and then we can see that the text of the both buttons are mixed together. Thank you in advance for your answer.
tagged with: swing
has comment: http://stackoverflow.com/comment/39188323
tagged with: jbutton
type: AnsweredQuestion
score: 3
upvote count: 3
has title: JButton alpha background change with mouseover
tagged with: java
tagged with: background
type: Question
tagged with: alpha
has answer: http://stackoverflow.com/a/25171223
accepted answer: http://stackoverflow.com/a/25171223
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/39204126
comment on: http://stackoverflow.com/a/25178700
score: 0
type: Comment
has text: That will also split the individual digits of the time though.
type: AnswerComment

http://stackoverflow.com/q/25099982
accepted answer: http://stackoverflow.com/a/25100468
linked to: http://stackoverflow.com/q/1544335
answer count: 1
has comment: http://stackoverflow.com/comment/39058466
favorite count: 0
has body: I am trying to implement a variant of this SO question I want to run tens of SQL statements against a database. Building the statements up in Strings is getting laborious. I got the idea to make a file of them instead (statements.sql) which is super easy to write and debug. However I have a requirement that I must have everything needed contained in a runnable JAR, so this .sql file is going to have to be an internal resource (like C# projects). I cannot simply read an external file. The SO question above sounds like the right idea for what I want, but no matter where I place the .sql file (src package, or a folder by itself), or if I "Add to Build Path" or not, I keep getting... java.lang.NullPointerException ...when I run this code... InputStream input = getClass().getResourceAsStream("/MySQL/src/com/package/statements.sql"); My Java IDE is Eclipse (Luna), running on Debian 7 GNome and the .sql file is currently in a package under source. I just need the file's contents in a big string for parsing / processing. If there is a better way to do that I'd appreciate a push in the right direction. I think my issue may have more to do with my unfamiliarity with how to do this in Eclipse as opposed to code issue(s). To get the "path" string for the code I am right-clicking the .sql file and selecting "properties". The Path to the file (relative to the project?) is displayed there and I am copy / pasting that. What is the right way to register this file with Eclipse and consume it? Thanks kindly.
has comment: http://stackoverflow.com/comment/39058970
has comment: http://stackoverflow.com/comment/39058575
has title: How does one include a file of SQL statements internally in Java JAR?
type: AnsweredQuestion
score: 3
upvote count: 3
has answer: http://stackoverflow.com/a/25100468
tagged with: java
has comment: http://stackoverflow.com/comment/39058456
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/39058569
has comment: http://stackoverflow.com/comment/39058675
downvote count: 0
linked to: http://stackoverflow.com/q/2308188
linked to: http://stackoverflow.com/q/5476530

http://stackoverflow.com/comment/39228911
score: 0
type: Comment
type: QuestionComment
has text: ^^ What he said. That first line of the file is being thrown out when you call readLine() and don't do anything with it.
comment on: http://stackoverflow.com/q/25191648

http://stackoverflow.com/q/25204160
has comment: http://stackoverflow.com/comment/39273636
has body: This is my HTML: Filter Products By Price 1000-2000 2000-3000 3000-4000 Size Small Medium Large Brand Dell HP Sony Currently I am working on this search but i want to call an ajax function on click of each checkbox and run a database query and fetch results and when checkbox is unchecked i want to delete corresponding divs from the JSP page.I have tried different logics on my servlet but failed to get relevant result.Could anybody guide me how to code servlet and make logic of this search. EDIT: Basically i want to know which query to run at Servlet which can fulfil all the checkboxes that user have selected.
has comment: http://stackoverflow.com/comment/39273626
tagged with: jsp
tagged with: javascript
has comment: http://stackoverflow.com/comment/39253229
has comment: http://stackoverflow.com/comment/39252124
tagged with: servlets
score: 0
tagged with: sql
has comment: http://stackoverflow.com/comment/39252420
has comment: http://stackoverflow.com/comment/39252779
has comment: http://stackoverflow.com/comment/39252626
has comment: http://stackoverflow.com/comment/39252876
has comment: http://stackoverflow.com/comment/39253058
type: UnansweredQuestion
has title: Unable to find logic of checkbox search?
has comment: http://stackoverflow.com/comment/39252313
answer count: 0
has comment: http://stackoverflow.com/comment/39253340
has comment: http://stackoverflow.com/comment/39252330
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39273661

http://stackoverflow.com/q/25104346
answer count: 2
tagged with: arrays
has title: free a collection from null references immediately
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1335935
has answer: http://stackoverflow.com/a/25104381
has body: Is there a very fast way to remove all the null references from a collection? I mean: HashSet&lt;String&gt; outCollection = new HashSet&lt;String&gt;(); outCollection.add("Hello,"); outCollection.add("who"); outCollection.add(null); outCollection.add("are"); outCollection.add("you?"); I created a method like this but clearly it won't work: for(String s : outCollection) { if(s == null) outCollection.remove(s); } but it pops up a "CurrentModificationException". I'm forced to use an HashSet. I would like to have something like this when printed: ["how", "Hello," "are", "you?"] //Free from null references.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25104368
tagged with: null
has comment: http://stackoverflow.com/comment/39066788
tagged with: hashset
duplicate of: http://stackoverflow.com/q/1335935
score: 0

http://stackoverflow.com/a/25143835
accepted answer of: http://stackoverflow.com/q/25143344
type: Answer
answers question: http://stackoverflow.com/q/25143344
upvote count: 9
has comment: http://stackoverflow.com/comment/39166929
downvote count: 0
score: 9
has body: The ojdbc14 is a relatively old driver and that could be the problem. I would recommend trying ojdbc6 and see if that fixes your problem. Note that this appeared to fix a similar problem based on information in the comments in this SO question ORA-28040: No matching authentication protocol exception.
type: AcceptedAnswer

http://stackoverflow.com/comment/39040632
has text: I'd just like to point out a flaw in your question format hehe. If you are only checking the first and last word, what if I ask this? "How could have possibly forgotten to lock the door this morning Josh?"
comment on: http://stackoverflow.com/q/25090301
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39238294
comment on: http://stackoverflow.com/q/25196798
type: Comment
type: QuestionComment
has text: @ScaryWombat Required `char` found `int`
score: 0

http://stackoverflow.com/comment/39014227
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25076133
score: 0
has text: You need to use a modal JDialog

http://stackoverflow.com/q/25127534
type: AnsweredQuestion
has title: Display ads on top of canvas
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25146206
tagged with: admob
type: Question
answer count: 2
tagged with: canvas
downvote count: 0
has body: Right now I'm calling my gamecanvas like so: GameCanvas gameCanvas; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); gameCanvas = new GameCanvas(getApplicationContext()); gameCanvas.setBackgroundColor(Color.DKGRAY); setContentView(gameCanvas); } In my main.xml i got `&lt;com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adUnitId="ca-app-pub-ID" ads:adSize="BANNER"/&gt;` If i set the contentView to my main.xml i can get an add showing as so AdView adView = (AdView) this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().addTestDevice("DEVICE ID").build(); adView.loadAd(adRequest); So how can i add an admob banner ad on top of the canvas? EDIT: If i add &lt;mb.jet.game.GameCanvas android:id="@+id/vMain" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; to my xml I get the error Unable to start activity ComponentInfo{mb.jet.game/mb.jet.game.MyActivity}: android.view.InflateException: Binary XML file line #12: Error inflating class mb.jet.game.GameCanvas
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/25146206
possible better answer: http://stackoverflow.com/a/25129207
upvote count: 1
has answer: http://stackoverflow.com/a/25129207

http://stackoverflow.com/comment/86971970
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/49413921
type: Comment
has text: Thanks for answering even though this was years later, and thanks Dathan for accepting, because only a few weeks later this has already helped me out. :)

http://stackoverflow.com/comment/39159205
type: AnswerComment
score: 0
has text: Looks like it's a choice between two sources of confusion.
comment on: http://stackoverflow.com/a/25153992
type: Comment

http://stackoverflow.com/a/25097356
has comment: http://stackoverflow.com/comment/39056053
has body: You can have oldString as a field of your Application class: private String oldString = ""; @Override public void start(Stage primaryStage) throws Exception { primaryStage.show(); final Clipboard clipboard = Clipboard.getSystemClipboard(); Timeline repeatTask = new Timeline(new KeyFrame(Duration.millis(200), new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { if (clipboard.hasString()) { String newString = clipboard.getString(); if(!oldString.equals(newString)) { System.out.printf("String changed in clipboard: " + newString); oldString = newString; } else { System.out.println("String not changed."); } } } })); repeatTask.setCycleCount(Timeline.INDEFINITE); repeatTask.play(); } This works because when you access oldString, you are actually accessing this.oldString, where this is final. Also note that to compare strings, you should use oldString.equals(newString) instead of comparing object identities (==/!=). Also, if you are using Java 8, you can get rid of the Timeline boilerplate using ReactFX: private String oldString = ""; @Override public void start(Stage primaryStage) throws Exception { primaryStage.show(); final Clipboard clipboard = Clipboard.getSystemClipboard(); EventStreams.ticks(Duration.ofMillis(200)).subscribe(tick -&gt; { if (clipboard.hasString()) { String newString = clipboard.getString(); if(!oldString.equals(newString)) { System.out.printf("String changed in clipboard: " + newString); oldString = newString; } else { System.out.println("String not changed."); } } }); } For more information about using the timer from ReactFX, see my blog post http://tomasmikula.github.io/blog/2014/06/04/timers-in-javafx-and-reactfx.html
has comment: http://stackoverflow.com/comment/39057194
has comment: http://stackoverflow.com/comment/39056162
answers question: http://stackoverflow.com/q/25082220
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/25082220
type: Answer

http://stackoverflow.com/comment/39122166
type: Comment
has text: Thank you very much! I tested it with file.exist and file.canRead. It was my fault, I had a typo in the filename :-/
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25134120

http://stackoverflow.com/q/25224987
upvote count: 6
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/27150948
score: 6
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: scorm2004
accepted answer: http://stackoverflow.com/a/27150948
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jaxb2
has body: Here is a test case using a file from SCORM for imsmanifest,xml. This XML has been in use for about 5 or more years, and being a standard I don't want to change it unless required to get this to work. You can find the xsd file here The error occurs between and <organization identifier="CYBER4.ORG"> In my project, this is the entry from my pom.xml for my jaxb version javax.xml.bind jaxb-api 2.2.11 to generate the Java code I ran (this is the install of xjc for Ubuntu 14.04) $ xjc -version xjc 2.2.4-2 $ xjc -verbose -p org.cyber4.scorm2004.xml.manifest.imscp imscp_v1p2.xsd The output generates (amongst other things) public class OrganizationsType { @XmlAttribute(name = "default") @XmlIDREF @XmlSchemaType(name = "IDREF") protected Object _default; } and public class OrganizationType { @XmlAttribute(name = "identifier", required = true) @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID @XmlSchemaType(name = "ID") protected String identifier; } This is the test code package org.cyber4.scorm2004.build; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; import org.cyber4.scorm2004.xml.manifest.imscp.ManifestMetadataType; import org.cyber4.scorm2004.xml.manifest.imscp.ManifestType; import org.cyber4.scorm2004.xml.manifest.imscp.ObjectFactory; import org.cyber4.scorm2004.xml.manifest.imscp.OrganizationType; import org.cyber4.scorm2004.xml.manifest.imscp.OrganizationsType; import org.cyber4.scorm2004.xml.manifest.imscp.ResourcesType; //import org.slf4j.Logger; //import org.slf4j.LoggerFactory; public class TestSCORMBuilder { public static void main(String args[]) { try { ObjectFactory objectFactory = new ObjectFactory(); /* * <metadata /> */ ManifestMetadataType metadataType = objectFactory.createManifestMetadataType(); /* * * <organization identifier="CYBER4.ORG" /> * */ // https://java.net/jira/browse/JAXB-872 OrganizationsType organizationsType = objectFactory.createOrganizationsType(); organizationsType.setDefault("CYBER4.ORG"); OrganizationType o…
has title: JAXB getting Object "" is found in an IDREF property but this object doesnt have an ID

http://stackoverflow.com/comment/39123083
type: AnswerComment
has text: I know this feature. but problem that target method can invokes in deep.... I try to draw. Please read update.
type: Comment
comment on: http://stackoverflow.com/a/25134665
score: 0

http://stackoverflow.com/comment/39193164
comment on: http://stackoverflow.com/q/25172178
has text: That is indicative of a native memory leak or at least "retention".
score: 0
type: Comment
type: QuestionComment

design-patterns
tags question: http://stackoverflow.com/q/25184089
tags question: http://stackoverflow.com/q/25227992
tags question: http://stackoverflow.com/q/25213113
tags question: http://stackoverflow.com/q/25078076
tag name: design-patterns
tags question: http://stackoverflow.com/q/25111593
tags question: http://stackoverflow.com/q/25226312
tags question: http://stackoverflow.com/q/25161366
tags question: http://stackoverflow.com/q/25135395
type: Tag
tags question: http://stackoverflow.com/q/25099124
tags question: http://stackoverflow.com/q/25129540
tags question: http://stackoverflow.com/q/25092189
tags question: http://stackoverflow.com/q/25227558
tags question: http://stackoverflow.com/q/25152635
tags question: http://stackoverflow.com/q/25207834
tags question: http://stackoverflow.com/q/25226014
tags question: http://stackoverflow.com/q/25090301
tags question: http://stackoverflow.com/q/25098726
tags question: http://stackoverflow.com/q/25222713
tags question: http://stackoverflow.com/q/25218586
tags question: http://stackoverflow.com/q/25163683
tags question: http://stackoverflow.com/q/25180634
tags question: http://stackoverflow.com/q/25097711
tags question: http://stackoverflow.com/q/25142430

http://stackoverflow.com/comment/39555121
has text: Request POST https://accounts.google.com/o/oauth2/token Content-Type: application/x-www-form-urlencoded oauth_consumer_secret=secret&oauth_consumer_key=key&oauth_token=token&oauth_token_secret=tokensecret&client_id=id&client_secret=secret&scope=http%3A%2F%2Fspreadsheets.google.com%2Ffeeds%2F+http%3A%2F%2Fdocs.google.com%2Ffeeds+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.file&grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Amigration%3Aoauth1 Response Status: 400 Bad Request { error: "invalid_request" }
score: 0
comment on: http://stackoverflow.com/q/25128634
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39216321
score: 0
type: QuestionComment
type: Comment
has text: @filip because I initiate it in another class since its a public variable, `ref.get(val1).firstEdge = _edge;` so the class that initiates this takes in commands from the user and stores them and on their request the info should be printed
comment on: http://stackoverflow.com/q/25184769

http://stackoverflow.com/comment/39146114
type: Comment
has text: Technically when you run the program on the command prompt in windows, you are using Java. Are you trying to run this inside of an IDE or something else?
type: QuestionComment
comment on: http://stackoverflow.com/q/25146938
score: 0

http://stackoverflow.com/comment/39083179
comment on: http://stackoverflow.com/q/25113363
has text: Your MailScheduleTimer is configured as a bean?
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/25099849
has comment: http://stackoverflow.com/comment/39073154
score: -2
has comment: http://stackoverflow.com/comment/39073404
tagged with: tomcat
has answer: http://stackoverflow.com/a/25102662
upvote count: 2
has comment: http://stackoverflow.com/comment/39064283
has comment: http://stackoverflow.com/comment/39073538
favorite count: 0
possible better answer: http://stackoverflow.com/a/25099935
linked to: http://stackoverflow.com/q/17983453
has body: I have had Eclipse Kepler version which did not support Tomcat 8. I have tried doing what this post said - How to use Tomcat 8 in Eclipse?. But I could not get the Tomcat v8. Finally I also followed this post - Running tomcat with eclipse kepler but after doing what this guy said, my eclipse no longer opens! I would like to install a completely new Eclipse version that supports Web Development tools and has support for Tomcat 8 by default. Which one should I go for? I know there is a Eclipse IDE for Java Developers and Eclipse IDE for Java EE Developers. I should choose the latter i guess, but which version should I install? Luna, Kepler, Indigo, etc.?? Please correct me if I'm wrong but these are the names given to different version that came at different times right?
has answer: http://stackoverflow.com/a/25099935
linked to: http://stackoverflow.com/q/17868232
downvote count: 4
type: AnsweredQuestion
has title: Which Eclipse to download for Java EE (having support for Tomcat 8)
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39068422
type: Question
accepted answer: http://stackoverflow.com/a/25102662
tagged with: jakarta-ee
answer count: 2

http://stackoverflow.com/comment/39120811
comment on: http://stackoverflow.com/q/25133196
has text: Can you tell what is blocking? If you put a breakpoint at the beginning of `service`, what's the observed behavior? Similarly, what happens if you stop at the first line of `run`?
type: Comment
type: QuestionComment
score: 0

noclassdeffounderror
tags question: http://stackoverflow.com/q/25126238
tags question: http://stackoverflow.com/q/25220144
tags question: http://stackoverflow.com/q/25092221
tags question: http://stackoverflow.com/q/25179225
tag name: noclassdeffounderror
type: Tag

http://stackoverflow.com/comment/39129823
has text: @Nujke, You can do everything programmatically without using XML. If you don't want it that way, define a framelayout, place the canvas first then the adview last. Thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25129207
type: Comment

http://stackoverflow.com/q/25132509
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/26664785
tagged with: java
has comment: http://stackoverflow.com/comment/43769678
has comment: http://stackoverflow.com/comment/39119415
has answer: http://stackoverflow.com/a/66902802
has comment: http://stackoverflow.com/comment/47222831
linked to: http://stackoverflow.com/q/9582648
has answer: http://stackoverflow.com/a/42013329
has comment: http://stackoverflow.com/comment/90180617
has comment: http://stackoverflow.com/comment/39119001
has answer: http://stackoverflow.com/a/36205108
has comment: http://stackoverflow.com/comment/39118910
has comment: http://stackoverflow.com/comment/39118896
has comment: http://stackoverflow.com/comment/43769909
has body: I am using crashlytics to track my app's crash. There is one bug which is quite hard to figure out. The stack trace from crashlytics is as below: java.lang.RuntimeException: Could not read input channel file descriptors from parcel. at android.view.InputChannel.nativeReadFromParcel(InputChannel.java) at android.view.InputChannel.readFromParcel(InputChannel.java:148) at android.view.InputChannel$1.createFromParcel(InputChannel.java:39) at android.view.InputChannel$1.createFromParcel(InputChannel.java:36) at com.android.internal.view.InputBindResult.&lt;init&gt;(InputBindResult.java:62) at com.android.internal.view.InputBindResult$1.createFromParcel(InputBindResult.java:102) at com.android.internal.view.InputBindResult$1.createFromParcel(InputBindResult.java:99) at com.android.internal.view.IInputMethodManager$Stub$Proxy.windowGainedFocus(IInputMethodManager.java:851) at android.view.inputmethod.InputMethodManager.startInputInner(InputMethodManager.java:1292) at android.view.inputmethod.InputMethodManager.onWindowFocus(InputMethodManager.java:1518) at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3550) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:157) at android.app.ActivityThread.main(ActivityThread.java:5293) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) at dalvik.system.NativeStart.main(NativeStart.java) I know there is one similar question about this here. But there is a bit different. And as statistics from crashlytics, the crash happens mainly in SAMSUNG android phone. I am new to android and don't know why the crash happened and how to fix this kind of crash. Any suggestion would be much appreciated.
upvote count: 63
downvote count: 0
possible better answer: http://stackoverflow.com/a/36205108
has answer: http://stackoverflow.com/a/27812617
favorite count: 0
has comment: http://stackoverflow.com/comment/39118892
has comment: http://stackoverflow.com/comment/39118844
score: 63
answer count: 5
tagged with: android
has title: java.lang.RuntimeException: Could not read input channel file descriptors from parcel
has comment: http://stackoverflow.com/comment/39119035
has answer: http://stackoverflow.com/a/46781335
accepted answer: http://stackoverflow.com/a/27812617
has comment: http://stackoverflow.com/comment/39119295

http://stackoverflow.com/q/25153080
type: UnansweredQuestion
upvote count: 2
tagged with: java
type: Question
tagged with: hibernate
has body: As per the Hibernate Documentation, hibernate has a property called hibernate.bytecode.use_reflection_optimizer and the doc says: Enables the use of bytecode manipulation instead of runtime reflection. This is a System-level property and cannot be set in hibernate.cfg.xml. Reflection can sometimes be useful when troubleshooting. Hibernate always requires javassist even if you turn off the optimizer. e.g. true | false What is byte code manipulation and runtime reflection and how hibernate uses it. Can someone please help m in understanding this. Also how reflection is useful for troubleshooting?
has title: Understanding hibernate.bytecode.use_reflection_optimizer property in Hibernate
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25153605

http://stackoverflow.com/q/25094410
has comment: http://stackoverflow.com/comment/39049817
linked to: http://stackoverflow.com/q/1870927
upvote count: 2
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/25098693
has title: Hibernate Error while persisting TEXT datatype
has comment: http://stackoverflow.com/comment/39048619
has comment: http://stackoverflow.com/comment/39049925
linked to: http://stackoverflow.com/q/3868096
has comment: http://stackoverflow.com/comment/39048566
has comment: http://stackoverflow.com/comment/39049898
linked to: http://stackoverflow.com/q/2112667
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39049656
has comment: http://stackoverflow.com/comment/39049753
has comment: http://stackoverflow.com/comment/39052493
favorite count: 0
has body: Using hibernate and mysql 5.5, I am trying to persist String value in TEXT type column of database table. Tired to set String value in the mentioned column and tried to persist the data.But i am getting following exception. I have generated Entity class using Netbeans 8.0. Exception:- FATAL: JSF1073: javax.faces.FacesException caught during processing of INVOKE_APPLICATION 5 : UIComponent-ClientId=, Message=/addNewCategory.xhtml @30,151 actionListener="#{categoryBean.addCategoryAction}": java.lang.AbstractMethodError: com.mysql.jdbc.ServerPreparedStatement.setCharacterStream(ILjava/io/Reader;J)V FATAL: /addNewCategory.xhtml @30,151 actionListener="#{categoryBean.addCategoryAction}": java.lang.AbstractMethodError: com.mysql.jdbc.ServerPreparedStatement.setCharacterStream(ILjava/io/Reader;J)V javax.faces.FacesException: /addNewCategory.xhtml @30,151 actionListener="#{categoryBean.addCategoryAction}": java.lang.AbstractMethodError: com.mysql.jdbc.ServerPreparedStatement.setCharacterStream(ILjava/io/Reader;J)V at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:89) CREATE SQL:- CREATE TABLE `oc_category_description` ( `category_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `description` text NOT NULL, `meta_description` varchar(255) NOT NULL, `meta_keyword` varchar(255) NOT NULL, PRIMARY KEY (`category_id`,`language_id`), KEY `name` (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; EntityClass @Entity @Table(name = "oc_category_description") @XmlRootElement public class OcCategoryDescription implements Serializable { private static final long serialVersionUID = 1L; @Basic(optional = false) @NotNull @Lob @Size(min = 1, max = 65535) @Column(name = "description") private String description; public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } //Constructors, setters…
accepted answer: http://stackoverflow.com/a/25098693
tagged with: exception
tagged with: text
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/39135440
comment on: http://stackoverflow.com/q/25141537
type: Comment
type: QuestionComment
has text: It looks easy but it took me some time to figure it out. I figured it out after I wrote the question but before I posted it so I decided to answer it myself instead of canceling the post. Maybe someone will struggle with the same problem in the future and will find this helpful. :)
score: 0

http://stackoverflow.com/a/25201930
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/25195397
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25195397
has body: You have to close the BufferedWriter in order to see the changes.
has comment: http://stackoverflow.com/comment/39255718
upvote count: 2

http://stackoverflow.com/q/25164427
has comment: http://stackoverflow.com/comment/39314125
tagged with: android
tagged with: toast
has comment: http://stackoverflow.com/comment/39331640
has comment: http://stackoverflow.com/comment/39352959
type: UnansweredQuestion
has title: Rotate a Toast during the camera is shown (started at my app)
has comment: http://stackoverflow.com/comment/39183872
tagged with: android-toast
linked to: http://stackoverflow.com/q/6234473
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39220098
score: 0
has body: in our app we have a Button which starts the Camera. At the same time we want to show a Toast which rotates when the user rotate the screen/change orientation, during the camera is shown. The problem here is, that we start the Toast with the Context of our fragment/activity. As long as the Camera is shown the Toast doesn't recognize that his "originally" context (Activity/Fragment) change its orientation, because it's dead! I doubt if Toast is the best solution to do this... Maybe there is something more appropriate then a Toast for this situation? Thanks in advance!

http://stackoverflow.com/a/25139074
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25139047
answers question: http://stackoverflow.com/q/25139047
has comment: http://stackoverflow.com/comment/39130993
has body: Change your package name from example.appname to com.example.appname in the androidTest source root.
has comment: http://stackoverflow.com/comment/39130818
score: 0
has comment: http://stackoverflow.com/comment/39130843

http://stackoverflow.com/q/25214477
has comment: http://stackoverflow.com/comment/39273009
accepted answer: http://stackoverflow.com/a/25214844
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39271927
has comment: http://stackoverflow.com/comment/39280082
has comment: http://stackoverflow.com/comment/39282837
has title: ClassNotFoundException with Oracle Type4 Drivers
tagged with: classpath
answer count: 1
has comment: http://stackoverflow.com/comment/39283033
has comment: http://stackoverflow.com/comment/39273658
has comment: http://stackoverflow.com/comment/39282129
tagged with: classnotfoundexception
has answer: http://stackoverflow.com/a/25214844
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39282924
type: Question
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/39293257
tagged with: jdbc
has body: I am not using any IDE, writing my program on notepad and running through command prompt. I have Oracle 10g enterprise edition installed and path to ojdbc14.jar in this version is like this: C:\oracle\product\10.2.0\db_2\jdbc\lib I have added the Classpath as follows: . ; C:\oracle\product\10.2.0\db_2\jdbc\lib\ojdbc14.jar; and yet, it gives java.lang.ClassNotFoundException at oracle.jdbc.driver.OracleDriver Any idea?

http://stackoverflow.com/q/25192342
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Jackson JSON - "no single-String constructor/factory method" error on unmarshal
has answer: http://stackoverflow.com/a/44637583
linked to: http://stackoverflow.com/q/39248045
type: Question
has comment: http://stackoverflow.com/comment/39238894
has comment: http://stackoverflow.com/comment/39239322
has answer: http://stackoverflow.com/a/28179745
downvote count: 0
tagged with: jackson
has answer: http://stackoverflow.com/a/59981704
has comment: http://stackoverflow.com/comment/39272559
has comment: http://stackoverflow.com/comment/39272567
answer count: 4
favorite count: 0
has body: The simplest of cases is causing me problems. I've run into it the first time. I am able to unmarshal slightly more complex json but this simple one fails. What would cause this and why is jackson having trouble with just a single string? A simple class holding the name of the user's role. public class UpdateUserRole { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } Inside the controller public void updateUserRole(@PathVariable Long id, @RequestBody UpdateUserRoleReq req) { } As soon as Jackson sees this, it throws this error org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not instantiate value of type [simple type, class com.mycompany.UpdateUserRoleReq] from String value ('{"name":"admin_1407445357682"}'); no single-String constructor/factory method; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type [simple type, class com.mycompany.UpdateUserRoleReq] from String value ('{"name":"admin_1407445357682"}'); no single-String constructor/factory method at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.readJavaType(MappingJackson2HttpMessageConverter.java:228) at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.read(MappingJackson2HttpMessageConverter.java:220) at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:138) at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:183) at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:98) at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgume…
has comment: http://stackoverflow.com/comment/39274191
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/47090048
score: 13
upvote count: 13
tagged with: spring-mvc

http://stackoverflow.com/comment/39185510
type: QuestionComment
has text: See also: [another SO question](http://stackoverflow.com/questions/7640533/is-the-pre-incriment-operator-thread-safe-java), [++ not considered atomic](http://madbean.com/2003/mb2003-44/), [Concurrency in Java](http://www.informit.com/articles/article.aspx?p=31682&seqNum=3).
score: 7
comment on: http://stackoverflow.com/q/25168062
type: Comment

http://stackoverflow.com/q/25161074
answer count: 1
has body: We have a big java applications with thousands of beans, profiling the slow spring context initialization we found that the auto-wiring by type is what's taking most of the context loading time. Autowiring the bean by name seems to improve the context initialization by an order of magnitude. However I couldn't find a way to auto-wire beans by name as constructor arguments. The following is a member autowire that works fine, spring does the lookup by name: class MyClass { @Resource private MyBean mybean; } But since @Resource only applies to members and methods it doesn't apply to constructor. We tried both the @Inject with @Named and @Autowired with @Qualifier but Spring does the slow by type lookup for these approaches: class MyClass { @Inject public MyClass(@Named("myBean") MyBean myBean) { } } class MyClass { @Autowired public MyClass(@Qualifer("myBean") MyBean myBean) { } } How to tell spring not to lookup by type when using constructor injection? We understand the advantaged of wire by type (decouple from bean names) yet at this point context loading performance is our biggest concern.
has title: Spring autowire by name constructor arguments
favorite count: 0
tagged with: constructor
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39174819
tagged with: spring
tagged with: autowired
has answer: http://stackoverflow.com/a/25161637
downvote count: 0
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/39176804
type: Question
has comment: http://stackoverflow.com/comment/126059833
upvote count: 7

http://stackoverflow.com/q/25228850
upvote count: 1
type: Question
tagged with: libgdx
answer count: 1
downvote count: 0
has body: I have little question how I can do smooth movement in Java LibGDX ?. Something like this: if(walk_right) { if(map[cords.x][cords.y] == 1){ for(float i = 0f; i &lt; 2f; i += 0.001f){ //1 tile 2f; cords.x += 0.001f; } } } But that doesn't work's player teleporting 1 tile.
has title: Java libGDX one tile smooth movement
favorite count: 0
has answer: http://stackoverflow.com/a/25283524
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: lwjgl

http://stackoverflow.com/q/25155905
type: Question
score: 9
tagged with: aspectj
accepted answer: http://stackoverflow.com/a/25248520
has title: Running JDK8 for aspectj
has body: I am trying to run aspectj-maven plugin with JDK8. But it is giving errors like "The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files" Any help on how to resolve, or if the aspectj-maven-plugin supports JDK8. I am using 1.6 version of aspectj--maven-plugin.
answer count: 3
has answer: http://stackoverflow.com/a/25248520
possible better answer: http://stackoverflow.com/a/25608665
tagged with: maven-plugin
favorite count: 0
upvote count: 9
downvote count: 0
tagged with: maven
has answer: http://stackoverflow.com/a/45614023
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25608665

http://stackoverflow.com/comment/39175336
type: AnswerComment
comment on: http://stackoverflow.com/a/25156540
score: 0
type: Comment
has text: I used Termite Bluetooth to check what I get from my `msg.getBytes()` when I send through a bluetooth port using the `outputStream.write(msg.getBytes("UTF-8));` I got `e9 9a a5` and the character is this `éš¥` The output is in Hex.

http://stackoverflow.com/q/25115067
has answer: http://stackoverflow.com/a/25115273
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39086259
tagged with: jakarta-ee
has body: i am new to java, i have tried to read a file and saved into Hashmap. But it showing ArrayIndexBounds Of Exception.i dont know how to solve it. here is my code, import java.io.BufferedReader; import java.io.FileReader; import java.util.HashMap; import java.util.Map; public class excer4 { public static void main(String[] args) throws Exception { Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); BufferedReader in = new BufferedReader(new FileReader("/home/mansoor/Documents/exm.txt")); String line = ""; while ((line = in.readLine()) != null) { String parts[] = line.split("\t"); map.put(parts[0], parts[1]); } in.close(); System.out.println(map.toString()); } } my input is: “u1” “u10” “u2” “u41” “u3” “u10” “u4” “u81” “u5” “u10” “u6” “u10” “u7” “u31” “u8” “u11” Output i got : Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 at excer4.main(excer4.java:15) can any one help me to find a solution..
has answer: http://stackoverflow.com/a/25115110
tagged with: java
has answer: http://stackoverflow.com/a/25115101
has answer: http://stackoverflow.com/a/25115132
type: Question
has title: while reading a file and stored into Hashmap, it is showing Array index bound of exception
score: 0
answer count: 4

http://stackoverflow.com/comment/39163128
type: Comment
has text: I've updated my answer with a fix and explanation along with images to show the results of both pieces of code.
comment on: http://stackoverflow.com/a/25150414
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39197720
score: 0
type: Comment
type: QuestionComment
has text: PDF defines some character sets and fonts available on every PDF Reader. If these suffice, a simple PDF creator is feasible. I have no idea, though, what you mean by *plain/default text*.
comment on: http://stackoverflow.com/q/25166533

http://stackoverflow.com/comment/40122128
type: AnswerComment
has text: glassfish-samples is not the same as firstcup. The project for firstcup is here: https://java.net/projects/firstcup/
type: Comment
comment on: http://stackoverflow.com/a/25649721
score: 1

nullpointerexception
tags question: http://stackoverflow.com/q/25126033
tags question: http://stackoverflow.com/q/25215667
tags question: http://stackoverflow.com/q/25228008
tags question: http://stackoverflow.com/q/25214501
tags question: http://stackoverflow.com/q/25195991
tags question: http://stackoverflow.com/q/25187097
tags question: http://stackoverflow.com/q/25214292
tags question: http://stackoverflow.com/q/25108923
tags question: http://stackoverflow.com/q/25214701
tags question: http://stackoverflow.com/q/25070687
tags question: http://stackoverflow.com/q/25131904
tags question: http://stackoverflow.com/q/25159785
type: Tag
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/25085347
tags question: http://stackoverflow.com/q/25223451
tags question: http://stackoverflow.com/q/25221706
tags question: http://stackoverflow.com/q/25094051
tags question: http://stackoverflow.com/q/25199586
tags question: http://stackoverflow.com/q/25143120
tags question: http://stackoverflow.com/q/25184769
tags question: http://stackoverflow.com/q/25105268
tags question: http://stackoverflow.com/q/25224018
tags question: http://stackoverflow.com/q/25077997
tags question: http://stackoverflow.com/q/25129873
tags question: http://stackoverflow.com/q/25105650
tags question: http://stackoverflow.com/q/25130859
tags question: http://stackoverflow.com/q/25144489
tags question: http://stackoverflow.com/q/25150818
tags question: http://stackoverflow.com/q/25186959
tags question: http://stackoverflow.com/q/25226506

http://stackoverflow.com/comment/39186281
type: AnswerComment
has text: Where is this lib directory? do you mean: `workspace/MyProject/WebContent/WEB-INF/lib/`?
type: Comment
comment on: http://stackoverflow.com/a/25168331
score: 0

http://stackoverflow.com/a/25132064
has comment: http://stackoverflow.com/comment/39129424
type: Answer
answers question: http://stackoverflow.com/q/25131922
has body: The solution you are looking for is as below: String[] bytesStr = binary.toString().split(" "); for(String c : bytesStr){ System.out.print((char)Byte.parseByte(c,2)); } The "binary" value you have is in reality the binary in string format. So convert it to a byte by using parseByte with a radix (base) of 2. The above program prints Milind
has comment: http://stackoverflow.com/comment/39133599
score: 0

http://stackoverflow.com/comment/39290874
type: Comment
comment on: http://stackoverflow.com/a/25222812
has text: Ok, I guess whatever I read that indicated that the placement of the annotations determined type was just wrong, possibly getting confused over the placement of the @Id annotation and the fact that it determines the default access type. I'll check this out, thanks.
score: 0
type: AnswerComment

http://stackoverflow.com/a/25227476
answers question: http://stackoverflow.com/q/25225684
score: 0
has body: You must compact() or clear() a buffer that has been flipped before you can read into it again.
type: Answer

http://stackoverflow.com/a/25227645
has comment: http://stackoverflow.com/comment/39296285
has body: Step 1: Check file CATALINA_HOME\conf\tomcat-users.xml like that: ( for example, administration user is "admin", and password also "admin") &lt;tomcat-users&gt; &lt;role rolename="manager"/&gt; &lt;role rolename="admin"/&gt; &lt;role rolename="manager-gui"/&gt; &lt;user username="admin" password="admin" roles="admin, manager,manager-gui"/&gt; &lt;/tomcat-users&gt; Step 2: Start Tomcat, run: CATALINA_HOME\bin\startup.bat (on Windows) Step 3: Go to: http://localhost:8080 Step 4: Press Manager App button Step 5: In page http://localhost:8080/manager/html , in Deploy section --> WAR file to deploy, Press Choose File button, choose your war file, and press Deploy button. Your application files will go to CATALINA_HOME\webapps\WebAppName . (CATALINA_HOME is your Tomcat installion directory) Step 6: Go to http://localhost:8080/WebAppName (in your case, launch your application by go to: http://localhost:8080/HelloJsp ) If you deploy your web application in real server, replace localhost by your domain.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25226308

mouseevent
tags question: http://stackoverflow.com/q/25169932
tags question: http://stackoverflow.com/q/25153679
type: Tag
tags question: http://stackoverflow.com/q/25185222
tag name: mouseevent

http://stackoverflow.com/q/25218693
upvote count: 1
type: Question
tagged with: jakarta-ee
has title: Hibernate, isAssociationType? How do I find out if an entity field is an association?
answer count: 1
downvote count: 0
favorite count: 0
has body: I am looking to create a criteria query, on association only if it is an assoication. There are so many types such as Date, Map, Set, int, Integer, Long and so on that make it hard to properly check if a declared field is an association. Is there a simple way to find this out using Hibernate already?
type: UnansweredQuestion
tagged with: spring
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25223694

http://stackoverflow.com/comment/39126007
has text: Please, provide a code snippet to help us help you.
comment on: http://stackoverflow.com/q/25136433
score: 0
type: Comment
type: QuestionComment

hql
tag name: hql
tags question: http://stackoverflow.com/q/25114294
tags question: http://stackoverflow.com/q/25185668
tags question: http://stackoverflow.com/q/25121520
type: Tag
tags question: http://stackoverflow.com/q/25086027
tags question: http://stackoverflow.com/q/25111422
tags question: http://stackoverflow.com/q/25199846

http://stackoverflow.com/q/25107291
upvote count: 10
downvote count: 1
type: Question
score: 9
tagged with: scenebuilder
has answer: http://stackoverflow.com/a/25107876
answer count: 2
has answer: http://stackoverflow.com/a/25107395
has body: I have java jdk 7.65, sdk 7.65. Where is filechooser in javafx scene builder 2.0? I can't find it.
favorite count: 0
possible better answer: http://stackoverflow.com/a/25107395
accepted answer: http://stackoverflow.com/a/25107876
has title: Where is filechooser in javafx scene builder 2.0? I can't find it
type: AnsweredQuestion
tagged with: java
tagged with: javafx

adapter
tags question: http://stackoverflow.com/q/25094722
tag name: adapter
tags question: http://stackoverflow.com/q/25101379
tags question: http://stackoverflow.com/q/25188100
type: Tag

http://stackoverflow.com/comment/39073752
comment on: http://stackoverflow.com/q/25108266
has text: Note that even if you make this work, you never ever should. Busy-waiting is terribly inefficient.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39146554
score: 15
has text: @arshajii true, but for some reason I prefer the lambda expression. Perhaps I don't like the look of `::` :)
type: AnswerComment
comment on: http://stackoverflow.com/a/25147125
type: Comment

http://stackoverflow.com/a/26843184
has body: Using batch fetching, Hibernate can load several uninitialized proxies if one proxy is accessed. Batch fetching is an optimization of the lazy select fetching strategy. There are two ways you can configure batch fetching: on the class level and the collection level. Batch fetching for classes/entities is easier to understand. Consider the following example: at runtime you have 25 Cat instances loaded in a Session, and each Cat has a reference to its owner, a Person. The Person class is mapped with a proxy, lazy="true". If you now iterate through all cats and call getOwner() on each, Hibernate will, by default, execute 25 SELECT statements to retrieve the proxied owners. You can tune this behavior by specifying a batch-size in the mapping of Person: &lt;class name="Person" batch-size="10"&gt;...&lt;/class&gt; Hibernate will now execute only three queries: the pattern is 10, 10, 5.
has comment: http://stackoverflow.com/comment/137200480
answers question: http://stackoverflow.com/q/25210949
has comment: http://stackoverflow.com/comment/129138853
accepted answer of: http://stackoverflow.com/q/25210949
type: Answer
score: 28
has comment: http://stackoverflow.com/comment/123028486
has comment: http://stackoverflow.com/comment/124016490
upvote count: 28
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/25100476
score: 38
upvote count: 38
has comment: http://stackoverflow.com/comment/39241192
type: Answer
accepted answer of: http://stackoverflow.com/q/25100179
has body: you need to change Activity to ActionBarActivity public class mainActivity extends ActionBarActivity ActionBarActivity has been deprecated so please use the following public class mainActivity extends AppCompatActivity
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25100179

http://stackoverflow.com/comment/39224115
has text: I did setup my security group and forwarded my port before but I will try it again just in case.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25189124

http://stackoverflow.com/comment/39208868
type: AnswerComment
has text: I did as they adviced and its having the same problem with this line: newRaster.setPixels(0, 0, width, height, matrix); ''Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException'' I just don't understand where is the problem
score: 0
comment on: http://stackoverflow.com/a/25179123
type: Comment

http://stackoverflow.com/comment/39023741
type: Comment
type: QuestionComment
has text: Here a link that will help you get your Bean even in a listener. http://balusc.blogspot.com/2011/09/communication-in-jsf-20.html#GettingAnEJBInFacesConverterAndFacesValidator
comment on: http://stackoverflow.com/q/25081281
score: 0

http://stackoverflow.com/comment/39128407
score: 0
has text: I've error in that line : private Map<Integer, Object> parameters = new HashMap<>();
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25136616

http://stackoverflow.com/comment/39185180
type: Comment
comment on: http://stackoverflow.com/a/25168105
has text: (Even if `i++` *was* atomic, it would not be well-defined/thread-safe behavior.)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39018745
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25076864
has text: Whats mvm commands. It should be mvn.
score: 0

http://stackoverflow.com/a/25159369
score: 4
has comment: http://stackoverflow.com/comment/39168674
type: Answer
accepted answer of: http://stackoverflow.com/q/25159297
has body: You cannot cast directly from Double to Integer. You need to do the following: Double d = new Double(1.23); int i = d.intValue(); as suggested in How to convert Double to int directly?
has comment: http://stackoverflow.com/comment/39168179
answers question: http://stackoverflow.com/q/25159297
has comment: http://stackoverflow.com/comment/39168245
downvote count: 1
has comment: http://stackoverflow.com/comment/39168290
has comment: http://stackoverflow.com/comment/39168118
upvote count: 5
has comment: http://stackoverflow.com/comment/39168072
type: AcceptedAnswer

http://stackoverflow.com/comment/39248812
type: QuestionComment
comment on: http://stackoverflow.com/q/25202645
score: 0
has text: Did you set the right path to your jre7 in Window > Preferences > Installed JREs (type jre in the search field) ? Also, you may have to right click on your project, go to Properties, type compiler and set the compliance to 1.7. Finally, remove JRE 6 from the referenced librairies of your project.
type: Comment

http://stackoverflow.com/q/25114640
has title: Error: Type this$1 cannot be resolved or is not a field
type: Question
has body: Type this$1 cannot be resolved or is not a field I can't resolve ClamperListing.access$0(this.this$1).updateList(); in ClamperListing$1$1.java. ClamperListing.Java is my main activity class public class ClamperListing extends ListActivity { }
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39086081
linked to: http://stackoverflow.com/q/6167326
has answer: http://stackoverflow.com/a/25115008
has comment: http://stackoverflow.com/comment/39085671
has comment: http://stackoverflow.com/comment/39085804
has comment: http://stackoverflow.com/comment/39086245
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39086040
has comment: http://stackoverflow.com/comment/39086281
has comment: http://stackoverflow.com/comment/39095727
tagged with: java

http://stackoverflow.com/comment/39255682
comment on: http://stackoverflow.com/a/25206032
score: 0
type: AnswerComment
type: Comment
has text: @starf agreed. that link provided a more detailed answer.

soap
tags question: http://stackoverflow.com/q/25166259
tags question: http://stackoverflow.com/q/25162055
type: Tag
tags question: http://stackoverflow.com/q/25106332
tags question: http://stackoverflow.com/q/25163637
tags question: http://stackoverflow.com/q/25190801
tags question: http://stackoverflow.com/q/25213111
tags question: http://stackoverflow.com/q/25154298
tags question: http://stackoverflow.com/q/25170185
tags question: http://stackoverflow.com/q/25094517
tags question: http://stackoverflow.com/q/25180615
tags question: http://stackoverflow.com/q/25180650
tags question: http://stackoverflow.com/q/25137137
tags question: http://stackoverflow.com/q/25081172
tags question: http://stackoverflow.com/q/25211552
tags question: http://stackoverflow.com/q/25201865
tags question: http://stackoverflow.com/q/25149528
tags question: http://stackoverflow.com/q/25190357
tags question: http://stackoverflow.com/q/25189131
tag name: soap

http://stackoverflow.com/q/25152523
upvote count: 1
tagged with: swing
tagged with: checkbox
has comment: http://stackoverflow.com/comment/39156168
answer count: 1
tagged with: java
has title: java checkbox is checked? then loop
downvote count: 0
has body: i have checkbox and i want If checkbox is checked : make loop every 10 Minutes And on uncheck : go out from loop Below is event of checkbox :- final JCheckBox rfh = new JCheckBox("Auto Refresh"); toolbar.add(rfh); toolbar.setAlignmentX(0); rfh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { while ( rfh.isSelected() ) { if (rfh.isSelected()) { // ((JCheckBox)evt.getSource()).isSelected() JOptionPane.showMessageDialog(toolbar,"thank you for using java"); Thread.sleep(5 * 1000); } else { JOptionPane.showMessageDialog(toolbar,"not selected"); } } } catch (Exception e) { } } });
type: UnansweredQuestion
type: Question
score: 1
has comment: http://stackoverflow.com/comment/39156144
favorite count: 0
has answer: http://stackoverflow.com/a/25152646

http://stackoverflow.com/q/25126043
has body: I have an REST service already working which returns the sample JSON below: { "_embedded" : { "artist" : [ { "name" : "+44", "genre" : "Rock", "country" : "USA", "id" : 469, "_links" : { "self" : { "href" : &lt;ADDRESS&gt; }, "albumList" : { "href" : &lt;ADDRESS&gt; } } } ] } } I'm trying to consume this resource using RestTemplate like the example below public static void main(String args[]) { RestTemplate restTemplate = new RestTemplate(); Artist[] artistList = restTemplate.getForObject("http://localhost:8080/artists/search/findByName?name=+44", Artist[].class); for (Artist a : artistList) System.out.println(a.toString()); } } When the debbuger hits the getForObject line, it get this error: Exception in thread "main" org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not deserialize instance of br.com.lagranzotto.itunes.frontend.entity.Artist[] out of START_OBJECT token I've searched the internet extensively for about a week with no success in finding the cause of this exception.
answer count: 1
tagged with: rest
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/25126168
linked to: http://stackoverflow.com/q/23239052
tagged with: java
has title: Issues when trying to consume Spring REST
type: Question
tagged with: jackson
score: 0

http://stackoverflow.com/a/25204271
has comment: http://stackoverflow.com/comment/39254367
has comment: http://stackoverflow.com/comment/39252356
has comment: http://stackoverflow.com/comment/39258191
accepted answer of: http://stackoverflow.com/q/25204068
has comment: http://stackoverflow.com/comment/39255310
score: 4
has comment: http://stackoverflow.com/comment/39254275
answers question: http://stackoverflow.com/q/25204068
has body: I would not suppress the "unchecked" warnings: there's no reason not to properly type your TableView and TableColumns. The setCellValueFactory(...) method in TableColumn does not need to take a PropertyValueFactory: it can take any Callback&lt;CellDataFeatures&lt;S&gt;, ObservableValue&lt;T&gt;&gt;. Here S is the type of data displayed by each row of the table (i.e. you are using a TableView&lt;S&gt;), and T is the type of data displayed in this column (i.e. you are using a TableColumn&lt;S,T&gt;). In your case S is Trainee and T is Number. This Callback is essentially just a function that converts a given row value (Trainee in your case) to the value to be displayed in the cell. It's made slightly more complex in that the row value is wrapped in a CellDataFeatures object, and the return type is required to be an ObservableValue wrapping the actual value to be displayed. A CellDataFeatures is provided in case you want access to other information to calculate your value (it gives you access to the TableColumn in which the value is being displayed and the TableView in which the TableColumn is held). An ObservableValue is required to be returned as the TableCell will observe the value for changes and update automatically. If you only want the row value, and don't care about knowing which TableView or TableColumn you are in (or already know, which is usual), you get the row value (the Trainee in your example) by calling getValue() on the CellDataFeatures object. If you do not have an ObservableValue (e.g. a Property) for your value, you can wrap a regular value in one of the ReadOnlyXXXWrapper classes. So basically all you need is a Callback implementation whose call(...) method computes the value to display from the value for the row. In your example, the call() method just has to refer into the map: traineeCol.setCellValueFactory(new Callback&lt;CellDataFeatures&lt;Trainee&gt;, ObservableValue&lt;Number&gt;&gt;() { @Override public ObservableValue&lt;Number&gt; call(C…
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39252417
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/39258348
downvote count: 0

http://stackoverflow.com/comment/133044397
score: 0
comment on: http://stackoverflow.com/a/27150948
type: AnswerComment
has text: You literally saved the day ! Thank you !
type: Comment

http://stackoverflow.com/q/25212885
downvote count: 0
has body: I have a problem in writing into an existing excel file using JExcel "jxl" library. I have a jTable that contains data of a sheet, when the user presses the delete button, the selected row should be deleted from the sheet &amp; also from the table model .. in the following code, it is deleted from the jTable model but not from the sheet ! actually the entire workbook is turned into 0 KB after the delete button is pressed! could you tell me what is problem? "note: i tried changing the name of the copied workbook into another name and removed this line (sheet.removeRow(deletedrow+1); ) and it copies the original workbook just fine.. the problem I think occurs in the remove line" private void removebuttonActionPerformed(java.awt.event.ActionEvent evt) { int deletedrow; deletedrow = logtable.getSelectedRow(); int dialogButton = JOptionPane.YES_NO_OPTION; int dialogResult = JOptionPane.showConfirmDialog(this, "Are you sure you want to delete this record from "+ sheetname + " sheet?", "Confirmation Message", dialogButton); if (dialogResult == 0) { try { Workbook workbook = Workbook.getWorkbook(new File("path/" + wbname + ".xls")); WritableWorkbook copy = Workbook.createWorkbook(new File("path/" +wbname +".xls"), workbook); WritableSheet sheet = copy.getSheet(sheetname); sheet.removeRow(deletedrow + 1); copy.write(); copy.close(); JOptionPane.showMessageDialog(this, "The record has been deleted from (" + sheetname + ") successfully", "Information Message", JOptionPane.INFORMATION_MESSAGE); model.removeRow(deletedrow); logtable.setModel(model); }//try catch (IOException | BiffException | WriteException | HeadlessException e) { e.printStackTrace(); } }//if confirmation message = yes }
tagged with: excel
type: Question
has title: Updating excel sheet using JXL (JExcel) lead to 0 KB file
tagged with: row
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26734248
accepted answer: http://stackoverflow.com/a/26734248
upvote count: 1
answer count: 1
tagged with: jxl
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/q/25134614
score: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25134663
tagged with: java
has body: Hey guys I'm a total beginner in java programming. Recently I've been referring a book named "Head First Java" to improve my programming skills.when i compile this code there was no error, But there was no output even. What does that mean? Did i do do any mistake in the program? please Help me out.Thanks in advance. import java.awt.*; import java.awt.event.*; class Party{ public static void main(String[] args){ Frame f=new Frame(); Label l= new Label("party at nick's"); Button b=new Button("yes!"); Button c= new Button("no"); Panel p=new Panel(); p.add(l); } }
type: Question
has comment: http://stackoverflow.com/comment/39123755
has answer: http://stackoverflow.com/a/25134637
tagged with: awt
has answer: http://stackoverflow.com/a/25134680
has title: compiled java program there is no output
has answer: http://stackoverflow.com/a/26449268
has comment: http://stackoverflow.com/comment/39122741
tagged with: frame
answer count: 4
favorite count: 0

http://stackoverflow.com/a/25083008
has body: but then why it is forcing me to put the startDownloading call in the try catch block? The exception being caught around startDownloading is due to the construction of the URL object. If you didn't call startDownloading and just created a URL object, it would be the same, ie; URL url = null; try { url = new URL("http://www.example.com"); } catch (MalformedURLException e) { //Catch badly formed URL. e.printStackTrace(); } if (url != null) contentsFuture = startDownloading(url); As you are downloading something, that could take a while (depending on size, speed, etc), which will be why you'll end up blocking on the futures .get() call - unless whatever occurs before that takes longer than the download, in which case .get() would return immediately (again only if the download completed before .get() or it encountered an exception).
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25082469
type: Answer
answers question: http://stackoverflow.com/q/25082469

http://stackoverflow.com/q/25142862
linked to: http://stackoverflow.com/q/3287114
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25143151
score: 1
tagged with: java
upvote count: 1
has title: Is it a good practice to use JSTL inside a script (javascript) tag?
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/39137829
tagged with: jstl
has answer: http://stackoverflow.com/a/25143151
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm developing a web app using JSTL and Javascript in Eclipse Juno. I've been reading questions like How to set the JSTL variable value in javascript? and my code works good even if I have error in eclipse: But... Is it a good practice to use JSTL and Javascript like this? Does it cause a low performance in the time of rendering the webpage? Can this be done in other way?

http://stackoverflow.com/a/25157616
type: Answer
has comment: http://stackoverflow.com/comment/39165513
has comment: http://stackoverflow.com/comment/39165568
score: 2
accepted answer of: http://stackoverflow.com/q/25156195
downvote count: 0
answers question: http://stackoverflow.com/q/25156195
has body: The solution is obtained by tweaking your CircularList class a little: let's add it a length field. public class CircularList&lt;T&gt; { int length = 0; // &lt;- this field contains the number of elements that the list has. Element&lt;T&gt; first = null; public void add(Element&lt;T&gt; e){ if (first == null){ first = e; e.next = e; e.previous = e; } else { first.previous.next = e; e.previous = first.previous; first.previous = e; e.next = first; } this.length++; // &lt;- increment each time you call add(). } } Now, implementing equals becomes trivial: @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; @SuppressWarnings("unchecked") final CircularList&lt;T&gt; other = (CircularList&lt;T&gt;) obj; if(other.length != this.length) { return false; } Element&lt;T&gt; current = this.first; Element&lt;T&gt; otherCurrent = other.first; int offset = 0; boolean found = false; do { found = checkSequence(current, otherCurrent); if(!found) { offset++; otherCurrent = otherCurrent.next; } } while(!found &amp;&amp; offset &lt; length) ; return found; } private boolean checkSequence(Element&lt;T&gt; current, Element&lt;T&gt; otherCurrent) { int i = 0; while(i &lt; length &amp;&amp; current.info == otherCurrent.info) { current = current.next; otherCurrent = otherCurrent.next; i++; } return i == length; } What I'm doing here in the checkSequence method is simply iterating over each elements (there are length of them in both lists) and checking that they're all the same by pair. Then, if I left my loop because i reached length, it means that I've been through all the elements and that they were all identical. If i, at this point, is smaller than length, it means that the ith elements of the lists weren't the same. Thus, I simply return i == length. On top of this, I want to handle the cases where we're considering lists like: A, B, C C, A, B ... which must be equal. Thus, I'm simply c…
has comment: http://stackoverflow.com/comment/39168506
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39165967

kinect
type: Tag
tags question: http://stackoverflow.com/q/25146123
tag name: kinect

http://stackoverflow.com/comment/39190825
comment on: http://stackoverflow.com/q/25170869
score: 0
type: Comment
type: QuestionComment
has text: even if im not printing the value (of 999! for example) that's a problem? D: what kind of value could i use to make it work?

http://stackoverflow.com/comment/39164215
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25151488
has text: @user1990169 look at the example, so I think it should be the number of words
score: 0

http://stackoverflow.com/q/25195991
tagged with: java
has comment: http://stackoverflow.com/comment/39237341
possible better answer: http://stackoverflow.com/a/25209049
has comment: http://stackoverflow.com/comment/39236934
has answer: http://stackoverflow.com/a/25209049
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/39237177
favorite count: 0
tagged with: static
has answer: http://stackoverflow.com/a/25196102
tagged with: nullpointerexception
type: Question
has title: NullPointerException:No application instance given, getinstance() or even this(!?) seems to return null
tagged with: android
score: 1
tagged with: instance
answer count: 2
has comment: http://stackoverflow.com/comment/39237130
upvote count: 1
has comment: http://stackoverflow.com/comment/39237081
accepted answer: http://stackoverflow.com/a/25196102
has body: Why is the variable application returning null, throwing a null pointer exception? I am attempting to mod the KP Android application, and can't get past the login screen because it throws this error. 08-07 23:55:51.229: E/AndroidRuntime(14870): FATAL EXCEPTION: main 08-07 23:55:51.229: E/AndroidRuntime(14870): Process: com.bernard.beaconportal.activities, PID: 14870 08-07 23:55:51.229: E/AndroidRuntime(14870): java.lang.NullPointerException: No application instance given 08-07 23:55:51.229: E/AndroidRuntime(14870): at com.bernard.beaconportal.activities.mail.store.StorageManager.<init>(StorageManager.java:525) 08-07 23:55:51.229: E/AndroidRuntime(14870): at com.bernard.beaconportal.activities.mail.store.StorageManager.getInstance(StorageManager.java:497) 08-07 23:55:51.229: E/AndroidRuntime(14870): at com.bernard.beaconportal.activities.Account.<init>(Account.java:272) 08-07 23:55:51.229: E/AndroidRuntime(14870): at com.bernard.beaconportal.activities.Preferences.newAccount(Preferences.java:113) 08-07 23:55:51.229: E/AndroidRuntime(14870): at com.bernard.beaconportal.activities.activity.setup.AccountSetupBasics.onManualSetup(AccountSetupBasics.java:309) 08-07 23:55:51.229: E/AndroidRuntime(14870): at com.bernard.beaconportal.activities.activity.setup.AccountSetupBasics.onNext(AccountSetupBasics.java:272) 08-07 23:55:51.229: E/AndroidRuntime(14870): at com.bernard.beaconportal.activities.activity.setup.AccountSetupBasics.onClick(AccountSetupBasics.java:349) 08-07 23:55:51.229: E/AndroidRuntime(14870): at android.view.View.performClick(View.java:4466) 08-07 23:55:51.229: E/AndroidRuntime(14870): at android.view.View$PerformClick.run(View.java:18827) 08-07 23:55:51.229: E/AndroidRuntime(14870): at android.os.Handler.handleCallback(Handler.java:808) 08-07 23:55:51.229: E/AndroidRuntime(14870): at android.os.Handler.dispatchMessage(Handler.java:103) 08-07 23:55:51.229: E/AndroidRuntime(14870): at android.os.Looper.loop(Looper.java:193) 08-07 23:55:51.229: E/AndroidRuntim…

http://stackoverflow.com/comment/39297996
comment on: http://stackoverflow.com/q/25222792
has text: Posted some more code. Feel free to write an answer.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/25180927
has answer: http://stackoverflow.com/a/25187698
has body: In my main FXML controller class Alpha I have a mask with a text field and a button the clear it: @FXML private TextField testTF = new TextField(); @FXML public void clearText() { if (testTF != null) testTF.clear(); } If I enter text in to the text field and hit the clear button, the text is being removed. So far, all good. I have a second controller class Beta. The corresponding fxml file contains the menu layout (menu bar). If the menu item "new" is clicked, it should also clear my text field in class Alpha. public class Beta { private void newApp() { Alpha a = new Alpha(); a.clear(); } } Nothing happens though. What am I doing wrong here? How can I click a button/menu item in a FXML controller class and have it to clear a text field in another FXML controller class?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25187698
type: Question
tagged with: java
tagged with: javafx
has title: Clear TextField From Another Class
score: 0
has comment: http://stackoverflow.com/comment/39220752
answer count: 1
has comment: http://stackoverflow.com/comment/39241175

http://stackoverflow.com/comment/39089355
has text: The thing is the first application is some kind of platform that is supposed to read unknown plugins Those should be developed folowing conventions for compatibility. But there is no way of telling in which package the plugin developer wants to put the CommonClass. The second application is such a plugin. TO load its main class I parse the manifest. On practice I don't know the path of the CommonClass.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25116466

http://stackoverflow.com/q/25121806
has answer: http://stackoverflow.com/a/25121830
has body: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ayak1=(EditText) findViewById(R.id.editText1); say1 = Integer.parseInt(ayak1.getText().toString()); button1=(Button) findViewById(R.id.button1); button1.setOnClickListener(this); } @Override public void onClick(View v) { if(v==button1){ int sonuc=(say1)*(6)/(10); String total = String.valueOf(sonuc); fiyat.setText(total); } this is the code,can you please help?
tagged with: java
type: Question
has title: java.lang.NumberFormatException: Invalid int: "" error
linked to: http://stackoverflow.com/q/21708485
score: 0
duplicate of: http://stackoverflow.com/q/21708485
answer count: 1
has comment: http://stackoverflow.com/comment/39099085
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/25115059
accepted answer: http://stackoverflow.com/a/25115271
tagged with: intellij-idea
tagged with: java-7
downvote count: 0
tagged with: jar
has title: IntelliJ compile for Java 7 JRE using Java 8 SDK
has comment: http://stackoverflow.com/comment/39086572
has comment: http://stackoverflow.com/comment/39086487
score: 21
has comment: http://stackoverflow.com/comment/39086538
favorite count: 0
has body: I have the Java 8 SDK and runtime, and a project that is only using Java 7 features. I was wondering whether I could set up intellij to build a Java-7-level jar, something that is definitely possible from command line? So far, I have tried simply setting the project language level to 7 as an experiment, but that is obviously insufficient and not really what I need. I have also seen this question on SO: "Intellij IDEA using java7 compiler to compile when I have configured it to use Java6", but my project SDK is already set up to the newest Java version, and I merely need a Java-7-compatible artifact/jar compilation. EDIT: I only have Java 6 and Java 8 JREs/SDKs on my local system because unfortunately Java 7 has issues on my system and is not compatible.
has comment: http://stackoverflow.com/comment/39086410
upvote count: 21
tagged with: java-8
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/18756469
has answer: http://stackoverflow.com/a/25115330
tagged with: java
has answer: http://stackoverflow.com/a/25115271
possible better answer: http://stackoverflow.com/a/25115330
type: Question
answer count: 2

http://stackoverflow.com/q/25150818
accepted answer: http://stackoverflow.com/a/25150842
tagged with: java
possible better answer: http://stackoverflow.com/a/25150882
type: Question
has answer: http://stackoverflow.com/a/25150842
downvote count: 0
favorite count: 0
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/25150898
has answer: http://stackoverflow.com/a/25150882
answer count: 4
has answer: http://stackoverflow.com/a/25150866
upvote count: 2
has title: Null-Pointer Exception Error at toString
score: 2
type: AnsweredQuestion
has body: The null-pointer exception error occurs in my toString method. I'm at a loss as to why. The error can occur through multiple ways. Most commonly, an object's reference is declared but the object itself remains uncreated. I've declared and created (is initialized the right word?) Mycircle circle1 = new Mycircle (); and Mypoint center = new Mypoint (); I suspected that I hadn't initialized any of my fields when I invoked my getter methods, but that's not true. The setter methods work cleanly -- I've been successful in inputting values. Doesn't that imply that my getter methods can access some non-null value. import java.util.Scanner; public class MyCircle { private Mypoint center; private double radius; Scanner input = new Scanner (System.in); public MyCircle() { radius = 0.0; Mypoint center = new Mypoint (); System.out.println("Enter coordinates here"); center.setCoordinateX(input.nextDouble()); center.setCoordinateY(input.nextDouble()); } public String toString(MyCircle object) { return "Circle @ " + "(" + object.center.getCoordinateX() + "," + object.center.getCoordinateY() + ")" + ". Its radius is " + object.radius; } public double calcArea(MyCircle object) { double area = Math.pow(object.radius, 2) * Math.PI; return area; } public static void main (String[]args) { MyCircle circle1 = new MyCircle (); circle1.radius = 3.0; System.out.println(circle1.calcArea(circle1)); System.out.println(circle1.toString(circle1)); } } class Mypoint { private double posX; private double posY; public void setCoordinateX(double x) { posX = x; } public void setCoordinateY(double y) { posY = y; } public double getCoordinateX() { return posX; } public double getCoordinateY() { return posY; } }

http://stackoverflow.com/q/25101771
upvote count: 0
has title: make a basic calculator
has answer: http://stackoverflow.com/a/25101985
has comment: http://stackoverflow.com/comment/39061660
favorite count: 0
has comment: http://stackoverflow.com/comment/39069628
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/25101795
answer count: 5
type: UnansweredQuestion
score: -4
has answer: http://stackoverflow.com/a/25101793
tagged with: java
has body: So I am new to Java and to practice my skills I decided to make a basic calculator. So this is my code: /*Basic calculator.*/ package calculator; import java.util.Scanner; public class no_gui { public static void main(String[] args) { System.out.println("What math operation do you want to do?"); System.out.println("1. Addition, 2. Subtraction, 3. Multipilcation, 4. Division"); System.out.println("Enter number to corresponding math operation."); Scanner calc = new Scanner(System.in); double choice = calc.nextDouble(); double add1, add2, addAnswer, sub1, sub2, subAnswer, mult1, mult2, multAnswer, div1, div2, divAnswer; if (choice == 1){ System.out.println("Addition"); System.out.println("Enter first number: "); add1 = calc.nextDouble(); System.out.println("Enter second number: "); add2 = calc.nextDouble(); addAnswer = add1 + add2; System.out.println("Your answer is " + addAnswer); if(choice == 2){ System.out.println("Subtraction"); System.out.println("Enter first number: "); sub1 = calc.nextDouble(); System.out.println("Enter second number: "); sub2 = calc.nextDouble(); subAnswer = sub1 + sub2; System.out.println("Your answer is " + subAnswer); if(choice == 3){ System.out.println("Multipilcation"); System.out.println("Enter first number: "); mult1 = calc.nextDouble(); System.out.println("Enter second number: "); mult2 = calc.nextDouble(); multAnswer = mult1 + mult2; System.out.println("Your answer is " + multAnswer); if(choice == 4){ System.out.println("Divsion"); System.out.println("Enter first number: "); div1 = calc.nextDouble(); System.out.println("Enter second number: "); div2 = calc.nextDouble(); divAnswer = div1 + div2; System.out.println("Your answer is " + divAnswer); }else{ System.out.println("Re-run to use again."); } } } } } } Every time I run it and choose addition it'll do what ever is inside the if statement. But when I try subtraction it just prints out 2 and terminates the program. It worked before but today it stopped. I even tried a different method…
has answer: http://stackoverflow.com/a/25101803
type: Question
has answer: http://stackoverflow.com/a/25101808
downvote count: 4

http://stackoverflow.com/q/25085141
favorite count: 0
has body: Junit works when compiling in command line on Linux but not in eclipse kepler. I'm using maven, jboss and spring. When I run the program it says 'launching classname' has encountered a problem, an internal error occurred during: "Launching classname". Details: An internal error occurred during: "Launching classname", java.lang.NullPointerException.
has comment: http://stackoverflow.com/comment/39030985
score: -3
has comment: http://stackoverflow.com/comment/39142461
type: UnansweredQuestion
downvote count: 3
tagged with: maven
tagged with: spring
has title: Junit tests won't run in eclipse kepler
type: Question
linked to: http://stackoverflow.com/q/1250505
tagged with: java
tagged with: eclipse
upvote count: 0
tagged with: junit
has answer: http://stackoverflow.com/a/25269626
answer count: 1

http://stackoverflow.com/comment/39102661
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25118714
type: Comment
has text: if you write xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" your layout automacially becomes root element delete this block.Btw you can use any layout inside your root element of your xml file.

http://stackoverflow.com/comment/61569939
has text: Thanks. Note that the value parameter will be expecting true or false in String so sending `Boolean,TRUE` will produce an error.
comment on: http://stackoverflow.com/a/25190616
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/comment/39081371
type: AnswerComment
comment on: http://stackoverflow.com/a/25112228
type: Comment
score: 1
has text: Thanks! What a big trap!!! Sorry that the accepted answer goes to the quickest response... +1

http://stackoverflow.com/q/25151942
favorite count: 0
tagged with: multithreading
has answer: http://stackoverflow.com/a/25152014
accepted answer: http://stackoverflow.com/a/25152014
upvote count: 1
has comment: http://stackoverflow.com/comment/39155284
has comment: http://stackoverflow.com/comment/39155253
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39155298
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39155261
type: Question
has body: So I currently have this code class PrintDemo { public void printCount(){ try { for(int i = 5; i &gt; 0; i--) { System.out.println("Counter --- " + i ); } } catch (Exception e) { System.out.println("Thread interrupted."); } } } class ThreadDemo extends Thread { private Thread t; private String threadName; PrintDemo PD; ThreadDemo( String name, PrintDemo pd){ threadName = name; PD = pd; } public void run() { synchronized(PD) { PD.printCount(); } System.out.println("Thread " + threadName + " exiting."); } public void start () { System.out.println("Starting " + threadName ); if (t == null) { t = new Thread (this, threadName); t.start (); } } } public class TestThread { public static void main(String args[]) { PrintDemo PD = new PrintDemo(); ThreadDemo T1 = new ThreadDemo( "Thread - 1 ", PD ); ThreadDemo T2 = new ThreadDemo( "Thread - 2 ", PD ); T1.start(); T2.start(); // wait for threads to end try { T1.join(); T2.join(); } catch( Exception e) { System.out.println("Interrupted"); } And it Prints out the following output: Starting Thread - 1 Starting Thread - 2 Counter --- 5 Counter --- 4 Counter --- 3 Counter --- 2 Counter --- 1 Thread Thread - 1 exiting. Counter --- 5 Counter --- 4 Counter --- 3 Counter --- 2 Counter --- 1 Thread Thread - 2 exiting. Is there any way I can have Thread 1 decrease by one and then thread 2 by one until both are at 1, instead of having just thread 1 decrease to 1 and then thread 2 decrease to 1.
downvote count: 0
has title: Having Threads wait for one another.
linked to: http://stackoverflow.com/q/23436454
answer count: 1

maps
tags question: http://stackoverflow.com/q/25192299
tag name: maps
type: Tag

http://stackoverflow.com/a/25217961
has comment: http://stackoverflow.com/comment/39279818
type: Answer
has comment: http://stackoverflow.com/comment/39279920
has comment: http://stackoverflow.com/comment/39280211
has body: Try something like this SimpleDateFormat dateFormat = new SimpleDateFormat("MMMMM yyyy"); Date date = (dateFormat).parse("March 2014"); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); int noOfDays = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM"); String properFormattedDate = simpleDateFormat.format(date); System.out.println(properFormattedDate+"-"+String.valueOf(noOfDays));
accepted answer of: http://stackoverflow.com/q/25217356
answers question: http://stackoverflow.com/q/25217356
has comment: http://stackoverflow.com/comment/39280132
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39143600
has text: `(Paths/get "/home/debianaut/Migrations/blog.sakhunzai/tables/6-rating.xml") ClassCastException java.lang.String cannot be cast to java.net.URI user/eval5598 (NO_SOURCE_FILE:11)`
score: 0
comment on: http://stackoverflow.com/q/25145550
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25129156
has body: Is there ant way to modify a method like this: @RequestMapping(value="/{pagina}") public String pagina(Model model, @PathVariable("pagina") String pagina) { return "public/pagina"; } for allow handle an unknwon number of @PathVariable parameter? I want urls like this: /&lt;server&gt;/&lt;app&gt;/&lt;path&gt;/.../&lt;path&gt; be handled this way: the last path variable attribute should be stored in a separated variable; the other path varaiables should be stored in a ArrayList. anyone knows if this is possible?
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/25129315
has title: handling multiple @PathVariable attributes in a spring controller
has comment: http://stackoverflow.com/comment/39113939
tagged with: spring
answer count: 1
tagged with: spring-mvc
score: 0
tagged with: java

http://stackoverflow.com/comment/39150455
comment on: http://stackoverflow.com/q/25149293
type: Comment
type: QuestionComment
has text: @m0s: nope, I now see it too ... use JSoup or some other HTML parser.
score: 1

http://stackoverflow.com/comment/39296494
type: AnswerComment
comment on: http://stackoverflow.com/a/25227906
has text: @AndrewThompson Templates ;)
type: Comment
score: 1

http://stackoverflow.com/comment/39285554
type: QuestionComment
has text: Could you please post the DDL of your table?
comment on: http://stackoverflow.com/q/25221929
score: 0
type: Comment

http://stackoverflow.com/comment/39225086
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25184358
type: QuestionComment
has text: What OS are you using?

http://stackoverflow.com/q/25089759
favorite count: 0
tagged with: android
upvote count: 1
has body: Help me please to move ads to bottom of the screen Cocos2dxActivity.this.adView = new AdView(Cocos2dxActivity.this, AdSize.SMART_BANNER, mediationId()); @SuppressWarnings("deprecation") ViewGroup.LayoutParams ad_layout_params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); Cocos2dxActivity.this.adView.setLayoutParams(ad_layout_params); AdRequest adRequest = new AdRequest();
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25101673
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/25101673
tagged with: cocos2d-x
answer count: 1
has title: Move AdView to bottom, Cocos2dx Activity

http://stackoverflow.com/a/25192501
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39256753
accepted answer of: http://stackoverflow.com/q/25191893
answers question: http://stackoverflow.com/q/25191893
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: In java the objects you see are not objects but in fact object references. An object reference is just an reference to the object in RAM. For example. Person p1; Person p2; p1 = new Person(); // p1 now has an reference to an Person object p2 = p1; // Now p2 and p1 point to the same object Now, if we made a change to the p2's object, that change would be reflected to p1's object because they refer to the same object. For example. p2.setHeight(50); p1.setHeight(90); System.out.println(p2.getHeight()); The code snippet above would print out 90, not 50. Because first the object's height was set to 50, but then the objects height was set to 90(using some other object reference). Going back to your question. for(Person p : peopleArray) { // more code } In every cycle of the for loop, an object reference p is created and refers to the same object that an object reference in peopleArray refers to.

http://stackoverflow.com/comment/39043779
type: Comment
comment on: http://stackoverflow.com/a/25091901
has text: I understand. It does not have a more specific notion of equality. I am not arguing that, and the class currently uses the equals() method to test for equality, but that is not the problem. You said you are familiar with Binary Search Trees. Are you then familiar with how they look up data?
score: 0
type: AnswerComment

http://stackoverflow.com/a/25167330
upvote count: 4
has body: No, it's case sensitive, because it is based on the equals() method of Object rather than the case-insensitive String.equalsIgnoreCase() method. You'll need to perform case-folding yourself when inserting and testing elements.
has comment: http://stackoverflow.com/comment/92988544
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/25167282
answers question: http://stackoverflow.com/q/25167282
type: Answer

http://stackoverflow.com/q/25190241
has comment: http://stackoverflow.com/comment/39227694
tagged with: java
has comment: http://stackoverflow.com/comment/39226288
has comment: http://stackoverflow.com/comment/39226343
has comment: http://stackoverflow.com/comment/39226197
type: Question
has title: How to get ComboViewer from a Widget
has comment: http://stackoverflow.com/comment/39226260
has body: How can I get a reference to the ComboViewer from the widget. For example - to get a Combo, we don something like this: Combo[] comboControls = WidgetHierarchy.getDescendantsByType((Composite) page.getControl(), Combo.class); ComboViewer is not a control so can't apply this. Any way to achieve this?
has comment: http://stackoverflow.com/comment/39226357
score: 0
answer count: 0
type: UnansweredQuestion
tagged with: swt
has comment: http://stackoverflow.com/comment/39226177
has comment: http://stackoverflow.com/comment/39226122

http://stackoverflow.com/q/25137137
tagged with: java
has answer: http://stackoverflow.com/a/25138540
type: Question
has title: Generate SOAP request
answer count: 1
upvote count: 1
favorite count: 0
has body: I tried to generate the below SOAP request: &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:loc="http://www.csapi.org/schema/parlayx/data/sync/v1_0/local"&gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &lt;loc:syncOrderRelationResponse&gt; &lt;loc:result&gt;0&lt;/loc:result&gt; &lt;loc:resultDescription&gt;OK&lt;/loc:resultDescription&gt; &lt;/loc:syncOrderRelationResponse&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; And I'm using the following code: MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage outgoingMessage = messageFactory.createMessage(); SOAPPart soappart = outgoingMessage.getSOAPPart(); SOAPEnvelope envelope = soappart.getEnvelope(); envelope.setAttribute("xmlns:loc" , "http://www.csapi.org/s"); SOAPHeader header = envelope.getHeader(); SOAPBody body = envelope.getBody(); QName bodyName = new QName("", "syncOrderRelationResponse", "loc"); SOAPBodyElement purchaseLineItems = body.addBodyElement(bodyName); QName childName = new QName("","result","loc"); SOAPElement product = purchaseLineItems.addChildElement(childName); product.addTextNode("0"); childName = new QName("","resultDescription","loc"); SOAPElement product = purchaseLineItems.addChildElement(childName); product.addTextNode("0"); When I execute the code I get no response,but when I put the namespaceURL I got the response. could you please help me? thanks for your support
downvote count: 0
type: UnansweredQuestion
tagged with: soap
score: 1

http://stackoverflow.com/q/25155712
has comment: http://stackoverflow.com/comment/39161835
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Android TextView avoid being out of view
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/25156198
type: Question
has body: I create a TextView programmatically and at a random position. The problem is: If the text is long enough (e.g. "yellow") the TextView is out of range. My code private TextView createField(int textColor, String text){ int width = Random(10, 500); int height = Random(10, 500); TextView valueTV = new TextView(this); valueTV.setText(text); valueTV.setTextColor(textColor); valueTV.setTextSize(25); valueTV.setTypeface(null, Typeface.BOLD); valueTV.setSingleLine(true); valueTV.setMaxLines(1); LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); llp.setMargins(width, height, 50, 50); // llp.setMargins(left, top, right, bottom); valueTV.setLayoutParams(llp); return valueTV; } How can I achieve that if the text is to long for the screen the TextView is automatically moved to the left?
tagged with: random
has comment: http://stackoverflow.com/comment/39163448
answer count: 1
downvote count: 0
tagged with: textview

http://stackoverflow.com/q/25118873
type: Question
tagged with: doubly-linked-list
tagged with: linked-list
score: 0
has body: I have written a simple implementation of a doubly linked list in Java, holding Person-objects. class Node { Node next, previous; Object data; Node() { next = null; previous = null; data = null; } } I also have a Person-class with the code: class Person { String name; Person(String name) { this.name = name; } //Other methods } I then have a PersonList-class where I define methods for inserting and searching for Person-objects: class PersonList { Node first, last, previous; public void insert(Object myObject) { Node n = new Node(); n.data = myObject; //If list is empty if(first == null) { first = n; last = n; } else { n.previous = last; last.next = n; last = n; } } } So here is my QUESTION: I am trying to write a method that takes two parameters: (i) A new Person-object and (ii) a String variable holding a name. The method is to insert the new object BEFORE the person whose name matches (all names are unique). public void insertBefore(Object myObject, String name) I have tested the method by writing it such that it correctly finds the objects that are to be before and after the new Person, after the method has been implemented. Now, my problem is changing the nodes so that they point to the right objects. I have the following logic: If no people are in the list, do as with the first part of the simple insert()-method. Otherwise, loop through the people searching for the Person whose name matches the given name. If that person is found, change its current previous Node pointer to point to the newPerson, the newPerson's next pointer must point to the current person, and lastly, the current person must be the new person. public void insertBefore(Object myObject, String beforeThisName) { Node n = new Node(); Node current = first; n.data = myObject; //If no people in list (I already have code for this one) //Else, if the list contains people else { //Iterate through list while(current != null) { Person currentPerson = (Person) current.data; String currentName = currentPer…
answer count: 2
possible better answer: http://stackoverflow.com/a/25118940
has title: Add Object Before Another in a Doubly Linked List in Java
has answer: http://stackoverflow.com/a/25118940
has answer: http://stackoverflow.com/a/25118982
tagged with: java
tagged with: nodes
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39093646
accepted answer: http://stackoverflow.com/a/25118982

http://stackoverflow.com/comment/39028276
type: Comment
has text: Could you add a little info on the compiler errors you're seeing?
comment on: http://stackoverflow.com/q/25083851
score: 0
type: QuestionComment

http://stackoverflow.com/a/25124676
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25124551
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25124551
has body: for (int i = 0; i &lt; (x/y); i++) { for (int j = 0; j &lt; y; j++) { int k=0; temp[i][j] = msg[k]; k++; } } You reset k to zero in each iteration of the loop, guaranteeing you always get the first letter 'e' of your message string. Try initializing k before the inner loop. This would have been easier to spot with better formatting: for (int i = 0; i &lt; (x/y); i++) { for (int j = 0; j &lt; y; j++) { int k=0; temp[i][j] = msg[k]; k++; } }

http://stackoverflow.com/a/25133645
has comment: http://stackoverflow.com/comment/39133250
type: Answer
answers question: http://stackoverflow.com/q/25129695
has comment: http://stackoverflow.com/comment/39138596
score: 0
has comment: http://stackoverflow.com/comment/39137440
has comment: http://stackoverflow.com/comment/39131110
has comment: http://stackoverflow.com/comment/39136877
has body: Use the invalidate() method for each view you've changed. Another trick is : updating the array list object that you pass to the adapter for example if the view that you want to update is at position i do this: list.remove(i); list.add(i, new object()); // the new object must have the updated content adapter.notifyDataSetChange(); Update: let me tell you the problem again: you have a list with a taskview object ( each row corresponds to a taskview) in each row you have a progrees bar and 2 textviews you want to update some rows Solution : protected void onProgressUpdate(Event... values) { Task task = view.getTask(); task.setProgress() // first change the content of taskView data task.setStatus() task.setSecondaryStatus() // now let the adapter do update the rows adapter.notifyDataSetChange() // if it dose not work remove task and add to list and then again call notify } public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.list_item, parent, false); Task task = getItem(position); TextView status = view.findViewById(); status.setText(task.getStatus()); Progressbar pb = view.findViewById(); //.... TextView secondaryStatus = view.findViewById(); secondaryStatus.setText(task.getSecondaryStatus()); return view; }
has comment: http://stackoverflow.com/comment/39138564
has comment: http://stackoverflow.com/comment/39140358
has comment: http://stackoverflow.com/comment/39138335

http://stackoverflow.com/comment/39119692
type: QuestionComment
has text: What do your tables look like? Basically you will need a relation between the tables. Then you would do something like `SELECT * FROM question WHERE <user> = <currently logged in user>`. But this depends on your tables structure.
score: 0
comment on: http://stackoverflow.com/q/25132986
type: Comment

http://stackoverflow.com/a/25119985
type: Answer
answers question: http://stackoverflow.com/q/25119881
score: 0
has body: You can disable column resizing by: table.getTableHeader().setResizingAllowed(false);

http://stackoverflow.com/comment/39149893
type: Comment
type: QuestionComment
has text: @Emrakul, that you are still interested?
comment on: http://stackoverflow.com/q/25148923
score: 0

http://stackoverflow.com/comment/58603783
comment on: http://stackoverflow.com/a/35433558
type: Comment
has text: Your question is first when you ask google about reading multiple documents by Jackson. This problem is still valid, hope it will help somebody else ;-).
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39020755
type: Comment
comment on: http://stackoverflow.com/q/25079795
has text: If all required jars are already present, try to move the dependent jars at top of the classpath so that they get loaded before required by the depending jars + your code.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39294443
comment on: http://stackoverflow.com/a/25226868
score: 0
type: AnswerComment
type: Comment
has text: exactly..i see that too. i just don't get why thats happening

http://stackoverflow.com/q/25140355
has comment: http://stackoverflow.com/comment/39133351
has answer: http://stackoverflow.com/a/29719496
score: 0
has comment: http://stackoverflow.com/comment/39133446
answer count: 1
has title: Error:(24, 46) error: diamond operator is not supported in -source 1.6 (use -source 7 or higher to enable diamond operator)
has body: I'm getting error in my ArrayAdapter&lt;&gt; listView.setAdapter(new ArrayAdapter&lt;&gt;(this,android.R.layout.simple_list_item_1,name1)); Error:(24, 46) error: diamond operator is not supported in -source 1.6 (use -source 7 or higher to enable diamond operator) Then I updated my java version to java version "1.7.0_67" But still I'm getting the same error. OS I'm using ubuntu 14.04.
has comment: http://stackoverflow.com/comment/39133441
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39133474
type: Question
linked to: http://stackoverflow.com/q/17637179
tagged with: java
has comment: http://stackoverflow.com/comment/39133405
has comment: http://stackoverflow.com/comment/39133331
tagged with: ubuntu-14.04

http://stackoverflow.com/a/25133005
has body: An easy way is to simply read in the XML, extract the values and pass them to Flyway.setDataSource()
score: 0
has comment: http://stackoverflow.com/comment/39139777
has comment: http://stackoverflow.com/comment/39141283
type: Answer
answers question: http://stackoverflow.com/q/25106443

http://stackoverflow.com/comment/139407341
comment on: http://stackoverflow.com/a/25082456
type: Comment
has text: A variant on this Arrays.setAll(array, i -> new T());
type: AnswerComment
score: 0

http://stackoverflow.com/q/25137659
type: Question
answer count: 1
has title: Spring batch as windows service
accepted answer: http://stackoverflow.com/a/25203601
score: 0
tagged with: java
has body: INTRODUCTION I am new to the Spring Batch, but have experience with Spring and Java. I have made my own wrapper to be able to use Java to create windows services. The main API within my wrapper is usable like this way : try { // shutdown is volatile protected boolean of my runner class which is set by my wrapper when stop request occurs while (!shutdown) { // Action to be done log.info("I am running ..."); Thread.sleep(MyConstants.WAIT); // End of action } log.info("Closing daemon thread."); } catch (Exception ex) { log.error("Runtime service error.", ex); throw new ServiceException(ex); } PROBLEM DESCRIPTION The above works very well and I have been able to use it many times for implementing business logic instead of log.info("I am running ...") in various ms windows and Linux services. But now I want to use Spring Batch + Boot. So far was able to run business logic via SpringApplication.run(...) but I need to be able to safelly stop it when shutdown and what I am looking of is the best possible way for it. QUESTION Does somebody has an elegant solution for checking shutdown request and correctly shut down spring batch job called via Spring boot ? WHAT I HAVE BEEN ABLE TO DEVISE Create singleton threadsafe Spring bean Shutdown class handling shutdown status. Run SpringApplication.run(...) from new thread T1 created from MAIN. Set shutdown property of Shutdown bean via MAIN thread when OS shutdown status. Check in each Spring Batch Reader and Transformer shutdown status via Shutdown bean and throw JobInterruptedException to let Spring Batch stop. I think that this solution should work, but it seems to me overcomplicated and too bloated.
tagged with: windows-services
has answer: http://stackoverflow.com/a/25203601
tagged with: spring-batch
type: AnsweredQuestion

http://stackoverflow.com/comment/39014943
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25074499
has text: One question this @ using criteria will not work for new insert right ?? As then `instance` will be `null` . So `saveOrUpdate` which should work for both will not work?

http://stackoverflow.com/comment/39190973
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25170921
has text: Oh. I actually didn't know there was another notation for it. Glad I could clear that up, though. :)
score: 0

http://stackoverflow.com/comment/39088299
has text: well, you should definitely edit your question and show the appropriate code snippets (e.g. storeIntoBaseXDB), as your current snippet has nothing to do with it, actually. Also, what does "too long time" mean, how long is too long (inserting one million documents obviously takes some time). Additionally, as I told you many, many times now (here on SO and our mailing list): It would much likely be faster to use XQuery Update instead of serializing and writing the file to disk first.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25114547
type: AnswerComment

http://stackoverflow.com/comment/39320844
score: 0
has text: Sorry, I went out for lunch. Upon looking through the question again I noticed something else - you should be calling `test` as `callbackStore:test("test")` - the `:` operator is shorthand for `callbackStore.test(callbackStore,"test")`, so that might be your problem.
type: Comment
comment on: http://stackoverflow.com/a/25239351
type: AnswerComment

http://stackoverflow.com/a/25153950
score: 4
upvote count: 4
downvote count: 0
type: Answer
has body: It is prompting twice, because you are asking it to prompt twice. here : if (scan.nextLine().equals("y") || scan.nextLine().equals("Y")) You are calling scan.nextLine() two times. Change your code to : String s = scan.nextLine(); s=s.toLowerCase(); // change "Y" to "y" . Cleaner code. if(s.equals("y")){ //your code here }
answers question: http://stackoverflow.com/q/25153914

http://stackoverflow.com/comment/39279926
score: 0
comment on: http://stackoverflow.com/q/25218103
type: Comment
type: QuestionComment
has text: I updated this question. You can see full content of fromjava.js.erb. That's all.

http://stackoverflow.com/comment/39216315
has text: @mKorbel can you please provide me sample code to remove grid lines from jtable header
comment on: http://stackoverflow.com/q/25184138
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25130557
has comment: http://stackoverflow.com/comment/39115568
has title: Factory pattern to create Exceptions dynamically
has body: I have created Exception xml and dynamically create and throw exception. <exception-mappings> com.package.CheckedException Checked Exception Message com.package.UnCheckedException UnChecked Exception Message I create object of exception dynamically using reflection depending on the exception key. public static void throwException(final String key) throws CheckedException, UncheckedException { ExceptionMapping exceptionMapping = exceptionMappings.getExceptionMappings().get(key); if (exceptionMapping != null) { try { Class exceptionClass = Class.forName(exceptionMapping.getClassName()); try { throw ()exceptionClass.newInstance(); // line X } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } catch (ClassNotFoundException e) { e.printStackTrace(); } } } I want to know which class to typecast at line X so that I do not need to use If/else. Reason behind I do not want to use if else is, it may be possible that in future, there may be new classes added and I do not want to change this code every time new exception is added. My base logic is my service layer will throw either CheckedException or UncheckedException. If CheckedException is thrown, it will be handled by my web layer. Also I can not throw Super parent class Exception or Throwable as my web layer only catch CheckedException. If UncheckedException is thrown, it will display exception page. Please help me as I am not able to proceed further. EDIT: Any other solution is also accepted.
answer count: 6
has answer: http://stackoverflow.com/a/25130808
tagged with: factory-pattern
has comment: http://stackoverflow.com/comment/39115690
has answer: http://stackoverflow.com/a/25130926
accepted answer: http://stackoverflow.com/a/25130926
has comment: http://stackoverflow.com/comment/39115541
has answer: http://stackoverflow.com/a/25131379
has comment: http://stackoverflow.com/comment/39115794
downvote count: 0
has answer: http://stackoverflow.com/a/25130803
has comment: http://stackoverflow.com/comment/39115736
has comment: http://stackoverflow.com/comment/39115825
favorite count: 0
score: 8
upvote count: 8
has answer: http://stackoverflow.com/a/58431944
tagged with: exception
has comment: http://stackoverflow.com/comment/39115613
has comment: http://stackoverflow.com/comment/39115530
has answer: http://stackoverflow.com/a/25131007
has comment: http://stackoverflow.com/comment/39115640
has comment: http://stackoverflow.com/comment/39115764
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39115494
has comment: http://stackoverflow.com/comment/39115696
tagged with: java
has comment: http://stackoverflow.com/comment/39115731
possible better answer: http://stackoverflow.com/a/25130803
type: Question

http://stackoverflow.com/comment/39244816
score: 0
type: Comment
has text: It says "undefined type : myPackage.Shop". I have placed the above mentioned line just below all the other concerned import statements and above where the html tag begins
comment on: http://stackoverflow.com/a/25200135
type: AnswerComment

http://stackoverflow.com/comment/39213023
comment on: http://stackoverflow.com/q/25181310
has text: @user3212556 look at my updated answer
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39229311
type: Comment
has text: Comprehensive! I notice you have "solvind" for "solving" at one place, BTW.
type: AnswerComment
comment on: http://stackoverflow.com/a/25190284
score: 0

http://stackoverflow.com/a/25203487
has body: As Jon Skeet writes above, the reason why you are getting 0.179999999999999993338661852249060757458209991455078125 instead of 0.18 is because 0.06 * 3 is computed as an IEEE 754 double and then this double value is converted to a BigDecimal. Even though 0.06 looks simple enough in source code, the number 0.06 is not exactly representable as an IEEE 754 double, so what 0.06 actually represents is an approximation of 0.06 equal to 0.059999999999999997779553950749686919152736663818359375. The number 0.06 in decimal notation is not exactly representable because the number equals 0b0.000011110101110000101 in binary notation (where bold represents a repeating digit sequence). The computer must truncate this infinite sequence of binary digits, leading to the 0.0599999... approximation. As I detailed in my answer to Question regarding IEEE 754, 64 bits double?, you can use ARIBAS' decode_float() function to determine the mantissa and exponent of a floating-point number: ==> set_floatprec(double_float). -: 64 ==> set_printbase(2). -: 0y10 ==> decode_float(0.06). -: (0y11110101_11000010_10001111_01011100_00101000_11110101_11000010_10001111, -0y1000100) ==> set_printbase(10). -: 10 ==> -0y1000100. -: -68 ==> set_floatprec(128). -: 128 ==> 1/2**4 + 1/2**5 + 1/2**6 + 1/2**7 + 1/2**9 + 1/2**11 + 1/2**12 + 1/2**13 + 1/2**18 + 1/2**20. -: 0.11999_98855_59082_03125_00000_00000_00000_00 (** is exponentiation in ARIBAS). And we have 0.06 = Σ i = 0..∞ 0.11999988555908203125 / 21 + 20 × i You can evaluate this series in a computer algebra system such as Maxima: (%i1) sum ( 0.11999988555908203125 / 2 ^ (1 + 20 * i), i, 0, inf ), simpsum; (%o1) 0.06 http://maxima-online.org/?inc=r760264757
upvote count: 2
answers question: http://stackoverflow.com/q/25179127
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/40776615
comment on: http://stackoverflow.com/a/25220580
type: AnswerComment
score: 0
has text: (2) The sitemap xml actually has the venue id. When we invoke the API, the response has a different venue id. The reason for this is, sometimes venues are merged together. They have built the API so that the end user does not feel the glitch.
type: Comment

http://stackoverflow.com/q/25218942
tagged with: boundary
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25220376
has title: Creating Boundaries to prevent player from moving into in java
tagged with: java
downvote count: 2
has body: In the Game I'm going to have a set path of JButtons. I also have an Array which holds all and only the values of the JButtons I want the player to be able to move onto. JButton[] x = new JButton[71]; x[0] = y[0]; x[1] = y[15]; x[2] = y[16]; x[3] = y[31]; x[4] = y[32]; x[5] = y[47]; x[6] = y[62]; x[7] = y[93]; x[8] = y[63]; x[9] = y[78]; x[10] = y[108]; x[11] = y[168]; x[12] = y[183]; x[13] = y[184]; x[14] = y[153]; x[15] = y[123]; x[16] = y[138]; x[17] = y[197]; x[18] = y[195]; x[19] = y[185]; x[20] = y[186]; x[21] = y[171]; x[22] = y[172]; x[23] = y[173]; I also have another array which holds every single value of the JButtons in my Map. y = new JButton[225]; for (int j = 0; j &lt; 225; j++) { y[j] = new JButton(); y[j].addActionListener(this); panel.add(y[j]); } Using this code, how do I prevent the player from moving off the desired path/JButtons and stay on that singular path?
type: Question
has comment: http://stackoverflow.com/comment/39280845
score: -2

http://stackoverflow.com/a/25170913
has comment: http://stackoverflow.com/comment/39202790
downvote count: 0
answers question: http://stackoverflow.com/q/25170709
type: Answer
score: 1
upvote count: 1
has body: There are two mistakes... Firstly... arg == "Up" Is not how you do String comparison in Jave, instead, you should be using String.equals, for example... "Up".equals(arg) Have a look at How do I compare strings in Java? for more details... Secondly You are trying to perform two actions within a if condition, but only the first satememt is been executed... if (arg == "Center") top = 60; left = 125; The problem here, is left = 125; will ALWAYS be executed, regardless of which button you've pressed, wch means the object can't move left, ever. If you want multiple statements to be executed within a if statement, you need to wrap them within {...}, which is just a good idea for all your if statements really if (arg == "Center") { top = 60; left = 125; } Updated... I should also have a discussion about the relevance of using a Applet over an JApplet or using applets as all as a teaching tool, but you may not have much control over those decisions... Just beware, Applet has been replaced with JApplet so 15 years ago and applets generally are more difficult to develop then stand alone programs (using JFrame). As a general rule, you should always call super.paint as painting is typically achieved by chain a series of other methods together, this could produce paint artifacts when updated. It is also generally discouraged to override paint of top level containers, like Applet as well.

http://stackoverflow.com/comment/39082401
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25106976
type: AnswerComment
has text: Thank you for your answer. now i know why it's not working properly. since the number of concurrent asynctasks is one, what would be a proper alternative to approach this? what if i implement the server socket creation to thread creation part, where i initially implement the async task execution? then remove the async task and make the Clientworker public. will that be fine?

http://stackoverflow.com/a/25088501
upvote count: 0
has comment: http://stackoverflow.com/comment/39039606
has body: Your Question was lengthy without any code sample, ill try to come up with my best answer, I have made a project just for you on how you should use onSaveinstance state in android which will solve all the possible problems I have written an explanation essay below that will clear all your doubts In android Life-Cycle and dealing with Fragments Activity has the container for the fragments Mount the first fragment from the oncreate of Activity When we are using fragments to add replace etc. we need to use android fragment reference instead of classreference Keep the fragments in the backstack every time we mount the fragment to the container In the project we can observe that we are collecting all the states of widgets on onpause() and stored in a local variable and using this local variable, then pass this local variable into onSaveInstance() event access these tags in onActivityCreatd() are set to the view objects. We use this process because localvariables are holded in the class but view objects are null in onSaveInstance. This perticular observation is very important observed in Activity-FragmentOne-FragmentTwo-FragmentOne-OrientationChange-OrientationChange Android static objects are able to retain thae state onOrientation change but dynamic Objects has to be resetted onOrientation change with the value using localvariables as explained above If we are using the dynamic fragments we have the create the dynamic objects in OnActivityCreated() event before using the saveInstanceState to restore the dynamic objects The fragment is added to the backstack on the onPause event If the screen navigation is Activity-FragmentOne-FragmentTwo-FragmentOne-FragmentTwo then on press of the back button navigation works as FragmentTwo-FragmentOne-FragmentTwo-FragmentOne-Activity, thus we can clearly observe our path is being kept in track by the android backstack If the path is Activity-FragmentOne and change the orientation for the first time then the events fired are as follows…
has comment: http://stackoverflow.com/comment/39042919
score: -1
answers question: http://stackoverflow.com/q/25087216
downvote count: 1
type: Answer

http://stackoverflow.com/a/40511728
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25139369
type: Answer
has body: Mockito does it a little differently from EasyMock. For instance, whereas in EasyMock, you decide which member functions you want mocked: EasyMock.createMockBuilder(A.class).addMockedMethod("foo"); in Mockito, all member functions are mocked by default, and you can specify when you want to call an underlying function: A a = Mockito.mock(A.class); Mockito.when(a.foo()).thenCallRealMethod(); If you're wanting to mock only a few member functions with Mockito, I can think of two ways to proceed: The example above, and spying. A a = Mockito.spy(A.class); Mockito.when(a.foo()).thenReturn("ret"); a.bar(); // Calls the real A.bar() function. Using a spy, member functions are not mocked by default, but can be mocked selectively. See more information here: http://site.mockito.org/mockito/docs/current/org/mockito/Mockito.html#spy
score: 1

http://stackoverflow.com/comment/39167094
type: QuestionComment
has text: JPopup has BoxLayout in API ........
comment on: http://stackoverflow.com/q/25158751
score: 0
type: Comment

http://stackoverflow.com/comment/39181698
has text: Vefthym this is as part of Apriori Rule generation where res is confidence
type: QuestionComment
comment on: http://stackoverflow.com/q/25160703
type: Comment
score: 0

http://stackoverflow.com/comment/39238454
has text: Becareful, `Timestamp` is not the same as a `Date`, `Timestamp` contains both date and time information where as `Date` contains only date information, as far as PosgreSQL is concerned. `Timestamp`. As far as I can recall, a pg `Timestamp` should map to `java.sql.Timestamp`
score: 2
comment on: http://stackoverflow.com/q/25196871
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39022799
type: AnswerComment
type: Comment
score: 0
has text: the error suggest that it can't find a class , did follow some tutorial for this , if so provide a link i can look at it
comment on: http://stackoverflow.com/a/25080801

http://stackoverflow.com/comment/39046681
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25093656
has text: Please create a float variable to make the example more clear
score: 0

http://stackoverflow.com/q/25095160
tagged with: spring
has body: If I am defining a ehcache for a method which doesn't have any parameter. But in my use case I needs to access the my built cache through it's key. So please provide me the better way of assigning key on it. Follow is my code: @Override @Cacheable(value = "cacheName", key = "cacheKey") public List&lt;String&gt; getCacheMethod() throws Exception{ P.S. I am getting the following error when I am trying to access this method from somewhere else. org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'cacheKey' cannot be found on object of type 'org.springframework.cache.interceptor.CacheExpressionRootObject'
answer count: 4
accepted answer: http://stackoverflow.com/a/25096054
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39049603
linked to: http://stackoverflow.com/q/12115996
has comment: http://stackoverflow.com/comment/39049461
has answer: http://stackoverflow.com/a/62356500
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39049504
upvote count: 9
has title: What is the best way of defining key for @Cacheable annotation for Spring
has comment: http://stackoverflow.com/comment/39049887
has answer: http://stackoverflow.com/a/25095253
score: 9
possible better answer: http://stackoverflow.com/a/50850702
downvote count: 0
has comment: http://stackoverflow.com/comment/39049975
has answer: http://stackoverflow.com/a/50850702
favorite count: 0
tagged with: ehcache
has answer: http://stackoverflow.com/a/25096054
tagged with: spelevaluationexception
has comment: http://stackoverflow.com/comment/39049326

http://stackoverflow.com/comment/39096168
score: 9
has text: Have you tried anything at all yourself?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25120332

http://stackoverflow.com/a/25070479
downvote count: 0
has body: Have your task save the result to disk, and have the get() method return the File to which the result was written. Note that serialisation won't help you avoid memory issues, because you want to avoid creating the whole result in memory in the first place (passing it back doesn't use more memory). You'll want to use a "streaming" approach, where small parts of the data are written to disk as soon as they are created. Similarly, the user of the result should stream the data in, process small parts in memory, then discard the part (dereference it), before reading more in. You may also consider using using a temporary file for convenience: File file = File.createTempFile("foo", "dat"); file.deleteOnExit(); // optional, but safer
answers question: http://stackoverflow.com/q/25070327
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/25185116
has comment: http://stackoverflow.com/comment/39217257
upvote count: 2
type: Answer
score: 1
downvote count: 1
answers question: http://stackoverflow.com/q/25184911
has body: The issue is not that you do not have enough memory, the issue "GC overhead limit exceeded" means that the garbage collection is taking too long. You cannot fix this by allocating more memory, but only by using -XX:-UseGCOverheadLimit. That is, if you really want that much data in memory. See e.g. How to solve "GC overhead limit exceeded" using maven jvmArg? Or use peter lawrey's memory-mapped HugeCollections: http://vanillajava.blogspot.be/2011/08/added-memory-mapped-support-to.html?q=huge+collections : It writes to disk if the memory is full.

http://stackoverflow.com/comment/39083892
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25106976
type: AnswerComment
has text: @Vetalll thanks for the reply, so if i use a different port like 8080 for string and 8988 for image should that be fine?

http://stackoverflow.com/q/25194609
has comment: http://stackoverflow.com/comment/39235257
upvote count: 0
has answer: http://stackoverflow.com/a/25194691
favorite count: 0
accepted answer: http://stackoverflow.com/a/25194789
has title: java.util.Scanner; vs JOptionPane;
has comment: http://stackoverflow.com/comment/39234821
tagged with: joptionpane
type: AnsweredQuestion
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/39235309
tagged with: java
has comment: http://stackoverflow.com/comment/39234657
tagged with: swing
downvote count: 1
type: Question
has body: Please I would like know How would I implement JOptionPane instead of import java.util.Scanner; I also have 4 separate classes If i implement JOptionPane will it clean up the code I would also like to know any changes anyone would make. Employee.Class import java.text.NumberFormat; import java.util.Scanner; public class Employee { public static int numEmployees = 0; protected String firstName; protected String lastName; protected char gender; protected int dependents; protected double annualSalary; private NumberFormat nf = NumberFormat.getCurrencyInstance(); public Benefit benefit; private static Scanner scan; public Employee() { firstName = ""; lastName = ""; gender = 'U'; dependents = 0; annualSalary = 40000; benefit = new Benefit(); numEmployees++; } public Employee(String first, String last, char gen, int dep, Benefit benefit1) { this.firstName = first; this.lastName = last; this.gender = gen; this.annualSalary = 40000; this.dependents = dep; this.benefit = benefit1; numEmployees++; } public double calculatePay1() { return annualSalary / 52; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("First Name: ").append(firstName).append("\n"); sb.append("Last Name: ").append(lastName).append("\n"); sb.append("Gender: ").append(gender).append("\n"); sb.append("Dependents: ").append(dependents).append("\n"); sb.append("Annual Salary: ").append(nf.format(getAnnualSalary())).append("\n"); sb.append("Weekly Pay: ").append(nf.format(calculatePay1())).append("\n"); sb.append(benefit.toString()); return sb.toString(); } public void setFirstName(String firstName) { this.firstName = firstName; } public String getFirstName() { return firstName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getLastName() { return lastName; } public &lt;Gender&gt; void setGender(char gender) { this.gender = gender; } public &lt;Gender&gt; char getGender() { return gender; } public void setDependents(int dependents) { …
score: -1
answer count: 2
possible better answer: http://stackoverflow.com/a/25194691
has answer: http://stackoverflow.com/a/25194789

http://stackoverflow.com/comment/39158927
type: Comment
has text: @AndrewThompson Thx for your answer! Changing this: ` setLayout(new FlowLayout()); addUpperPane = new JPanel(new FlowLayout());` does not change anything in my Program. Any recommendations what I should change?
comment on: http://stackoverflow.com/q/25154064
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39183255
has text: What does it look like?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25167015

http://stackoverflow.com/q/25225649
has answer: http://stackoverflow.com/a/25225737
accepted answer: http://stackoverflow.com/a/25225691
type: AnsweredQuestion
upvote count: 0
has body: I have been looking for the past hour or so trying to find the reason for this, but have found nothing. It is a very small text file (only 4 characters at most), thus the reason I did not bother with a BufferedReader or BufferedWriter. The problem lies in the fact that while I have the writer put the variable into the file and even close the file, it does not actually keep the change in the file. I have tested this by checking the file immediately after running the method containing this code. try { int subtract = Integer.parseInt(secMessage[2]); try { String deaths = readFile("C:/Users/Samboni/Documents/Stuff For Streaming/deaths.txt", Charset.defaultCharset()); FileWriter write = new FileWriter("C:/Users/Samboni/Documents/Stuff For Streaming/deaths.txt"); int comb = Integer.parseInt(deaths) - subtract; write.write(comb); write.close(); sendMessage(channel, "Death count updated to " + comb); } catch (IOException e) { e.printStackTrace(); } } catch (NumberFormatException e) { e.printStackTrace(); sendMessage(channel, "Please use numbers to modify death count"); } EDIT: Since it was asked, here is my readFile message: static String readFile(String path, Charset encoding) throws IOException { byte[] encoded = Files.readAllBytes(Paths.get(path)); return new String(encoded, encoding); } I have already tested it and it returns the contents without error. EDIT2: Posting the readFile method made me think of something to try, so I removed the call to it (code above also updated) and tried it again. It now writes to the file, but does not write what I want. New question will be made for this.
tagged with: java
tagged with: filewriter
has title: Java FileWriter not actually changing file at all
score: -1
type: Question
has answer: http://stackoverflow.com/a/25225691
answer count: 2
has comment: http://stackoverflow.com/comment/39292193
has comment: http://stackoverflow.com/comment/39292444
has comment: http://stackoverflow.com/comment/39292450
downvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/25225737

http://stackoverflow.com/a/25179996
answers question: http://stackoverflow.com/q/25179795
has comment: http://stackoverflow.com/comment/39207739
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39207244
has comment: http://stackoverflow.com/comment/39207472
has comment: http://stackoverflow.com/comment/39207220
downvote count: 0
has body: An inner class is an abstraction that should be as transparent to a Java programmer as possible. Consider the following class structure and think about what would happen if you set the $this field only after calling the inner class's super constructor. class Foo { Foo() { System.out.println(foo()); } String foo() { return "foo"; } } class Bar { String bar() { return "bar"; } class Qux extends Foo { @Override String foo() { return bar(); } } } Note how the overridden method in class Qux calls a method of its outer class Bar. For this to work, the $this field that holds the Bar instance must be set before the super constructor of Foo is invoked. Otherwise, you would end up with a NullPointerException as the field is not yet initialized. To make this more clear, look at the following call chain of any instanciation of a Qux instance: Qux() -&gt; Foo() -&gt; this.foo() -&gt; $this.bar() As a programmer that is not to familiar with the implementation of an inner class, you would wonder where this exception comes from. In order to make the inner class abstraction transparent, you must set the field first, otherwise you would be stuck with a quite leaky abstraction. I do not argue that this makes the above example a good implementation, but it is legal.
type: Answer

http://stackoverflow.com/comment/39212176
comment on: http://stackoverflow.com/q/25117276
score: 0
has text: You are *starting* to develop with google app engine and the first question is about a performance tuning parameter? Why do you think it has any relevance for your software which has not even written yet? [It’s rather unlikely that it does](http://stackoverflow.com/a/18741113/2711488)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25074323
score: 0
has comment: http://stackoverflow.com/comment/39010595
answer count: 1
accepted answer: http://stackoverflow.com/a/25074499
has title: Hibernate Update giving java.lang.NullPointerException
has comment: http://stackoverflow.com/comment/39010413
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has body: I am trying the below code . Basically I am trying to update a row in database table through Hibernate. ABCEntity obj = new ABCEntity (); obj.setMetal(MetalEnum.valueOf(metal)); obj.setName(smelter_name); obj.setSmelterId(smelter_id); obj.setReferenceName(smelter_name); obj.setId((long) 117806); try { // Saving in Known Smelter Table Transaction tx = sessionFactory.getCurrentSession().beginTransaction(); sessionFactory.getCurrentSession().update(obj); tx.commit(); } catch (Exception e) { logger.info("Print object "+ obj.toString()); logger.info("Error for update: "+ e.getMessage()); } So tracing the error log I am getting : Print object ABCEntity@447a43f7[ id=117806 name=XYZ SMELTER smelterId=ABC001 metal=METAL_A referenceName=XYZ SMELTER nextSteps=&lt;null&gt; mineNames=&lt;null&gt; mineLocation=&lt;null&gt; comments=&lt;null&gt; ] and Error for update: null What is the mistake here .
type: Question
has answer: http://stackoverflow.com/a/25074499

http://stackoverflow.com/a/25121660
has comment: http://stackoverflow.com/comment/39099398
has comment: http://stackoverflow.com/comment/39099781
type: Answer
answers question: http://stackoverflow.com/q/25121558
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39122815
has comment: http://stackoverflow.com/comment/39123363
has comment: http://stackoverflow.com/comment/39161253
has body: The problem is that by default enums are persisted as int using oridinal. You have to change it to String representation by adding @Enumerated(EnumType.STRING) on enum field. Also check that in your main entity you've annotated fields instead of getter/setter so it turns on FIELD access on the entity as well as on embedded entity (in this case EmbeddedFoo). So if you annotate in EmbeddedFoo field instead of getter it will works correctly. @Embeddable public class EmbeddedFoo implements Serializable { public static enum EnumBar { VALUEA,VALUEB } @Enumerated(EnumType.STRING) private EnumBar enumBar; public EnumBar getEnumBar() { return enumBar; } public void setEnumBar(final EnumBar enumBar) { this.enumBar = enumBar; } } Also if you must have annotation on the getter for some reason you have to annotate EmbeddedFoo by @Access(AccessType.PROPERTY) and it'll also fix your problem. @Embeddable @Access(AccessType.PROPERTY) public class EmbeddedFoo implements Serializable { public static enum EnumBar { VALUEA,VALUEB } private EnumBar enumBar; @Enumerated(EnumType.STRING) public EnumBar getEnumBar() { return enumBar; } public void setEnumBar(final EnumBar enumBar) { this.enumBar = enumBar; } }
has comment: http://stackoverflow.com/comment/39242412
upvote count: 1
has comment: http://stackoverflow.com/comment/39224475

http://stackoverflow.com/comment/39141951
type: QuestionComment
score: 1
has text: try `ANT` or `MAVEN` build process to customize the WAR file.
type: Comment
comment on: http://stackoverflow.com/q/25144912

http://stackoverflow.com/a/25119636
type: AcceptedAnswer
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25119211
has comment: http://stackoverflow.com/comment/39095314
answers question: http://stackoverflow.com/q/25119211
has body: You aren't able to access fields declared in the rspGUItest class from within the actionPerformed method because actionPerformed is in the ActionListener interface, not rpsGUItest. One solution would be to declare your counters as public static fields and access them statically from the callback method. In rpsGUItest: public static int computerWins = 0; public static int userWins = 0; public rpsGUItest(){ super("Rock, Paper, Scissors"); And in the ActionListener: else if(picker == 1.0){ JOptionPane.showMessageDialog(null, "You picked Rock, the Computer picked Paper, the Computer Wins!, for some reason."); rpsGUItest.computerWins += 1; }
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39094950
has comment: http://stackoverflow.com/comment/39095644

http://stackoverflow.com/comment/39226805
has text: @Rainbolt because I am going to use the same concept to generate Ids for other situations also.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25190342

http://stackoverflow.com/q/25103915
accepted answer: http://stackoverflow.com/a/25105441
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/39065566
tagged with: javascript
has title: Browser.evaluate() method showing error
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39065422
has comment: http://stackoverflow.com/comment/39065501
has comment: http://stackoverflow.com/comment/39065394
tagged with: swt
has answer: http://stackoverflow.com/a/25105441
has body: I have written a simple Java program using the SWT API. I have instantiated a browser in the app and trying to use the browser.evaluate() method . But It shows me the following error The method evaluate(String) is undefined for the type Browser Here is my complete programe import java.awt.event.MouseEvent; import org.eclipse.swt.SWT; import org.eclipse.swt.SWTError; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import org.eclipse.swt.browser.*; import org.eclipse.swt.printing.*; import org.eclipse.swt.events.*; public class example { public static void main(String args[]) { final Display display = new Display(); final Shell shell=new Shell(display); shell.setText("Informatica Business Glossary Desktop"); final Browser browser = new Browser(shell,SWT.NONE); final String SCRIPT01 = "var html = \"\";"+ "if (typeof window.getSelection != \"undefined\") {"+ "var sel = window.getSelection();"+ "if (sel.rangeCount) {"+ "var container = document.createElement(\"div\");"+ "for (var i = 0, len = sel.rangeCount; i &lt; len; ++i) {"+ "container.appendChild(sel.getRangeAt(i).cloneContents());"+ "}"+ "html = container.innerHTML;"+ "}"+ "} else if (typeof document.selection != \"undefined\") {"+ "if (document.selection.type == \"Text\") {"+ "html = document.selection.createRange().htmlText;"+ "}" + "}" + "return html"; //final Browser browser; if(browser!=null) { browser.setUrl("https://www.google.com"); } browser.addMouseListener(new MouseListener(){ @Override public void mouseDoubleClick(org.eclipse.swt.events.MouseEvent e) { String selection = (String)browser .evaluate(SCRIPT01); // TODO Auto-generated method stub } @Override public void mouseDown(org.eclipse.swt.events.MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseUp(org.eclipse.swt.events.MouseEvent…
has comment: http://stackoverflow.com/comment/39065572
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39065551

http://stackoverflow.com/q/25150270
tagged with: orm
possible better answer: http://stackoverflow.com/a/25150317
type: Question
has body: I have a service that requires a session to create a SQL query and then to execute it. That is all. I have an @Transactional on the top-level method and this still ends up happening: org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here at org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:63) at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:687) at dao.DaoRunner.getCurrentSession(DaoRunner.java:109) at dao.DaoRunner.createSQLQuery(DaoRunner.java:170) at dao.DaoRunner$$FastClassByCGLIB$$902af9f8.invoke(<generated>) at org.springframework.internal.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:618) at dao.DaoRunner$$EnhancerByCGLIB$$484f17ac.createSQLQuery(<generated>) at SOME OTHER CLASSES at org.apache.catalina.valves.SSLValve.invoke(SSLValve.java:113) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:894) at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:728) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2108) 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:745) The DaoRunner class is AutoWired by Spring, and contains the session factory. Here is the createSQLQuery method: public Query createSQLQuery(final String sql) { return getCurrentSession().createSQLQuery(sql); } and here is the getCurrentSession() method: public Session getCurrentSession() throws HibernateException { if (null == sessionFactory) { throw new HibernateException( "SessionFacto…
answer count: 2
tagged with: transactional
upvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25150310
has title: Hibernate - Is there any particular reason that an @Transactional isn't working?
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25150310
has answer: http://stackoverflow.com/a/25150317
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/25107696
answers question: http://stackoverflow.com/q/25107279
score: 0
accepted answer of: http://stackoverflow.com/q/25107279
type: Answer
type: AcceptedAnswer
has body: The problems with your second doubleList() method : These lines : LinkedIntList other = new LinkedIntList(); // stores copy of the original list ListNode temp = other.front; // front of other list Are equivalent to : LinkedIntList other = new LinkedIntList(); // stores copy of the original list ListNode temp = null; Since front is null in a new list. In addition, temp = new ListNode(current.data); temp = temp.next; is equivalent to : temp = new ListNode(current.data); temp = null; Which means you are creating nodes that are not connected to each other. In order to link the nodes, you must update temp.next. So you can create the duplicated nodes this way : current = front; // front of this list ListNode prev = null; ListNode frontOther = null; while (current != null) { temp = new ListNode(current.data); if (prev != null) { prev.next = temp; // link the previous node to the new node } else { frontOther = temp; // keep a reference to the first node of the new nodes } prev = temp; current = current.next; } Then you can connect them to the end of the original list : current = front; // front of this list while (current.next != null) { current = current.next; } current.next = frontOther; // link the end of the original list to the duplicated nodes

http://stackoverflow.com/comment/39297044
type: Comment
comment on: http://stackoverflow.com/a/25228183
score: 0
has text: OK, got it... So why not do as I suggested and use offer() and poll() instead? You understand that the sync you did has not meaning, right?
type: AnswerComment

http://stackoverflow.com/comment/39123848
score: 0
type: Comment
type: QuestionComment
has text: @Raffaele Added github link in the question description - https://github.com/seshumadhav/grizzly/blob/master/grizzly/src/com/grizzly/GrizzlyMain.java
comment on: http://stackoverflow.com/q/25133196

http://stackoverflow.com/comment/39151785
type: QuestionComment
has text: post stacktrace/logcat?
comment on: http://stackoverflow.com/q/25149967
score: 0
type: Comment

http://stackoverflow.com/comment/39161604
type: Comment
has text: `null` layouts == more trouble than they are worth, make use of an appropriate layout manager, wrap the `JTabel` in a `JScrollPane` and let Swing take care of the rest.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25155244

http://stackoverflow.com/comment/39196105
type: QuestionComment
comment on: http://stackoverflow.com/q/25173848
has text: Well the `String` is wrong to start with...all the `\` should be escaped. How are you executing the command?
score: 0
type: Comment

http://stackoverflow.com/q/25170578
has body: My text file has this: Apple IS A fruit BANABA=fruit HERO=fruit TOYOTA 784YUT USAIRWAYS canada METROBUS=newyork TOYOTA 784YUT is the only text in that line. FileReader file = new FileReader("C:\\FILEREADER\\MockupData.txt"); BufferedReader br = new BufferedReader(file); String line; try { while ((line = br.readLine()) != null) { if (line.contains("METRO")) { String Id = myPrivateMethodToHandleThisLine1(line); //do something with this id. } else if (line.contains("TOYOTA")) { String Id2 = myPrivateMethodToHandleThisLine2(line); //do something with this id. } else if (line.contains("HERO")) { String Id3 = myPrivateMethodToHandleThisLine3(line); //do something with this id. } . . .(some more if/else conditions) . . . } catch (IOException e) { e.printStackTrace(); } .....remaing code. My Problem is simple, I am reading text from a file line by line. Based on the input line I get, I'll call handling method. I want to implement this code best in performance. I don't want to keep multiple if/else conditions. Need suggestions. NOT USING JAVA 1.7
type: Question
has comment: http://stackoverflow.com/comment/39190218
has title: MULTIPLE if else CONDITIONS in java code
has comment: http://stackoverflow.com/comment/39190299
has answer: http://stackoverflow.com/a/25170835
score: 0
has comment: http://stackoverflow.com/comment/39190210
has comment: http://stackoverflow.com/comment/39190256
answer count: 1
has comment: http://stackoverflow.com/comment/39190111
favorite count: 0
has comment: http://stackoverflow.com/comment/39190333
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39190271
downvote count: 2
has comment: http://stackoverflow.com/comment/39190225
has comment: http://stackoverflow.com/comment/39190415
tagged with: java
has comment: http://stackoverflow.com/comment/39190261

http://stackoverflow.com/comment/39284587
score: 0
type: AnswerComment
type: Comment
has text: It worked! Thank you so much, I've been trying to get this working for a while now. Recently started learning android studio (i.e. java and xml) after failing to grasp Xcode. Thanks again for your help!
comment on: http://stackoverflow.com/a/25221306

http://stackoverflow.com/q/25096883
has comment: http://stackoverflow.com/comment/39052686
tagged with: android
has comment: http://stackoverflow.com/comment/39052649
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25097013
accepted answer: http://stackoverflow.com/a/25097013
tagged with: java
has comment: http://stackoverflow.com/comment/39052567
type: Question
has title: Multiple objects in a callback
score: 0
tagged with: retrofit
has body: I'm using retrofit to communicate with a webservice. The server returns a response JSON which contains success (a boolean), and if success is false, the response also contains a message (String). But, if success is true, the response will contain the request result, eg a List&lt;> of users or a single user or something else, depending on the request. public class User { public String fullname,phone; } The retrofit API: public interface DemoAPI { @GET("/users/{id}") void getUserInformation(@Path("id") int userID, Callback&lt;User&gt; callback); @FormUrlEncoded @POST("/login") void login(@Field("username") String username, @Field("password") String password,Callback&lt;??&gt; callback); } The question is, what to do if I want to, for example, log a user in and return his User information? The callback should then include both the user object and the success + message values (message if needed), but I can't put those inside a single User since some requests return a List&lt;User&gt;.
has comment: http://stackoverflow.com/comment/39052547
answer count: 1

http://stackoverflow.com/comment/39200789
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25164832
has text: Bobik does look like something I need, but their website is down... Are there other alternatives? Or do you know some workaround?

http://stackoverflow.com/q/25094642
tagged with: type-conversion
score: 0
has comment: http://stackoverflow.com/comment/39048514
has title: Double value big enough returns an error in Java
has comment: http://stackoverflow.com/comment/39048534
favorite count: 0
has answer: http://stackoverflow.com/a/25094680
accepted answer: http://stackoverflow.com/a/25094680
has body: I was basically playing with data types in order to learn java and here is what i am confused about. double douVar = 30000000000.323262342134353; int intVar = (int)douVar; // casting System.out.println(intVar); Now converting the douVar to string i overwrite the double variable: douVar = 345839052304598; // returns an error: Integer number too long System.out.println(Double.toString(douVar)); complete error: Error:(20, 18) java: integer number too large: 345839052304598 I'm using IntellijIDEA compiler. I didnt try this over eclipse though but i assume the compiler would not be so different. Does this mean that casting would result in modifying the original variable as well?
answer count: 5
has answer: http://stackoverflow.com/a/25094700
has comment: http://stackoverflow.com/comment/39048552
has comment: http://stackoverflow.com/comment/39048376
possible better answer: http://stackoverflow.com/a/25094712
has answer: http://stackoverflow.com/a/25094686
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25094676
upvote count: 1
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25094712

http://stackoverflow.com/a/25078417
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25073258
answers question: http://stackoverflow.com/q/25073258
type: Answer
downvote count: 0
has body: The way windows handles double-clicking a jar file is by launching javaw which is designed to run a Java GUI program without displaying the console window. When I double-click a Java console application, I see something like this in the console window: javaw -jar "C:\JavaPrograms\SampleConsoleApp\dist\DistanceCalc.jar" Nothing else is displayed because javaw is designed to launch a GUI window, but there is none. If you would like to make a console application that gets launched with a double click, create a text file called launcher.bat and place the launch command in that batch file: java -jar "C:\JavaPrograms\SampleConsoleApp\dist\DistanceCalc.jar" Netbeans will actually generate this command line for you when you run your program from the IDE by displaying something like this in the output window: To run this application from the command line without Ant, try: java -jar "F:\JavaPrograms\IndexMaker\dist\IndexMaker.jar"
has comment: http://stackoverflow.com/comment/39272629
score: 1

http://stackoverflow.com/q/25073707
has answer: http://stackoverflow.com/a/25074148
has comment: http://stackoverflow.com/comment/39009328
type: UnansweredQuestion
has body: I'm newbea to java and i want to know is there anything similar functionality as javascript bind in java. ex : function x(bindedArg, arg1, arg2){ } x.bind(this, 'bindedArg'); x('arg1', 'arg2'); Update: A good example would be in event's callback function. What if i need an object / argument available in the actual event callBack context, that was previously available at the time of setting a callback to an event.
has comment: http://stackoverflow.com/comment/39009070
has answer: http://stackoverflow.com/a/25074079
has comment: http://stackoverflow.com/comment/39009478
upvote count: 2
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39009435
tagged with: java
tagged with: javascript
has comment: http://stackoverflow.com/comment/39009106
answer count: 2
has comment: http://stackoverflow.com/comment/39009558
score: 1
has title: Is there a javascript bind like function in java
favorite count: 0

http://stackoverflow.com/q/25086906
tagged with: tomcat
has body: I have successfully used the matlabcontrol jar to run Matlab remotely from Java on my local machine. However, when I put my code onto a Java 7 servlet hosted on a Tomcat 8.0 server on Eclipse EE Luna and ran the same code, Matlab started up just fine, but then gave me this error: matlabcontrol.MatlabConnectionException: Support code location could not be determined. Could not get path from URI location. Note: This was running matlabcontrol-4.1.0 I tried downgrading to matlabcontrol-3.0.1 using the RemoteMatlabProxy class. It executed Matlab remotely just fine, but then gave me an error: Undefined variable "matlabcontrol" or class "matlabcontrol.MatlabConnector.connectFromMatlab". Immediately I thought of compatibility issues, but I was able to run Matlab just fine in Eclipse SE with both matlabcontrol versions. That suggests that the problem is actually with EE. Does anyone know of any additional procedures I have to follow in order to get this running on a servlet?
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25147348
type: UnansweredQuestion
has title: Matlabcontrol and Java Servlet
tagged with: matlab
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
tagged with: servlets
type: Question
downvote count: 0

http://stackoverflow.com/comment/96435615
score: 0
comment on: http://stackoverflow.com/q/25141904
type: QuestionComment
has text: @wutzebaer Not necessarily. See [this answer](https://stackoverflow.com/a/54830353/2074605).
type: Comment

http://stackoverflow.com/q/25204199
has answer: http://stackoverflow.com/a/25204463
tagged with: java
type: Question
downvote count: 2
has answer: http://stackoverflow.com/a/25204798
accepted answer: http://stackoverflow.com/a/25204798
has comment: http://stackoverflow.com/comment/39252869
has title: How do you write every paintComponent call simultaneously to BufferedImage?
tagged with: awt
favorite count: 0
has answer: http://stackoverflow.com/a/25205216
has body: How do you write every every repaint call (direct or not) by a JPanel-type (i.e. a custom class which extends/inherits from JPanel) to a BufferedImage ? Doing this sort of thing inside the custom class' paintComponent does not work: protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D G2 = (Graphics2D) g; // ... draw objects BufferedImage imageBuffer = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB); G2 = imageBuffer.createGraphics(); // Which doesn't work, because with that method it seems you would // need to call paint() on Graphics2D reference here. // And to do so would then throw an Illegal Exception. } The resulting BufferedImage is the correct size of the JPanel-type class which calls paintComponent, but the image is black (i.e. empty) - which is entirely logical because createGraphics() alone does nothing. I know of Rob Camick's ScreenImage code - but that seems intended for a single screenshot at initialisation of the program. What leaves me confused is that what paintComponent does must be held in memory before being displayed on-screen... So is there a way of grabbing that every time and saving it into a BufferedImage ?
upvote count: 5
answer count: 3
tagged with: paintcomponent
tagged with: swing
tagged with: bufferedimage
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25205216
score: 3

http://stackoverflow.com/comment/39219241
type: QuestionComment
comment on: http://stackoverflow.com/q/25186653
score: 0
has text: Have you checked what queries were run last on MySQL?
type: Comment

http://stackoverflow.com/a/25095047
upvote count: 0
answers question: http://stackoverflow.com/q/25095030
score: -2
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/39049004
has body: name = name.replaceAll("\\n",""); name = name.replaceAll("[ ]+"," ");

http://stackoverflow.com/comment/39258959
has text: Look at this post: http://stackoverflow.com/questions/2943556/static-block-in-java
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25207744
score: 0

http://stackoverflow.com/comment/39118363
type: QuestionComment
has text: Show us some code which you tried!!!
comment on: http://stackoverflow.com/q/25132215
score: 0
type: Comment

http://stackoverflow.com/comment/39266638
has text: Do you mean unscrambling words to find any possible words that it can be? Hopefully you can be more clear, thanks.
comment on: http://stackoverflow.com/q/25210736
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25118814
score: 0
has body: I had the same error as shown immediately after accepting an offer of an upgrade by a working version of Samsung Link. The error persisted after uninstalling, cleaning and reinstalling this software. After an extended conversation with Samsung (during which they blamed my PC for having a virus and me for being stupid because I couldn't find a non-existent download link), they eventually sent me a zip file and the following instructions: Unzip the attached file to temporary folder. Copy the extracted files (pCloudAgent-2.0.jar, pCloudCommon-2.0.jar, pCloudUtil-2.0.jar) to the installed path e.g. C:\Program Files\Samsung\Samsung Link\lib\pCloudAgent-2.0.jar C:\Program Files\Samsung\Samsung Link\lib\pCloudCommon-2.0.jar C:\Program Files\Samsung\Samsung Link\lib\pCloudUtil-2.0.jar For the benefit of others, the file can be downloaded from here. I hope that this helps.
type: Answer
answers question: http://stackoverflow.com/q/25087490

http://stackoverflow.com/comment/39056853
has text: In your code, where are you passing in the path to the audio file? im a little confused how i would implement your code in mine
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25098333
type: AnswerComment

http://stackoverflow.com/q/25223393
score: 0
has body: I have created a web service and client project as well. Now I need the SEI created in web application to finish client application by taking the dependency of web application using maven. It didn't work. Can some one help me on this? Client pom.xml 4.0.0 com.dstyle.orderapp OrderProcessingApplicationClient jar 1.0-SNAPSHOT OrderProcessingApplicationClient http://maven.apache.org com.dstyle.orderapp OrderProcessingApplication 1.0-SNAPSHOT compile Web service application pom.xml 4.0.0 com.dstyle.orderapp OrderProcessingApplication war 1.0-SNAPSHOT OrderProcessingApplication Maven Webapp http://maven.apache.org junit junit 3.8.1 test OrderProcessingApplication
has title: Add java web service project as dependency to another java client project using maven
accepted answer: http://stackoverflow.com/a/25243953
tagged with: http://stackoverflow.com/tag/xml
possible better answer: http://stackoverflow.com/a/25223819
has answer: http://stackoverflow.com/a/25223819
tagged with: maven
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39288334
type: Question
has answer: http://stackoverflow.com/a/25243953
has comment: http://stackoverflow.com/comment/39288668
answer count: 2

http://stackoverflow.com/comment/39219276
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25186500
has text: Thanks @Fildor (+1) - but should I use `shutdown` or `shutdownAndAwaitTermination`? (And why)?
score: 0

http://stackoverflow.com/q/25151488
type: Question
has comment: http://stackoverflow.com/comment/39155037
downvote count: 0
has comment: http://stackoverflow.com/comment/39154860
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/39154879
score: 3
tagged with: python
has answer: http://stackoverflow.com/a/25153230
linked to: http://stackoverflow.com/q/9268709
tagged with: c++
has comment: http://stackoverflow.com/comment/39156606
upvote count: 3
type: UnansweredQuestion
has title: Best approach to solve Word Chain
has body: I am trying to solve this problem in CodeEval. In this challenge we suggest you to play in the known game "Word chain" in which players come up with words that begin with the letter that the previous word ended with. The challenge is to determine the maximum length of a chain that can be created from a list of words. Example: Input: soup,sugar,peas,rice Ouput: 4 Explanation: We can form a chain of 4 words like this: "soup->peas->sugar->rice". Constraints: The length of a list of words is in range [4, 35]. A word in a list of words is represented by a random lowercase ascii string with the length of [3, 7] letters. There is no repeating words in a list of words. My attempt: My approach is to model the words as a graph, such that each word in the inputs represents a node and there is an (directed) edge between from wordi to wordj if last character of wordi is equal to the first character of wordj. After that I am running bfs from each node and computing the length of the farthest node from the this node. The final result is the maximum value possible for all nodes. But this approach is not giving me a full score. Hence, my question is how to solve this problem correctly and efficiently?
has answer: http://stackoverflow.com/a/28391867
has comment: http://stackoverflow.com/comment/39154908
has comment: http://stackoverflow.com/comment/39160534
linked to: http://stackoverflow.com/q/1521958
has comment: http://stackoverflow.com/comment/39154941
has comment: http://stackoverflow.com/comment/39154961
has comment: http://stackoverflow.com/comment/39154763
tagged with: algorithm
has comment: http://stackoverflow.com/comment/39155070
tagged with: java
has answer: http://stackoverflow.com/a/25152400
has comment: http://stackoverflow.com/comment/50687621
has comment: http://stackoverflow.com/comment/39164215

http://stackoverflow.com/a/25195603
downvote count: 0
upvote count: 2
has body: Try changing System.out.println("the number " + i + " appears " + a[i] + "times"); to System.out.print("the number " + i + " appears "); for(int n = 0; n &lt; a[i]; n++) System.out.print("x"); System.out.println(" times");
answers question: http://stackoverflow.com/q/25195551
has comment: http://stackoverflow.com/comment/39236108
type: Answer
score: 2

http://stackoverflow.com/comment/39632183
score: 0
type: AnswerComment
type: Comment
has text: Hi, Thanks David. Thanks Knowarth. It was really helpful and my problem is resolved.......Thanks again
comment on: http://stackoverflow.com/a/25223838

http://stackoverflow.com/q/25108665
tagged with: java
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/39074466
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/39097913
has body: i am using this program and getting the above error! public class Src { public static void main(String args[]) { // TODO Auto-generated method stub int a=Integer.parseInt(args[0]); int b=Integer.parseInt(args[1]); int c=a+b; System.out.println(""+c); } }
has title: Error Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at Src.main(Src.java:6)
has comment: http://stackoverflow.com/comment/39074454
has comment: http://stackoverflow.com/comment/39100597
score: -1
favorite count: 0
tagged with: exception
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5554734
has answer: http://stackoverflow.com/a/25108704
has answer: http://stackoverflow.com/a/25108689
downvote count: 1

http://stackoverflow.com/q/25114446
score: 0
has answer: http://stackoverflow.com/a/25114604
answer count: 1
accepted answer: http://stackoverflow.com/a/25114604
has title: Line created by drawline method, disappears when resizing form
tagged with: java-2d
has body: i have a jlable.and i'm going to draw a graph on it.but i realized that a line crated by draw line method ,disappear when resizing frame. this is my code.i want to know how to avoid from disappearing when resize.i want to stay line even resize jframe. void graph(JComponent jcom,int thick,int height,int xpos,int ypos,Color col){ Graphics2D gfx=(Graphics2D) jcom.getGraphics(); gfx.setStroke(new BasicStroke(thick)); gfx.setPaint(col); gfx.drawLine(xpos, ypos, xpos, ypos-height); } button click code graph(jLabel1, 10, 100, 200, 200, Color.GREEN);
tagged with: swing
linked to: http://stackoverflow.com/q/4396583
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/25092370
accepted answer of: http://stackoverflow.com/q/25092339
has comment: http://stackoverflow.com/comment/39044345
has comment: http://stackoverflow.com/comment/39044394
has comment: http://stackoverflow.com/comment/39044363
type: Answer
has comment: http://stackoverflow.com/comment/39044313
has body: Your pattern is [a-zA-z], you mentioned the range A to z inside the character class. [ symbol falls within the range capital A to small z, so it returns true. See the ASCII table for the symbols which falls within the range A to z .
has comment: http://stackoverflow.com/comment/39044413
upvote count: 4
answers question: http://stackoverflow.com/q/25092339
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/39044409

http://stackoverflow.com/a/25208409
type: Answer
answers question: http://stackoverflow.com/q/25208328
has body: A OutOfMemoryError is thrown when you have too many RAM used. Try to find out where you store very much data, e.g. in a List that is never cleared. If you can't find the error, create a Heap Dump. Then, open it and look what rubs your memory. A great tutorial is here: https://blog.codecentric.de/2011/08/java-heapdumps-erzeugen-und-verstehen-4-akt/
score: 0

http://stackoverflow.com/comment/39300429
has text: These things are almost always a result of Daylight Saving Time or a timezone difference. A quick look [here](http://www.timeanddate.com/time/dst/2014.html) shows us that this date is indeed around the time DST sprung into action.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25229935
score: 0

http://stackoverflow.com/q/25075007
type: AnsweredQuestion
tagged with: tokenize
has title: StreamTokenizer.nextToken skipping too many tokens?
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/25075193
accepted answer: http://stackoverflow.com/a/25075193
score: 0
tagged with: token
has body: I have the following code which should go through each token, and when the specified characters appear in sequence it means that a comment has begun or ended. I created the last if statement to execute some code if the position is not between the comments. int commentFound = -1; int commentEnded = -1; do { int token = st.nextToken(); switch (token) { case StreamTokenizer.TT_EOF: System.out.println("End of File encountered."); eof = true; default: if ((token == '&lt;')) { System.out.println(st.sval); if (st.nextToken() == '!') { System.out.println(st.sval); if (st.nextToken() == '-') { if (st.nextToken() == '-') { if (st.nextToken() == '-') { System.out.println("Comment Found on line number: " + st.lineno()); commentFound = st.lineno(); } } } } } else if ((token == '-')) { if (st.nextToken() == '-') { if (st.nextToken() == '-') { if (st.nextToken() == '&gt;') { System.out.println("Comment Ended on: " + st.lineno()); commentEnded = st.lineno(); } } } } if ((commentFound != -1) &amp;&amp; !((st.lineno() &gt; commentFound) &amp;&amp; (st.lineno() &lt; commentEnded))) { The comment opening tag is always being found, however the closing tag is not always found. After some debugging I think I figured out that the 'nextToken' is skipping too many tokens. Is this possible ? and if so, could there be any way to fix this problem ? Any help would be greatly appreciated
tagged with: stream

grouplayout
type: Tag
tags question: http://stackoverflow.com/q/25179300
tag name: grouplayout

http://stackoverflow.com/comment/39129495
type: QuestionComment
comment on: http://stackoverflow.com/q/25138389
has text: Where are you outputting the string too?
score: 0
type: Comment

http://stackoverflow.com/comment/39181464
type: AnswerComment
comment on: http://stackoverflow.com/a/25105724
type: Comment
has text: @ChristophWintersteiger: I haven't used .NET API before but the example in my question is indeed using Java API:-).
score: 0

http://stackoverflow.com/comment/39008630
has text: http://stackoverflow.com/questions/2543938/how-to-split-mobile-number-into-country-code-area-code-and-local-number
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25073336

http://stackoverflow.com/a/25164176
score: 1
type: Answer
has body: Annotate ExposedFunctions with @Path, too. @Path("/") public class ExposedFunctions { Edit: The class is the root resource while the methods are sub resources. You must have both.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25164116
answers question: http://stackoverflow.com/q/25164116
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25176712
type: AcceptedAnswer
has body: Full code: ArrayList member = new ArrayList(); member.add(new Member("V0001","Amy","0000-0000-0000","012-3456789","01-01-2014","01-01-2015")); System.out.printf("\nEnter New Expired Date: "); String expiredDate =inputS12.nextLine(); Member m=(Member)member.get(0);//First you need to get the object m.setExpiredDate(expiredDate); member.set(0,m);
type: Answer
accepted answer of: http://stackoverflow.com/q/25175488
answers question: http://stackoverflow.com/q/25175488
score: 0

http://stackoverflow.com/a/55054154
upvote count: 53
has comment: http://stackoverflow.com/comment/98178088
has comment: http://stackoverflow.com/comment/98152770
score: 53
downvote count: 0
has body: DateTimeFormatter.ISO_INSTANT.format(Instant.now()) This saves you from having to convert to UTC. However, some other language's time frameworks may not support the milliseconds so you should do DateTimeFormatter.ISO_INSTANT.format(Instant.now().truncatedTo(ChronoUnit.SECONDS))
type: Answer
answers question: http://stackoverflow.com/q/25229124

http://stackoverflow.com/q/25111527
tagged with: android
has title: Draw circle when touched and when touch is removed in a custom view
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25111590
downvote count: 0
score: 1
tagged with: java
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25111590
tagged with: android-canvas
upvote count: 1
answer count: 1
has body: I am trying to draw to different circles when the user touches the screen and when the touch is removed. I am somewhat successfull but the start touch circle disapperas when the "ACTION_UP" event circle is drawn. Not sure What is going wrong. My OnDraw and OnTouch functions are below public void onDraw(Canvas canvas) { //drawing lines //lines canvas.drawCircle(point.x, point.y, 5, paint); //circles //canvas.drawCircle(point.x, point.y, 5, paint); } public boolean onTouch(View view, MotionEvent event) { // if(event.getAction() != MotionEvent.ACTION_DOWN) // return super.onTouchEvent(event); // points.add(point); switch(event.getAction()){ case MotionEvent.ACTION_DOWN : point.x = (int)event.getX(); point.y = (int)event.getY(); paint.setColor(Color.BLACK); break; case MotionEvent.ACTION_UP: point.x = (int)event.getX(); point.y = (int)event.getY(); paint.setColor(Color.BLUE); break; } invalidate(); return true; } }

http://stackoverflow.com/q/25087688
has answer: http://stackoverflow.com/a/25087739
upvote count: 0
has comment: http://stackoverflow.com/comment/39035927
type: UnansweredQuestion
has title: Java documentation -- missing methods?
has comment: http://stackoverflow.com/comment/39039968
score: -2
tagged with: java
has body: The method init() of Thread isn't in the Java documentation. Neither is addUnstarted() of ThreadGroup. What am I missing ???
type: Question
downvote count: 2
has comment: http://stackoverflow.com/comment/39040177
has comment: http://stackoverflow.com/comment/39036821
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/119478029
type: AnswerComment
comment on: http://stackoverflow.com/a/25182306
type: Comment
score: 0
has text: @shiva The compiler could ensure that `Cat.identify()` has a definition but my understanding is that when you call `Cat.identify()` you're calling the most "derived" version of the `identify()` method. Not just a different method. When calling `Cat.identify()` for the derived class, you are allowing the developer to eventually provide a definition for `identify()` that is better defined for that class without changing the remainder of the code. For the static interface method, there's just no benefit I can think of. If you want a different method can't you just give it a different name?

tcp
tags question: http://stackoverflow.com/q/25124933
type: Tag
tags question: http://stackoverflow.com/q/25083172
tags question: http://stackoverflow.com/q/25102101
tags question: http://stackoverflow.com/q/25109303
tags question: http://stackoverflow.com/q/25228187
tags question: http://stackoverflow.com/q/25215008
tags question: http://stackoverflow.com/q/25200321
tag name: tcp
tags question: http://stackoverflow.com/q/25074761
tags question: http://stackoverflow.com/q/25186924

http://stackoverflow.com/q/25074761
has comment: http://stackoverflow.com/comment/39013610
has title: Unclear on setting or getting Java NIO TCP socket buffer size
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/39015171
has comment: http://stackoverflow.com/comment/39014621
answer count: 0
tagged with: tcp
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39014957
has body: I have a program where i set the buffersize of socket using socketchannel.socket().setBufferSize(100*1024*1024) and OS is ubuntu. And when i tried verifying the value using getBufferSize() i see the value "131071". From few posts i got to know that the value set in setBufferSize() is just a suggestion for the method and not actually picked. I assumed that the value is taken from /proc/sys/net/ipv4/tcp_rmem. But here I see totally different value. I'm confused. The value mentioned in set method is "104857600", but get method is giving "131071". The value I see in /proc/sys/net/ipv4/tcp_rmem is "4096 87380 6291456", where 6291456 is max value which is irrelevant. Could someone Please explain me how this strategy works.
has comment: http://stackoverflow.com/comment/39014970
score: 0

http://stackoverflow.com/q/25072453
downvote count: 1
has answer: http://stackoverflow.com/a/25073314
type: Question
has answer: http://stackoverflow.com/a/25072879
tagged with: javascript
has comment: http://stackoverflow.com/comment/39006867
has title: Passing javascript array tojava servlet
tagged with: servlets
has comment: http://stackoverflow.com/comment/39007201
has comment: http://stackoverflow.com/comment/39007474
answer count: 3
has comment: http://stackoverflow.com/comment/39006901
has answer: http://stackoverflow.com/a/25072548
tagged with: jsp
favorite count: 0
type: UnansweredQuestion
has body: I have found other question regarding on this, but still im having a problem,When i check getParamerterValues, its always return null, and i think im having trouble redirecting it to my controller.Bare with me, in new to web app. arr = []; $(document).on("click","#idhere",function(){ $.post("servlet.html","ids="+arr+"",function(response){ }); }); or is there something like converting array of javascript to JSON of array in JSP so i can pass it to my servlet? String arr [] = request.getParameterValues("ids"); if(arr != null){//this line doesnt return true even my array contains item}
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39007223
upvote count: 1

http://stackoverflow.com/comment/39015014
comment on: http://stackoverflow.com/a/25076473
has text: I don't know why you are mentioning two tables. Once you do the join, the results should contain fields from both tables, all in one result row. Print it out like in post to see
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25189761
tagged with: java
tagged with: javafx
type: Question
accepted answer: http://stackoverflow.com/a/25244219
has body: I wrote code for a TableView that will allow rows to drag and drop. Works great as a standalone JavaFX application. However, it doesn't work in an embedded JFXPanel for work in a Swing app. I want to integrate it with my Swing app, so I can't use it as a standalone. The error is in the JavaFX code itself, which isn't giving me a whole lot to go on. I'm not sure if I can alter my code to fix the problem. I've cut out most of the rest of the code, and left the first part it fails on. The onDragDetected code fails first. Here's the error: java.lang.AssertionError at javafx.embed.swing.SwingDnD.startDrag(SwingDnD.java:261) at javafx.embed.swing.SwingDnD.access$1000(SwingDnD.java:73) at javafx.embed.swing.SwingDnD$4$1.run(SwingDnD.java:249) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744) at java.awt.EventQueue.access$400(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:697) at java.awt.EventQueue$3.run(EventQueue.java:691) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:714) … Here is my code that creates the handler in a customized TableView class private EventHandler&lt;MouseEvent&gt; createDragDetectedHandler( final TableCell&lt;ReportSelectedItem, String&gt; cell) { return new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent event) { try { Dragboard db = cell.startDragAndDrop(TransferMode.MOVE); ClipboardContent content = new ClipboardContent(); content.putString(String.valueOf(cell.getIndex())); WritableImage snapshot = cell.getTableRow().snapshot(new SnapshotParameters(), null); db.setDragView(snapshot); db.setContent(content); } catch (AssertionError ex) { ex.printStackTrace(); } } }; } The exception is thrown from this line: Dragboard db = cell.startDragAndDrop(TransferMode.MOVE); I added i…
score: 0
tagged with: javafx-8
answer count: 1
has title: Assertion error trying to implement Drag and Drop with embedded JavaFX in Swing
has answer: http://stackoverflow.com/a/25244219
type: AnsweredQuestion

http://stackoverflow.com/comment/39272537
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25214779
type: Comment
has text: Awesome thanks works well now. if i were to ask for more knowledge to implement other features could you help and how can i do it?

http://stackoverflow.com/a/25211633
answers question: http://stackoverflow.com/q/25210475
downvote count: 0
score: 1
has body: Normally an index on a Boolean isn't a good idea, but in PostgreSQL you can do an index where it contains only entries for one value using a partial index http://www.postgresql.org/docs/9.3/interactive/indexes-partial.html. It ends up being a queue of things for you to process, items drop off once done. CREATE INDEX "yourtable_isProcessed_idx" ON "public"."yourtable" USING btree ("isProcessed") WHERE (isProcessed IS NOT TRUE); This will make life easier when it is looking for the next item to process. Ideally you should be processing more than one at a time, particularly if you can do it in a single query, though doing millions at once may be prohibitive. In that situation, you might be able to do update yourtable set .... where id in (select id from yourtable where isProcessed = false limit 100 ) If you have to do things one at a time, I'd still limit what you retrieve, so potentially retrieve select id from yourtable where iProcessed = false limit 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39271799
type: Answer

http://stackoverflow.com/a/25189961
answers question: http://stackoverflow.com/q/25189384
score: 1
downvote count: 0
has body: You should implement User sessionmanager using shared preference.First you should learn what shared preference actually is.For that consult this or this. After that when you are ready to go, check this. Link 3 will meet all the requirements.But first learn about shared preferences.
type: Answer
upvote count: 1

http://stackoverflow.com/q/25082683
has title: How to use ORecordHook in OrientDB version 1.7.x
tagged with: java
has body: The current documentation / javadoc does not explain the use of the new methods in this interface: void onUnregister() ORecordHook.DISTRIBUTED_EXECUTION_MODE getDistributedExecutionMode()
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25089160
upvote count: 1
tagged with: orientdb
answer count: 1
accepted answer: http://stackoverflow.com/a/25089160

http://stackoverflow.com/comment/39242679
has text: you might want to take time to read [this](http://stackoverflow.com/questions/17001185/pass-hidden-parameters-using-response-sendredirect)
type: Comment
comment on: http://stackoverflow.com/q/25199107
type: QuestionComment
score: 3

http://stackoverflow.com/comment/39199135
type: QuestionComment
comment on: http://stackoverflow.com/q/25175288
has text: Desired behavior is that tokenizer example above can return varchar token: quote + text + quote .
score: 0
type: Comment

http://stackoverflow.com/q/25095487
has body: I'm planning to write a a simple 1-1 chat service. I've chose to use the Play! framework (Java web framework). Let's assume a chat server is serving two users and suddenly the server crahses. Is it something I need to take into account? How often is it expected to happen? (On average for a chat server). And the most important question: How to handle this kind of situation? Technically, both users should be transfered seamlessly to another node on the cloud + I want to save the state of both users and other information which relevant for the chat session Footnote: I heard about a tool called Akka but at a first glance, it looks like an heavy tool which shall be learned deeply. I hope my question doesn't fall under "Broad Question". I think it's pretty much specific and concrente.
has comment: http://stackoverflow.com/comment/39111042
has comment: http://stackoverflow.com/comment/39081608
upvote count: 1
has answer: http://stackoverflow.com/a/25131874
type: AnsweredQuestion
tagged with: playframework-2.0
score: 1
tagged with: java
tagged with: concurrency
type: Question
has comment: http://stackoverflow.com/comment/39070579
accepted answer: http://stackoverflow.com/a/25131874
has comment: http://stackoverflow.com/comment/39071052
downvote count: 0
tagged with: webserver
has comment: http://stackoverflow.com/comment/39071132
tagged with: akka
has title: Chat service and persistance
answer count: 1
favorite count: 0

http://stackoverflow.com/q/25163950
type: Question
tagged with: serialization
answer count: 1
has title: Java JasperPrint RMI deserialization error
has body: I have two projects set up as client and server using Spring in Java 7 update 51. The underlying system is Scientific Linux 6.5 (kernel version 2.6.32-431.23.3.el6.x86_64). The used libraries are jasperreports-5.6.0, iText-2.1.7, jcommon-1.0.15 and jfreechart-1.0.12 . The client reads a JasperReports design document (.jrxml) into a byte array and sends it to the server. The server then creates a JasperPrint object: InputStream inputStream = new ByteArrayInputStream(reportDesignByteArray); jasperReport = JasperCompileManager.compileReport(inputStream); jasperPrint = JasperFillManager.fillReport(jasperReport, parameter, dataSource); This object is returned to the client via RMI. At this point I am getting the following error (JasperPrint is derived from Serializable though): java.io.EOFException at java.io.ObjectInputStream$BlockDataInputStream.readBoolean(ObjectInputStream.java:2758) at java.io.ObjectInputStream.readBoolean(ObjectInputStream.java:905) at org.jfree.io.SerialUtilities.readStroke(SerialUtilities.java:204) at org.jfree.chart.plot.CategoryPlot.readObject(CategoryPlot.java:5037) 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 java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990) at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:500) at org.jfree.chart.JFreeChart.readObject(JFreeChart.java:1670) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorIm…
has answer: http://stackoverflow.com/a/25205671
score: 0
tagged with: java
tagged with: jfreechart
tagged with: jasper-reports
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25205671

http://stackoverflow.com/a/25190330
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25189027
upvote count: 1
has body: This solution is good because it is simple. Creating a blank text label then setting it at a later point is useless because it will look exactly the same as creating and setting it at the same time. Add this inside if your actionPerformed(). final JLabel label = new JLabel(textFieldVariable.getText()); //Attributes for label here
type: Answer

http://stackoverflow.com/a/25098412
has body: To go over all levels of your layout you'll need to apply recursion: ViewGroup group = (ViewGroup)findViewById(R.id.myrootlayout); setListenerForGroup(group); Where: void setListenerForGroup(ViewGroup group) { int count = group.getChildCount(); &lt;------- more efficient for(int i = 0; i &lt; count; i++) { View v = group.getChildAt(i); if (v instanceof Button) v.setOnClickListener(this); else if (v instanceof ViewGroup) setListenerForGroup((ViewGroup)v); } }
answers question: http://stackoverflow.com/q/25097548
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25097548
type: Answer

http://stackoverflow.com/q/25147565
has comment: http://stackoverflow.com/comment/39147960
has comment: http://stackoverflow.com/comment/39147999
linked to: http://stackoverflow.com/q/438875
type: Question
score: 9
has comment: http://stackoverflow.com/comment/39147607
upvote count: 9
has comment: http://stackoverflow.com/comment/39152628
downvote count: 0
has title: Serializing Java Object without StackOverflowError
tagged with: stack-overflow
has comment: http://stackoverflow.com/comment/39147408
has comment: http://stackoverflow.com/comment/39149382
answer count: 2
has answer: http://stackoverflow.com/a/25148082
has comment: http://stackoverflow.com/comment/39149176
has comment: http://stackoverflow.com/comment/39147923
has comment: http://stackoverflow.com/comment/39147480
favorite count: 0
has comment: http://stackoverflow.com/comment/39149143
tagged with: serialization
has comment: http://stackoverflow.com/comment/39147693
accepted answer: http://stackoverflow.com/a/25148082
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/52307239
has comment: http://stackoverflow.com/comment/39147534
has comment: http://stackoverflow.com/comment/39148392
has body: I have a quite large Java object that represents a graph, with vertices and edges, in memory. Each vertex has an ArrayList of other vertices that it is connected to (and has a HashMap data structure as well for other purposes). The graph can have a few thousand vertices, and many more edges. When trying to serialize the graph using Java's built-in serialization (implements Serializable, etc.), I always run into a StackOverflowError. Setting other attributes of the graph to transient does not help, and nor does setting the stack size to be larger (i.e. -Xss1g or -Xss512m). I would not think that I need to make a custom writeObject method since ArrayList and HashMap already have their own implementations, which are called upon serialization. Is there a way to serialize a large Java object already in memory without getting a StackOverflowError? Here is the stack trace: Exception in thread "main" java.lang.StackOverflowError at java.lang.reflect.Method.invoke(Method.java:575) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:950) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1482) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1413) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1159) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1535) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1413) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1159) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:329) at java.util.ArrayList.writeObject(ArrayList.java:570) at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:9…
has answer: http://stackoverflow.com/a/52307239
has comment: http://stackoverflow.com/comment/39147347
tagged with: java
has comment: http://stackoverflow.com/comment/39149622

http://stackoverflow.com/comment/39246608
type: QuestionComment
score: 2
has text: I suppose that rating would be 5 and that 'particular app' would be your own?
comment on: http://stackoverflow.com/q/25201384
type: Comment

http://stackoverflow.com/a/25076761
type: AcceptedAnswer
type: Answer
has body: A way to do it could be to use Class.forName and load it using the package + name. For example: Class&lt;?&gt; enumElement = Class.forName("com.my.package.Element"); Then if everything is OK you will have the enum. Then with getEnumConstants you can read all constants of the enum (you can check if it's an enum using isEnum if needed): Object[] enumElements = elements.getEnumConstants(); for (Object obj : enumElements) { System.out.println(obj); } You are forced to use Object since you don't know what type it will be (well, you know but you can't access it) And use enumElements[0] to access ELEMENT1 and so on. About your updated question, that's the first thing that comes in my mind: Class&lt;?&gt; enumElement = Class.forName("org.myname.test.Element"); Object[] enumElements = elements.getEnumConstants(); Object element1 = enumElements[0]; ElementProvider elementProvider = ElementProvider.class.getDeclaredConstructor(String.class, enumElement).newInstance("Hello", element1);
accepted answer of: http://stackoverflow.com/q/25076468
downvote count: 0
answers question: http://stackoverflow.com/q/25076468
score: 7
upvote count: 7

http://stackoverflow.com/a/25132779
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25111335
upvote count: 1
has body: Click Open Project Go to %YOUR_GLASSFISH_FOLDER%\docs\firstcup Open examples Note that Java EE SDK comes with Glassfish and NetBeans comes with Glassfish. You need the Glassfish from Java EE SDK. Right-click the firstcup project in the Projects pane and select Build. Now you can create an application based on dukes-age archetype - just follow the instructions in clause 3.2.2.2 of tutorial. In my case it took maybe 10 minutes after step 5 until dukes-age-archetype has appeared in Known Archetypes, so you'll need to be patient.
type: Answer
has comment: http://stackoverflow.com/comment/39322395
has comment: http://stackoverflow.com/comment/39286283

jsf
tags question: http://stackoverflow.com/q/25123335
type: Tag
tags question: http://stackoverflow.com/q/25121694
tags question: http://stackoverflow.com/q/25155736
tags question: http://stackoverflow.com/q/25094051
tags question: http://stackoverflow.com/q/25191664
tags question: http://stackoverflow.com/q/25102397
tags question: http://stackoverflow.com/q/25149607
tags question: http://stackoverflow.com/q/25179139
tag name: jsf
tags question: http://stackoverflow.com/q/25090806
tags question: http://stackoverflow.com/q/25178080
tags question: http://stackoverflow.com/q/25084298
tags question: http://stackoverflow.com/q/25158897
tags question: http://stackoverflow.com/q/25071353
tags question: http://stackoverflow.com/q/25163040

file
type: Tag
tags question: http://stackoverflow.com/q/25120726
tags question: http://stackoverflow.com/q/25100958
tags question: http://stackoverflow.com/q/25120892
tags question: http://stackoverflow.com/q/25120178
tags question: http://stackoverflow.com/q/25099906
tags question: http://stackoverflow.com/q/25090976
tags question: http://stackoverflow.com/q/25194552
tags question: http://stackoverflow.com/q/25137016
tags question: http://stackoverflow.com/q/25113572
tags question: http://stackoverflow.com/q/25083851
tags question: http://stackoverflow.com/q/25094608
tags question: http://stackoverflow.com/q/25104693
tags question: http://stackoverflow.com/q/25178841
tag name: file
tags question: http://stackoverflow.com/q/25140373
tags question: http://stackoverflow.com/q/25208167
tags question: http://stackoverflow.com/q/25101059
tags question: http://stackoverflow.com/q/25172495
tags question: http://stackoverflow.com/q/25082437
tags question: http://stackoverflow.com/q/25100054
tags question: http://stackoverflow.com/q/25102043
tags question: http://stackoverflow.com/q/25177795
tags question: http://stackoverflow.com/q/25211718
tags question: http://stackoverflow.com/q/25201409
tags question: http://stackoverflow.com/q/25166618
tags question: http://stackoverflow.com/q/25094851
tags question: http://stackoverflow.com/q/25210181
tags question: http://stackoverflow.com/q/25108787
tags question: http://stackoverflow.com/q/25076079
tags question: http://stackoverflow.com/q/25104536
tags question: http://stackoverflow.com/q/25139379
tags question: http://stackoverflow.com/q/25120473
tags question: http://stackoverflow.com/q/25163089
tags question: http://stackoverflow.com/q/25209015
tags question: http://stackoverflow.com/q/25187181
tags question: http://stackoverflow.com/q/25117834
tags question: http://stackoverflow.com/q/25128128
tags question: http://stackoverflow.com/q/25108234
tags question: http://stackoverflow.com/q/25078949
tags question: http://stackoverflow.com/q/25223599
tags question: http://stackoverflow.com/q/25161073

http://stackoverflow.com/comment/78042814
type: Comment
has text: 'nonsensical to use a lambda as a Comparable implementation' - why is it nonsensical, please?
score: 0
comment on: http://stackoverflow.com/a/25224517
type: AnswerComment

http://stackoverflow.com/q/25222663
score: 1
tagged with: selenium
upvote count: 1
has comment: http://stackoverflow.com/comment/39303678
type: Question
tagged with: java
has title: what is the technical reason that selenium can not locate and click on client server web element applications
has body: What is the technical reason that selenium can not test client server applications? I can find web element by xpath or id but I get error: Unable to locate element: {"method":"xpath","selector":"//tbody/tr/td[1]"} &lt;tbody&gt; &lt;tr child="yes" grp="grp0"&gt; &lt;td id="30662a_TD_942a4ce9-678f-4152-9a0d-353032" class="menuHeaderMain_menuItem menuItem_selected" valign="middle" nowrap="nowrap" height="20" align="center" onclick="javascript:menus_MenuItemSelected('f9ac9709-7024-42bd-884f-30662a9ed8a5‌​', '942a4ce9-678f-4152-9a0d-35303257b7cb', '4b231bc2-d418-43c0-a4ce-498f58a8ea65'); menus_ShowMenu('MainSubMenu_Incidents', 'Menu_SubMain', 'menu_SubMenu', false)" name="f9ac9709-7024-42bd-884f-30662a9ed8a5_MENU_TD" style="cursor:pointer; padding-left: 10px; padding-right: 10px;"&gt;Ticketing&lt;/td&gt;
has comment: http://stackoverflow.com/comment/39311615
downvote count: 0
has comment: http://stackoverflow.com/comment/39302727
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39287174
tagged with: selenium-webdriver
tagged with: xpath
answer count: 0

http://stackoverflow.com/a/25131096
has body: Ok, this is a great thinking problem that took me a while to get my head around. Going to be tough to guide you through it without giving an answer. Generally people would ask "What code have you tried?". You should be able to write some code that does the permutations for one value of the array and then work your way from there. Starting with some code. perm(int[] start, int step, int[] max, int[] min) Is this what the method signature should look like? You have an array that you start from. How far you 'jump' for each step and each index of the array has a max and min value that needs to be accounted for. I started off by creating a int[] copy of the starting array. We need to copy the original values back when we increment the next index value. It's easy enough to increment the first element in the array. copy[0] += step;. Now we need to do some checking. If that value is greater than max or less than the min, we need to reset that value (copy[position] = start[position];) and increment the next index by the step. Then you will notice some code that loops in terms of logic. We also need to check the value we incremented is within it's bounds. So it is a matter of writing that code in a loop that keeps account of the position in the array that it is working on. Start with small blocks of code that do what you need, work your way up to progressing through the array and dealing with the edge cases (when it goes over max, goes over min, when you have finished processing the array). Happy to answer further questions but you'll need to ask specific ones with examples of code you have so I don't feel like I'm writing the code for you.
type: Answer
answers question: http://stackoverflow.com/q/25130686
score: 0

http://stackoverflow.com/q/25100179
has body: This thing is driving me nuts. I can't seem to get my app to compile correctly. I have added the support libraries in my app by copying the jar files, dropping them into libs folder, right click and adding them as library. I have tried extending ActionBaractivity and nothing still not getting that method recognized. I am using Android studio version 0.8.2. Class import android.app.Activity; import android.os.Bundle; import android.support.v4.widget.DrawerLayout; import android.view.Menu; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class mainActivity extends Activity implements AdapterView.OnItemClickListener { private DrawerLayout drawerLayout; private ListView listView; private String[] navMenuArray; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); navMenuArray = getResources().getStringArray(R.array.navmenu); listView =(ListView) findViewById(R.id.drawerList); listView.setAdapter(new ArrayAdapter&lt;&gt;(this, android.R.layout.simple_expandable_list_item_1, navMenuArray)); listView.setOnItemClickListener(this); } @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { //handles what happens when an item in the menu is clicked Toast.makeText(this,navMenuArray[position]+" was selected", Toast.LENGTH_SHORT).show(); selectItem(position); } public void selectItem(int position){ listView.setItemChecked(position, true); setTitle(navMenuArray[position]); } public void setTitle(String title){ getSupportActionbar().setTitle(title); } } MANIFEST &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/ap…
accepted answer: http://stackoverflow.com/a/25100476
downvote count: 0
answer count: 6
has answer: http://stackoverflow.com/a/65489034
has title: ANDROID: Cannot resolve method getSupportActionBar()
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/25101361
possible better answer: http://stackoverflow.com/a/25100446
has answer: http://stackoverflow.com/a/25100476
has answer: http://stackoverflow.com/a/25100446
score: 13
upvote count: 13
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/64988981
has answer: http://stackoverflow.com/a/31282015
has answer: http://stackoverflow.com/a/39675956
type: Question
has comment: http://stackoverflow.com/comment/39058770

http://stackoverflow.com/comment/39073361
comment on: http://stackoverflow.com/a/25107917
has text: I did but it gives me 126 over and over
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25213900
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39270800
has body: I wanted to set permanent path for OdbcDriver, I have already one path set in classpath variable which is pointing to lib folder of jre so i can not remove that. I tried adding the second path fr OracleDriver using semicolon and tried with colon as well but I am getting a runtime time classNotFoundException: oracle.jdbc.driver.OracleDriver How can I fix this?
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25215665
tagged with: classpath
type: Question
has comment: http://stackoverflow.com/comment/39270938
score: 0
has title: Set multiple classpath in classpath variable
answer count: 1

http://stackoverflow.com/a/25228323
score: 4
has body: Sorry, I just realized I made a silly mistake, the group id in my project pom file and the one on the sonatype repository did not match. Simple to fix but a stupid mistake.
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25228201
downvote count: 0

http://stackoverflow.com/q/25073336
linked to: http://stackoverflow.com/q/2543938
has comment: http://stackoverflow.com/comment/39008402
has comment: http://stackoverflow.com/comment/39008630
has body: simply i want a regex in scala style for mobile number. ex:- +9198989898989 +11234545745892 the total digits including + can be from 6 to 18(i think all valid number lies in between of it) if number match regex returns true else false. type S = String def parseMobile(number:S):Boolean={ val phoneRx = """[+\d() ]{6,18}""" // absolutely wrong regex number.matches(phoneRx) }
has comment: http://stackoverflow.com/comment/39008612
has comment: http://stackoverflow.com/comment/39008493
score: 0
has comment: http://stackoverflow.com/comment/39008465
answer count: 2
tagged with: string
tagged with: scala
has answer: http://stackoverflow.com/a/25073373
tagged with: regex
has comment: http://stackoverflow.com/comment/39008395
type: AnsweredQuestion
has title: regex for simple mobile number(Scala Style)
possible better answer: http://stackoverflow.com/a/25074821
tagged with: java
has answer: http://stackoverflow.com/a/25074821
type: Question
has comment: http://stackoverflow.com/comment/39008537
accepted answer: http://stackoverflow.com/a/25073373

http://stackoverflow.com/q/25171169
type: Question
has title: Java - Why does 0 % 3 return 0?
has comment: http://stackoverflow.com/comment/39191422
tagged with: modulo
downvote count: 9
has body: I recently stumbled across this issue whilst programing. I wonder how this is possible, as modulo returns the remainder of the euclidean division a / b. Doesn't this mean that it would have to return 3 since returning 0 would mean that you have to perform a division by 0, which is impossible? Also, how is this handled in other programming languages? I know that modulo has very varying implementations throughout different languages, but is this a variable aspect or is it set by some mathematical statement?
answer count: 2
has answer: http://stackoverflow.com/a/25171179
favorite count: 0
type: UnansweredQuestion
score: -8
has comment: http://stackoverflow.com/comment/40341799
has comment: http://stackoverflow.com/comment/39191446
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/39191412
upvote count: 1
has answer: http://stackoverflow.com/a/25171217
has comment: http://stackoverflow.com/comment/39191219

http://stackoverflow.com/comment/39284112
type: Comment
type: QuestionComment
has text: It's clearly stated as `ArrayIndexOutOfBoundsException`.
comment on: http://stackoverflow.com/q/25221022
score: 0

http://stackoverflow.com/q/25120334
has answer: http://stackoverflow.com/a/26162258
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40025581
type: Question
tagged with: mongodb
answer count: 2
downvote count: 0
tagged with: morphia
favorite count: 0
has body: I have the following entity: @Entity("platform_defs") class PlatformDef { @Id Long id @Property("name") String name @Property("abbreviation") String abbreviation @Property("type") String type @Property("hg_repo") String hgRepo @Property("port") Long port @Property("status") String status } And the following Morphia code trying to persist an instance of that entity: public void savePlatformDef(PlatformDef pDef) { try { AppConfig config = getConfig(); String dbName = config.getMongo().getDatabaseName(); Mongo mongo = new Mongo(config.getMongo().getHost(), config.getMongo().getPort()); morphia = new Morphia(); datastore = morphia.createDatastore(mongo, dbName); morphia.map(PlatformDef.class); datastore.save(pDef); } catch(Throwable t) { System.out.println(t.getMessage()); } } When I run this I get: java.lang.StackOverflowError Here is the recursive list of calls being made: at org.mongodb.morphia.mapping.EmbeddedMapper(toDBObject:40) at org.mongodb.morphia.mapping.Mapper(writeMappedField:642) at org.mongodb.morphia.mapping.Mapper(toDBObject:544) at org.mongodb.morphia.mapping.Mapper(toDBObject:526) This pattern repeats over and over again... What's wrong with my setup?
type: UnansweredQuestion
has title: Mongo/Morphia StackOverflow error?
upvote count: 1
has answer: http://stackoverflow.com/a/25123369
has comment: http://stackoverflow.com/comment/39096483

http://stackoverflow.com/q/25107690
has title: How do I get the CSS selector of an element with Jsoup?
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39082734
favorite count: 0
has answer: http://stackoverflow.com/a/25107884
type: Question
has body: I have an element extracted from the DOM using JSOUP. I want to get the CSS selector of that element, so I can quickly find the equivalent elements on other pages with the same structure. Is this possible? Thanks
tagged with: java
upvote count: 1
answer count: 1
tagged with: jsoup
type: UnansweredQuestion

http://stackoverflow.com/comment/39216217
type: QuestionComment
has text: In your Vert class firstEdge is always null. Why is that?
score: 0
comment on: http://stackoverflow.com/q/25184769
type: Comment

http://stackoverflow.com/a/25143842
answers question: http://stackoverflow.com/q/25143344
has body: Are you referring to the dialect that is normally configured in DataSource.groovy? If so, this is irrelevant when creating an Sql instance, because the dialect is only used by Hibernate/GORM.
has comment: http://stackoverflow.com/comment/39166899
score: 0
type: Answer

http://stackoverflow.com/comment/39208561
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25157685
has text: That's all very interesting, thanks, but not really answering my question. And as stated, it's just an example. I also don't now all values to compare against at compile time.

http://stackoverflow.com/q/25190938
type: Question
has comment: http://stackoverflow.com/comment/39227522
tagged with: java
score: -1
answer count: 1
favorite count: 0
has body: I have a JFrame which is resizeable. I've added my JTextPane to it, within a JScrollbar. Now I want to fix the width of my JTextPane, in order to when I add new text, if it was longer than width of my JTextPane wrap the text! My JTextPane has a StyledDocument.
has title: Is it possible to set width of the JTextPane?
has answer: http://stackoverflow.com/a/25190983
type: UnansweredQuestion
downvote count: 2
tagged with: jtextpane
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/39275931
comment on: http://stackoverflow.com/q/25215655
has text: Perhaps this will work: Instead of adding junit as a jar file, tell eclipse to add the junit library to the build path.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25093193
accepted answer: http://stackoverflow.com/a/25093339
type: Question
has comment: http://stackoverflow.com/comment/39045892
has comment: http://stackoverflow.com/comment/39045910
has comment: http://stackoverflow.com/comment/39046079
tagged with: while-loop
downvote count: 3
has comment: http://stackoverflow.com/comment/39046194
answer count: 1
has comment: http://stackoverflow.com/comment/39046126
has body: boolean flag = true; while(flag == true){ System.out.println("Type in the item u wish to purchase: chocolate'c',apple'a',meat'm',eggs'e',pencils'p' Bill:'b'"); sign = in.next(); ch = sign.charAt(0); System.out.println("Enter the quantity"); amount = in.nextInt(); if(ch == 'c'){ Item_sel.add("Chocolate"); quantity.add(amount); Stock[0]=Stock[0]-amount; }else if(ch == 'a'){ Item_sel.add("apples"); quantity.add(amount); Stock[1]=Stock[1]-amount; }else if(ch == 'm'){ Item_sel.add("meat"); quantity.add(amount); Stock[2]=Stock[2]-amount; }else if(ch == 'e'){ Item_sel.add("eggs"); quantity.add(amount); Stock[3]=Stock[3]-amount; }else if(ch == 'p'){ Item_sel.add("pencils"); quantity.add(amount); Stock[4]=Stock[4]-amount; } if(ch == 'b'){ String[] myArray = new String[Item_sel.size()]; Item_sel.toArray(myArray); int[] myArray2 = new int[quantity.size()]; quantity.toArray(myArray); change(myArray,myArray2); flag = false; } }
favorite count: 0
score: -3
has title: While loop not ending even with a boolean test applied
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/39045787
tagged with: java
has answer: http://stackoverflow.com/a/25093339

http://stackoverflow.com/q/25223921
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has title: Not sure how to display results in a new activity using Android
has answer: http://stackoverflow.com/a/25224184
accepted answer: http://stackoverflow.com/a/25224184
score: 0
tagged with: android
answer count: 1
linked to: http://stackoverflow.com/q/10158560
tagged with: toast
has body: Hi i have a problem and i am new to android development... i want to display the results in a new activity once the submit button is pressed instead of using the toast feature but i am not sure how i do it, any help would be appreciated. Here is my code: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_system); RadioGroup gender = (RadioGroup) findViewById(R.id.answer1); gender.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { // TODO Auto-generated method stub switch (checkedId) { case R.id.answer1A: ans1 = 1; break; case R.id.answer1B: ans1 = 2; break; } } }); RadioGroup nutrition = (RadioGroup) findViewById(R.id.answer2); nutrition.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { // TODO Auto-generated method stub switch (checkedId) { case R.id.answer2A: ans2 = 1; break; case R.id.answer2B: ans2 = 2; break; } } }); btnSubmitQuiz = (Button) findViewById(R.id.submit); btnSubmitQuiz.setOnClickListener(new OnClickListener() { public void onClick(View v) { // 1 if (ans1 == 1 &amp;&amp; ans2 == 1) { Toast.makeText(SystemActivity .this, "Well done", 5).show(); } else { Toast.makeText(SystemActivity .this, "Fail", 5).show(); } } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.system, menu); return true; } }

http://stackoverflow.com/comment/39118855
type: Comment
type: QuestionComment
has text: `<T, N>` means, that the method has two type parameters, named `T` and `N`.
comment on: http://stackoverflow.com/q/25132499
score: 0

http://stackoverflow.com/a/25097172
downvote count: 0
type: Answer
has body: It depends on how you are integrating with Eclipse. If you are using the project file generation approach, just run gradlew eclipse (or gradlew cleanEclipse eclipse) another time, then hit F5 to refresh the Eclipse project. If you are using the Eclipse plugin (also known as Eclipse Gradle integration), you can only refresh in the IDE, in the way you already described (but perhaps you could assign a shortcut).
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/25095829

http://stackoverflow.com/comment/39152708
type: QuestionComment
has text: Then I wonder what the UI thread is doing in the meantime. Is your UI responsive in the meantime?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25146650

http://stackoverflow.com/a/25211302
has body: Try this: SimpleDateFormat frmt = new SimpleDateFormat("E MMM d HH:mm:ss zZ yyyy", Locale.US); Date dateStr = frmt.parse("Mon Feb 8 00:00:00 UTC+0530 1954");
answers question: http://stackoverflow.com/q/25210882
score: 2
downvote count: 0
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/39417749

http://stackoverflow.com/a/25313104
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25219263
score: 1
answers question: http://stackoverflow.com/q/25219263
has body: Infragistics investigated and found that indeed, this is a bug. They are currently working on a fix. In the meantime, they provided a workaround by putting the grid definition within an AJAX call and this works. //grid2 will initialize correctly $.ajax({ type: "POST", url: '@Url.Action("GetJsonString", "Home")', contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { var result = response; debugger; $("#grid2").igGrid({ autoGenerateColumns: false, dataSource: result, columns: [ { headerText: "ID", key: "id", dataType: "string" }, { headerText: "Name", key: "name", dataType: "string" }, { headerText: "Type", key: "type", dataType: "string" } ], }); }, error: function (response) { } });
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39255379
comment on: http://stackoverflow.com/a/25205615
has text: Well, it seems you keep using a matcher in "thenReturn()" although, as my answer explains, this is invalid.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39166591
score: 0
has text: Bydefault, accesstoken and accessSecret are valid for 6 months. Reconnect can only be used when you tokens are more 150 days old (<180 days) to renew those. If you want to generate accessToken and accessSecret for the first time, then you need to implement 'C2QB' wizard as mentioned here - https://developer.intuit.com/docs/0025_quickbooksapi/0053_auth_auth/widgets. For easy of use, this wizard is implemented in OAuthPlayground tool.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25154007

http://stackoverflow.com/q/25222087
has answer: http://stackoverflow.com/a/25222279
answer count: 4
tagged with: performance
tagged with: java
type: Question
has title: Android - how to prevent UI lag via Handler?
has body: I've got a Handler that runs a runnable task every 2 seconds. It runs a fairly intensive task (executes a shell command). Every time the I run handler.postDelayed(update, 2000); the user interface lags (for 2 seconds). How do I stop this lag? I know there's lag because I have a dynamic interface, so I can move around a view and when the handler is run the interface becomes unresponsive for the 2 seconds. Is there a way to go around this?
has answer: http://stackoverflow.com/a/25222103
score: 0
has comment: http://stackoverflow.com/comment/39285895
has answer: http://stackoverflow.com/a/25222140
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25222102
tagged with: android

http://stackoverflow.com/comment/39038014
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25088872
has text: This would be better as a comment.

http://stackoverflow.com/q/25121787
linked to: http://stackoverflow.com/q/23897335
upvote count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: HashBasedTable in Spring.xml
tagged with: spring
tagged with: guava
answer count: 0
score: 1
tagged with: java
type: Question
has body: I've written successfully to read table in spring.xml as below. <util:map> <util:map> </util:map> <util:map> </util:map> <util:map> </util:map> </util:map> MultiMapToTableConverter.java public class MultiMapToTableConverter { public static Table<String, String, String> createTableFactory(Map<String, Map<String, String>> map) { Table<String, String, String> table = HashBasedTable.create(); for (Map.Entry<String, Map<String, String>> outerEntrySet : map.entrySet()) { for (Map.Entry<String, String> innerEntrySet : outerEntrySet.getValue().entrySet()) { table.put(outerEntrySet.getKey(), innerEntrySet.getKey(), innerEntrySet.getValue()); } } return table; } } MyTest class @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"classpath*:spring-kp-context.xml"}) public class KPTableTest { @Autowired private Table<String, String, String> table; @Test public void kpTest(){ System.out.println(table.get("usa", "alabama")); System.out.println(table.get("in", "karnataka")); System.out.println(table.get("in", "tamil nadu")); } Now I've some question based on the implementation As per below link the answer is downvoted. Is there something wrong. Is there any bottleneck in the implemenation, I know HashBasedTable is unsynced but I don't have any issue. as I know my table is not going to change. From Performance perspective which is better Map<String,Map<String,String>> Vs HashBasedTable. May be this a broader question, however Is there any limitation of HashBasedTable?

http://stackoverflow.com/a/25177439
has comment: http://stackoverflow.com/comment/39215539
has body: Have you thought about just adding your actions to your buttons inside the renderer? public class MyRenderer implements TableCellRenderer { public Component getTableCellRendererComponent( JTable table, Object color, boolean isSelected, boolean hasFocus, int row, int column) { if (some_condition) { JButotn b1 = new JButton('A') b1.addActionListener(new ActionListener() { actionPerformed(ActionEvent e) { //do stuff } } return b1; }else if (some__other_condition) { JButotn b2 = new JButton('B') b2.addActionListener(new ActionListener() { actionPerformed(ActionEvent e) { //do stuff } } return b2; } } } Its probably not the most correct way of doing things performance wise, but without knowing more about your application I can't help much more than that.
answers question: http://stackoverflow.com/q/25177003
upvote count: 0
has comment: http://stackoverflow.com/comment/39214696
type: Answer
score: -1
downvote count: 1

http://stackoverflow.com/a/25208753
has comment: http://stackoverflow.com/comment/39261296
has body: You are missing a closing bracket: //where I believe the problem begins d = input.nextLine(); candidatefour = d; if(candidatefour.contains("go")){ //z by thirds, point .33 if(z&lt;0.33){ System.out.println(candidateone +" has been selected to " +optionch +"."); System.out.println(" "); System.out.println("Thank you for using 'Duty Decider. Have a nice day"); } else if(z&lt;0.66&amp;&amp;z&gt;0.33){ System.out.println(candidatetwo +" has been selected to " +optionch +"."); System.out.println(" "); System.out.println("Thank you for using 'Duty Decider. Have a nice day"); } else if(z&lt;1.00&amp;&amp;z&gt;0.66){ System.out.println(candidatethree +" has been selected to " +optionch +"."); System.out.println(" "); System.out.println("Thank you for using 'Duty Decider. Have a nice day"); } else{ System.out.println(candidatefour +" has been confirmed."); The last two lines should read something like: }else{ System.out.println(candidatefour +" has been confirmed."); As laune pointed out, the bracket is not actually missing but misplaced, so you also have to remove one of the many closing brackets at the end of your program.
has comment: http://stackoverflow.com/comment/39261018
answers question: http://stackoverflow.com/q/25208461
downvote count: 0
has comment: http://stackoverflow.com/comment/39261320
has comment: http://stackoverflow.com/comment/39260837
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39261700
score: 1

http://stackoverflow.com/a/25114763
has body: Make sure that the data type of the arrays. System.arraycopy(bits.getBuffer(),0, data, offset,size); in this line control bits.getBuffer()-type and data-type you passed the primitive data type for first parameter, it must be Object. you say System.arraycopy(bits.getBuffer(),0, data, offset,size); bits.getBuffer() is primitive not a Object.
has comment: http://stackoverflow.com/comment/39085704
has comment: http://stackoverflow.com/comment/39085992
has comment: http://stackoverflow.com/comment/39085929
score: 0
has comment: http://stackoverflow.com/comment/39088460
answers question: http://stackoverflow.com/q/25114626
has comment: http://stackoverflow.com/comment/39085931
has comment: http://stackoverflow.com/comment/39085837
type: Answer

http://stackoverflow.com/comment/39218740
score: 1
type: AnswerComment
has text: @phresnel Maybe not the most pedagogical answer but it's the best I can currently offer. Hopefully it will help people and not confuse them. Thanks for critisism however. I 'll try to be more precise in my future posts.
type: Comment
comment on: http://stackoverflow.com/a/25181723

http://stackoverflow.com/comment/39161375
type: Comment
has text: @isnot2bad What execution path? I'm willing to learn and don't see a problematic path.
comment on: http://stackoverflow.com/a/25154338
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39273959
type: Comment
has text: Use `pr.println(msg);` so that readLine can separate the strings.
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25215595

http://stackoverflow.com/comment/39145633
comment on: http://stackoverflow.com/a/25145824
type: Comment
has text: @ajb: Yes, but that'd be wastefully boxing.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39289388
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25223759
has text: @user3847203 The idea is to **accept the answer** if you get it working. That's the SO way of saying thanks.
type: AnswerComment

http://stackoverflow.com/q/25072547
tagged with: listview
score: 0
answer count: 2
has title: SwipeRefreshLayout only shows one item?
has answer: http://stackoverflow.com/a/31984016
tagged with: android
has body: I've tried implementing a SwipeRefreshLayout for an existing ListView, but whenever I run the program, it only shows one item even when I refresh it by pulling. The refresh animation works, however. Here is the relevant code: items = (ListView)findViewById(R.id.myList); adapter = new Adapter(ctx); adapter.setTextKey("myItem"); //adapter.setImageKey("image"); items.setAdapter(adapter); adapter.loadObjects(); final SwipeRefreshLayout swipeView = (SwipeRefreshLayout) findViewById(R.id.swipe2); swipeView.setEnabled(false); swipeView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { swipeView.setRefreshing(true); ( new Handler()).postDelayed(new Runnable() { @Override public void run() { swipeView.setRefreshing(false); } }, 3000); } }); items.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView absListView, int i) { } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { boolean enable = false; if(items != null &amp;&amp; items.getChildCount() &gt; 0){ // check if the first item of the list is visible boolean firstItemVisible = items.getFirstVisiblePosition() == 0; // check if the top of the first item is visible boolean topOfFirstItemVisible = items.getChildAt(0).getTop() == 0; // enabling or disabling the refresh layout enable = firstItemVisible &amp;&amp; topOfFirstItemVisible; } swipeView.setEnabled(enable); } });
tagged with: swiperefreshlayout
type: UnansweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25072758

http://stackoverflow.com/comment/39308623
comment on: http://stackoverflow.com/q/25224454
score: 0
has text: The `plugin` variable that you are using in your code to access the plugin, you're using the wrong thing as your `plugin`. You're using `Bukkit`, but you should be using `JavaPlugin`. That would fix all the other errors in your code.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25209887
has comment: http://stackoverflow.com/comment/39263492
type: Answer
score: 4
answers question: http://stackoverflow.com/q/25207049
upvote count: 4
has body: Memory limits for test JVMs can be configured via: tasks.withType(Test) { maxHeapSize = "512m" jvmArgs "-XX:MaxPermSize=512m" } It remains to be seen if this solves the problem, though.
accepted answer of: http://stackoverflow.com/q/25207049
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25113363
possible better answer: http://stackoverflow.com/a/25116825
score: 0
has body: autowired annotation doesn't work in java timer task. Please find my code and give solutions. public class MailScheduleTimer extends TimerTask{ @Autowired MailService mailService; @Autowired UserAccountRepository userAccountRepository; Logger logger = Logger.getLogger(MailScheduleTimer.class); @Override public void run() { try { List&lt;UserAccount&gt; userAccounts = userAccountRepository .getUserAccounts(); for (UserAccount userAccount : userAccounts) { if (userAccount.getUserRole().getName() .equals(RolesConstant.USER_ROLE) &amp;&amp; userAccount.getMailStatus().equals("N")) { mailService.sendMail(userAccount.getName(), userAccount.getUserId(), "profile", userAccount.getName()); userAccount.setMailStatus("Y"); userAccountRepository.saveAndFlush(userAccount); } } } catch (Exception e) { logger.error("Unable to Send Mail..." + e); } } }
has answer: http://stackoverflow.com/a/25116825
has answer: http://stackoverflow.com/a/25113417
tagged with: timertask
has answer: http://stackoverflow.com/a/25117502
tagged with: autowired
type: Question
has comment: http://stackoverflow.com/comment/39084650
tagged with: java
answer count: 3
accepted answer: http://stackoverflow.com/a/25117502
has title: Spring @autowired annotation with java TimerTask doesn't work
has comment: http://stackoverflow.com/comment/39083179
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/comment/39070182
score: 0
type: Comment
has text: possible duplicate of [Java: Date from unix timestamp](http://stackoverflow.com/questions/3371326/java-date-from-unix-timestamp) and [this](http://stackoverflow.com/q/12031333/642706) and [this](http://stackoverflow.com/q/535004/642706) and [this](http://stackoverflow.com/q/6687433/642706) and [this](http://stackoverflow.com/q/6687433/642706) and many more.
type: QuestionComment
comment on: http://stackoverflow.com/q/25105816

http://stackoverflow.com/q/25078028
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: maven-assembly-plugin
score: 9
type: Question
has comment: http://stackoverflow.com/comment/77579322
has answer: http://stackoverflow.com/a/25078960
accepted answer: http://stackoverflow.com/a/25078960
tagged with: jar
answer count: 1
favorite count: 0
has body: Can someone please help me in creating a zip target instead of jar in maven. I tried several ways but couldn't progress. Given descriptor file in the assembly path is as follows: zip src/main The assembly plugin section in my pom file is as follows: maven-assembly-plugin src/assembly/descriptor.xml Final Output: [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ sql1 --- [INFO] Building jar: C:\Divakar\mvn_project\sql1\target\sql1-0.1.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS
upvote count: 9
tagged with: http://stackoverflow.com/tag/zip
has title: How to create zip target instead of jar in maven?
tagged with: maven

http://stackoverflow.com/comment/39290837
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25224852
has text: Finally, you say that the code looks "something like" the above. The actual problem could be some "minor detail" in the real code that you've not shown us.

http://stackoverflow.com/comment/39233058
has text: By "each combination of the random_letters", do you mean that the strings in random_letters can be re-ordered to match a word in dict? If so you're looking at a lot of work, depending on the length of strings in random_letters.
score: 0
comment on: http://stackoverflow.com/q/25193504
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39042598
type: Comment
comment on: http://stackoverflow.com/a/25091460
score: 0
type: AnswerComment
has text: ahh thanks got it! For some reason my mind tricked me (as I immediately thought it was --)!

http://stackoverflow.com/q/25157273
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25179560
has title: Connect from Java to Hive using JDBC
upvote count: 25
has body: I'm trying to connect from Java to Hive server 1. I found a question time ago in this forum but it doesn't work for me. I'm using this code: import java.sql.SQLException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.sql.DriverManager; public class HiveJdbcClient { private static String driverName = "org.apache.hive.jdbc.HiveDriver"; /** * @param args * @throws SQLException */ public static void main(String[] args) throws SQLException { try { Class.forName(driverName); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); System.exit(1); } //replace "hive" here with the name of the user the queries should run as Connection con = DriverManager.getConnection("jdbc:hive2://localhost:10000/default", "hive", ""); Statement stmt = con.createStatement(); String tableName = "testHiveDriverTable"; stmt.execute("drop table if exists " + tableName); stmt.execute("create table " + tableName + " (key int, value string)"); // show tables String sql = "show tables '" + tableName + "'"; System.out.println("Running: " + sql); ResultSet res = stmt.executeQuery(sql); if (res.next()) { System.out.println(res.getString(1)); } // describe table sql = "describe " + tableName; System.out.println("Running: " + sql); res = stmt.executeQuery(sql); while (res.next()) { System.out.println(res.getString(1) + "\t" + res.getString(2)); } // load data into table // NOTE: filepath has to be local to the hive server // NOTE: /tmp/a.txt is a ctrl-A separated file with two fields per line String filepath = "/tmp/a.txt"; sql = "load data local inpath '" + filepath + "' into table " + tableName; System.out.println("Running: " + sql); stmt.execute(sql); // select * query sql = "select * from " + tableName; System.out.println("Running: " + sql); res = stmt.executeQuery(sql); while (res.next()) { System.out.println(String.valueOf(res.getInt(1)) + "\t" + res.getString(2)); } // regular hive query sql = "select count(1) fro…
has comment: http://stackoverflow.com/comment/39165051
tagged with: jdbc
possible better answer: http://stackoverflow.com/a/25179560
score: 25
accepted answer: http://stackoverflow.com/a/25157832
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/39935691
tagged with: java
linked to: http://stackoverflow.com/q/8053095
tagged with: hive
type: Question
tagged with: hadoop
answer count: 3
has answer: http://stackoverflow.com/a/25157832

http://stackoverflow.com/a/25105425
has comment: http://stackoverflow.com/comment/39069867
downvote count: 0
has comment: http://stackoverflow.com/comment/39068696
has comment: http://stackoverflow.com/comment/39068239
answers question: http://stackoverflow.com/q/25105406
has comment: http://stackoverflow.com/comment/39068555
upvote count: 2
has body: That is one of the famous design patters in java - Singleton Class. You can refer to the Wiki on the same. Also it does not led to infinite recurssive stack usage because constructor is private - you can never create a new instance of the class with new operator. Also the translator variable is just declared and is not initialized (in the constructor). Also you have a null check in getInstance() method which will ensure that the constructor is run only once in a JVM instance. There will be only one instance of the class in JVM under normal circumstances.
type: Answer
has comment: http://stackoverflow.com/comment/39068227
score: 2

http://stackoverflow.com/comment/39096362
comment on: http://stackoverflow.com/q/25119447
score: 0
type: Comment
type: QuestionComment
has text: Interesting, unlikely ideas: Date between backticks (suddenly reserved word), official ISO standard '2014-08-04T14:46:15.000' (via setString), maybe newer driver (!), forgotten `p.close()`, `i.getDate()` not a pure getter, configuration flags for NySQL. _What happens in the MySQL console for that statement?_

http://stackoverflow.com/a/25232452
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25230007
accepted answer of: http://stackoverflow.com/q/25230007
score: 0
has comment: http://stackoverflow.com/comment/39369761
has body: First, I would not have gone from XML to HTML to PDF when you could have just as easily changed that XSL to product XSL FO. That said, here's a fiddle showing you your HTML can go to PDF just fine (and actually uses your HTML and converts it back to XSL FO with css styling intact). http://jsfiddle.net/m35q1d9w/ function printMe() { xepOnline.Formatter.Format('print_me', {pageWidth:"11in", pageHeight:"8in"}); Push the print button. It prints the div whose ID is 'print_me' which surrounds your table and heading. You should take more time to clean up the HTML. I added thead element to at least give you repeating headers at page breaks. And you could add css to that table to vastly improve the appearance. This uses css-to-pdf on GitHub which supports the language you desire and also your use of entities like iacute.

http://stackoverflow.com/q/25210908
tagged with: mysql
type: Question
tagged with: jpa
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/39265465
has body: I could use JPA in a sample Java project. This is how it looked like: I use a MySQL database. I connect to it with Hibernate 4.3.5. The project tree: I imported these .jar files: (It contains the Hibernate 4.3.5 .jar files and the mysql-connector-java-5.1.29-bin.jar) This is the persistence.xml: <?xml version="1.0" encoding="UTF-8"?> org.hibernate.ejb.HibernatePersistence <property name="hibernate.show_sql" value="true" /> <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" /> <property name="javax.persistence.jdbc.url" value="jdbc:mysql://127.0.0.1:3306/mintaalkalmazas2"/> <property name="javax.persistence.jdbc.user" value="root" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.hbm2ddl.auto" value="update"/> This is a part of a class which would I save to a table (Kerdes.java): ... @Entity @Table(name="kerdes") public class Kerdes { @Id @GeneratedValue(strategy=GenerationType.AUTO) private int id; @Column private int feladatlapID; @Column private String kerdes; @Column private int tipus; @Column private int sorszam; @Column private String valasz; ... I run my application with my Main.java file. This is a part of it: static EntityManagerFactory emf = Persistence.createEntityManagerFactory("DB"); static EntityManager em = emf.createEntityManager(); public static void main(String[] args) { try { em.getTransaction().begin(); insert(); select(); update(); delete(); em.getTransaction().commit(); } catch (Exception e) { em.getTransaction().rollback(); e.printStackTrace(); } finally{ emf.close(); } System.out.println("It is over"); } And this is running fine. I tried to make the same in a GWT application. I would connect to the same database and I want to do the same. I generated the project with sample code and I added my methods to the server. This is the project tree: I added the same jar files like before (Hibernate 4.3.5. jar files and mysql-connector jar) I use the same persistence.x…
answer count: 1
has comment: http://stackoverflow.com/comment/39520430
linked to: http://stackoverflow.com/q/2841657
upvote count: 2
type: UnansweredQuestion
has title: How can I connect to a MySQL database with JPA (Hibernate) in a GWT project?
has answer: http://stackoverflow.com/a/25212031
tagged with: gwt
score: 2
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/39170973
comment on: http://stackoverflow.com/a/25160738
type: Comment
score: 0
type: AnswerComment
has text: For that, equals and hashcode needs to implement. I just provide the way to count the occurrences.

http://stackoverflow.com/comment/39154544
type: QuestionComment
has text: Thank you Bryce, keeping the session open made it last much longer, but now instead of running for 30 seconds or so, it runs for 2 or 3 minutes.
score: 0
comment on: http://stackoverflow.com/q/25145980
type: Comment

http://stackoverflow.com/q/25212343
tagged with: java
possible better answer: http://stackoverflow.com/a/38825129
has title: Search Dialogue not activated when onSearchRequested is called (Android)
has answer: http://stackoverflow.com/a/38825129
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25212487
has comment: http://stackoverflow.com/comment/39267692
type: Question
has comment: http://stackoverflow.com/comment/39268037
accepted answer: http://stackoverflow.com/a/25212487
tagged with: android
has comment: http://stackoverflow.com/comment/39267670
has comment: http://stackoverflow.com/comment/39267919
has comment: http://stackoverflow.com/comment/39267626
has body: Beginner working on an android app and I'm trying to start a searchable activity when the onSearchRequested method is called after a button push in the main activity. Currently, when the button is pressed, nothing happens. Here's MainActivity.Java: package com.example.activity2; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button1 = (Button) findViewById(R.id.button1); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onSearchRequested(); } }); } /** Called when the user clicks the Send button */ // public void sendMessage(View view) // { // } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } Here's the manifest: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> <action android:name="android.intent.action.SEARCH" /> <action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.FLAG_ACTIVITY_NEW_TASK" /> <meta-data android:name="android.app.default_searchable" android:value="com.example.activity2.SearchActivity" /> <category android:name="android.intent.category.LAU…
score: 0
answer count: 2

http://stackoverflow.com/q/25163928
tagged with: signals-slots
accepted answer: http://stackoverflow.com/a/25224272
answer count: 3
has body: I have an android app that gets unread Facebook notifications and Inbox. The application has to be done in QT, but I barely know QT C++ , so I developed the app in java and just call the java class from QT using JNI. This is working ok, but the thing is I need to send a slot (in QT side) every time there is a new Facebook notification/message. So my question is: every minute, How do I notify QT from Java that I have a new message and send the string? This is my java code: MAIN CLASS: public class MainActivity extends FragmentActivity { ... static public void startFacebookActivity() { String msgTag = "FACEBOOK_APP"; try { Activity mother = QtNative.activity(); Intent intent = new Intent(mother, MainActivity.class); mother.startActivity(intent); } catch (Exception e) { Log.e(msgTag, e.toString()); e.printStackTrace(); } } } FRAGMENT CLASS (Every minute verifies if there's a new facebook message , if so , It is suppose to notify QT and send the message so QT is able to send a slot ) private static native void publishNotification(String notification); .... if (newNotification==true) publishNotification(responseNotification); ... QT side facebookAndroid.cpp #include "facebookAndroid.h" #include &lt;QtAndroidExtras&gt; FacebookAndroid* FacebookAndroid::s_instance = 0; FacebookAndroid::FacebookAndroid(QObject *parent) : QObject(parent) { s_instance = this;} void FacebookAndroid::startAndroidFacebook() { QAndroidJniObject::callStaticMethod&lt;void&gt;("org.qtproject.example.MainActivity", "startFacebookActivity", "()V"); } FacebookAndroid* FacebookAndroid::instance() { return s_instance; } static void publishNotification(JNIEnv *env, jclass /*clazz*/, jstring notification) { const char* nativeString = env-&gt;GetStringUTFChars(notification, 0); FacebookAndroid::instance()-&gt;handleNewNotification(QString(nativeString)); } static JNINativeMethod methods[] = { {"publishNotification", "(Ljava/lang/String;)V", (void *)publishNotification} }; jint JNICALL JNI_OnLoad(JavaVM *vm,…
possible better answer: http://stackoverflow.com/a/25307287
favorite count: 0
has answer: http://stackoverflow.com/a/25307287
has comment: http://stackoverflow.com/comment/39307958
has answer: http://stackoverflow.com/a/25314155
has title: Passing strings from java to c++ using JNI
tagged with: qt
tagged with: c++
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25224272
tagged with: java
score: 7
upvote count: 7
type: Question
tagged with: java-native-interface
downvote count: 0

http://stackoverflow.com/comment/39089802
has text: nobody can help you without seeing your code
score: 0
comment on: http://stackoverflow.com/q/25116916
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25126242
answers question: http://stackoverflow.com/q/25125848
score: 3
has body: The best way to switch JPanels is to use a CardLayout (tutorial). If done correctly, this will work whether your GUI is a JFrame, JDialog, JApplet,... et. Your NullPointerException likely has nothing to do with your swapping views. To debug this will require more information on your part. It is likely due to your image variable being null, perhaps due to trying to read it in as a File rather than as a resource.
downvote count: 0
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25125848
type: Answer

http://stackoverflow.com/q/25207823
has title: Faster way to specify character array filling?
has answer: http://stackoverflow.com/a/25207970
has answer: http://stackoverflow.com/a/25207863
tagged with: char
answer count: 3
has comment: http://stackoverflow.com/comment/39259143
upvote count: 1
has comment: http://stackoverflow.com/comment/39259129
favorite count: 0
has answer: http://stackoverflow.com/a/25207922
type: UnansweredQuestion
score: -3
downvote count: 4
tagged with: java
type: Question
tagged with: arrays
has body: import java.util.Arrays; public class ArraySpecification { public static void main(String args[]) { char[] correctLetters = {'a','b','c','d','e'}; Arrays.fill(correctLetters, 0, 1, 'z'); Arrays.fill(correctLetters, 2, 3, 'z'); Arrays.fill(correctLetters, 4, 5, 'z'); System.out.println(correctLetters); } } I just wanted to ask if there is any way this can be done faster and more efficient?
has comment: http://stackoverflow.com/comment/39259124

http://stackoverflow.com/q/25079795
has comment: http://stackoverflow.com/comment/39020417
answer count: 1
has comment: http://stackoverflow.com/comment/39055363
has title: How to fix java.lang.NoClassDefFoundError
favorite count: 0
has comment: http://stackoverflow.com/comment/137391125
has body: Hi guys in my code i am making a new object of com.google.api.client.json.JsonFactory as final static JsonFactory JSON_FACTORY = new JacksonFactory(); And when i run my program in debug mode, after executing this line . Compiler gives an exception i.e. run: java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonFactory at com.google.api.client.json.jackson2.JacksonFactory.&lt;init&gt;(JacksonFactory.java:45) at googleauthtest.GoogleAuthTest.&lt;clinit&gt;(GoogleAuthTest.java:25) Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonFactory 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:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 2 more Exception in thread "main" Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds) How can I fix this problem ? Thanks in Advance The above problem has been fixed . Now I am got stuck in another problem and I know these problems are coming due to version incompatibility. So can anyone please tell me that what dependencies are their to integrate YouTube data API V3 with java wrapper. I am using service account for authentication. Below is my java code.. package googleauthtest; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.services.youtube.YouTube; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class Authentication { final static HttpTransport TRANSPORT = new NetHttp…
has comment: http://stackoverflow.com/comment/39020209
type: Question
score: -1
has comment: http://stackoverflow.com/comment/39020755
has comment: http://stackoverflow.com/comment/39054749
has comment: http://stackoverflow.com/comment/39020227
has comment: http://stackoverflow.com/comment/39020350
tagged with: java
downvote count: 2
tagged with: oauth-2.0
has answer: http://stackoverflow.com/a/25112755
upvote count: 1
has comment: http://stackoverflow.com/comment/39020608
linked to: http://stackoverflow.com/q/17973970
tagged with: google-api-java-client
has comment: http://stackoverflow.com/comment/39054889
type: UnansweredQuestion

http://stackoverflow.com/q/25156129
has answer: http://stackoverflow.com/a/25171529
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/56305427
tagged with: email-client
tagged with: gmail
tagged with: java
has body: I was just working on an email program that read emails from Gmail and does further processing. Initially using the code provide in SO(link provided below) I was getting an exception which says that "My access has been blocked and I need to login via web browser". On the same time I saw an email in inbox (to which I am trying to connect) which says that "Google Account: sign-in attempt blocked" and I need to disable modern security from following link "https://www.google.com/settings/security/lesssecureapps". I tried to disable and I was succesfully connected. So does it means that Javamail is a less secure application? Or there are ways by which I can still connect without disabling the option? Thanks in advance. Garry [Code I used:]
type: Question
score: 5
upvote count: 5
downvote count: 0
linked to: http://stackoverflow.com/q/13137405
has title: Is javamail a less secure application?
tagged with: jakarta-mail
tagged with: email
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/39193993
comment on: http://stackoverflow.com/q/25172655
score: 0
type: Comment
type: QuestionComment
has text: Maybe it prevents NPEs by convincing the runtime that no, really, this reference isn't null. ;)

http://stackoverflow.com/q/25141321
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39135636
has comment: http://stackoverflow.com/comment/39138267
tagged with: java
has body: Hi i am using Oracle DB to store string on Varchar2 column, with using eclipselink my code is here, pdescription = new String(this.description.getBytes("ISO-8859-9")); sometimes its ok but, somtimes it only question marks, like that it is taken "door" or "????" I have column that is also string there is problem with that, their types are same both varchar2
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/39135662
tagged with: varchar2
tagged with: string
has title: String char-set in Java and Oracle DB
score: 0
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/39135194
answer count: 0

http://stackoverflow.com/q/25092093
score: 0
tagged with: java
answer count: 1
tagged with: ilog
has title: what is the difference between technical rule and function in ILOG JRules?
has body: Could anyone explain what is the actual difference between technical rule and function in ILOG JRULES ? . As far as i have seen, what ever we can achieve in function can also be achieved in technical rule. What's the exact difference ? Regards, Vinoth Kumar T
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25124217
type: Question
tagged with: jrules
tagged with: rule-engine
tagged with: rule

http://stackoverflow.com/q/25087965
has answer: http://stackoverflow.com/a/25088031
type: Question
tagged with: jakarta-ee
tagged with: jpa
tagged with: entity
score: 0
has body: Within an Entity class, can I have any object as an attribute and when I persist the Entity to the database will it also persist that objects attributes?
answer count: 1
accepted answer: http://stackoverflow.com/a/25088031
tagged with: object
type: AnsweredQuestion
tagged with: java
has title: persisting object to database with ORM

http://stackoverflow.com/q/25095943
score: -3
downvote count: 3
tagged with: java
has body: I've tried the following code to retrieve an image stored in the oracle database with BLOB datatype. Upon running it in apace tomcat7 server i could only see an image icon(may be a broken image) but not an image. When I tried to open the image icon it got downloaded. I opened the downloaded image using picasa but it displayed "invalid image". PLEASE try solving my problem....!! public class RetrieveInkblot extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { Blob photo = null; Connection conn = null; Statement stmt = null; ResultSet rs = null; String query = "select img from inkblots where bid = 23"; ServletOutputStream out = response.getOutputStream(); try { Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "system", "manager"); out.println("Connection"); stmt = conn.createStatement(); rs = stmt.executeQuery(query); if (rs == null) { out.print("null except"); } else if (rs.next()) { photo = rs.getBlob(1); } else { response.setContentType("text/html"); out.println(" Person Photo "); out.println(" No photo found for id= 001 "); return; } byte[] imgData = photo.getBytes(1, (int) photo.length()); response.setContentType("image/jpg"); OutputStream o = response.getOutputStream(); o.write(imgData); o.flush(); o.close(); } catch (Exception e) { response.setContentType("text/html"); out.println(" Error: Person Photo "); out.println(" Error=" + e.getMessage() + " "); return; } } }
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/39050847
upvote count: 0
answer count: 1
tagged with: database
has title: how to store and retrieve a jpg image in oracle database using BLOB datatype in java
favorite count: 0
has answer: http://stackoverflow.com/a/25096150
type: UnansweredQuestion

http://stackoverflow.com/q/25094637
score: 2
type: AnsweredQuestion
tagged with: download
upvote count: 2
type: Question
has body: I am trying to download something an attachment behind a javascript button with HtmlUnit. Performing other tasks works great (eg. navigating, login). I checked out the attachment unit test but it didnt help me. final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_24); final HtmlPage page1 = webClient.getPage( loginUrl ); final HtmlTextInput textField = page1.getElementByName(user); final HtmlPasswordInput pwd = page1.getElementByName(pwd); textField.setValueAttribute(User.getUsername()); pwd.setValueAttribute(User.getPassword()); final HtmlSubmitInput button = page1.getElementByName(login); final HtmlPage page2 = button.click(); String buttonJavaScript = "window.location='"+folder+filename + ....... "; ScriptResult result = page2.executeJavaScript(buttonJavaScript); webClient.waitForBackgroundJavaScript(2000); InputStream is = result.getNewPage().getWebResponse().getContentAsStream(); try { File f = new File("filename.extension"); OutputStream os = new FileOutputStream(f); byte[] bytes = new byte[1024]; while (read == is.read(bytes)) { os.write(bytes, 0, read); } os.close(); is.close(); } catch (IOException ex) { // Exception handling } However, it stops with: runtimeError: message=[No node attached to this object] sourceName=[http://pagead2.googlesyndication.com/pagead/osd.js] line=[7] lineSource=[null] lineOffset=[0] The file created is size 0. There must be a way to get to the real file attached?! Thank you in advance
tagged with: attachment
tagged with: java
has title: downloading files behind javascript button with htmlunit
tagged with: htmlunit
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25137173
favorite count: 0
accepted answer: http://stackoverflow.com/a/25137173

datepicker
tags question: http://stackoverflow.com/q/25185066
tags question: http://stackoverflow.com/q/25214559
tag name: datepicker
type: Tag
tags question: http://stackoverflow.com/q/25173184
tags question: http://stackoverflow.com/q/25128457

http://stackoverflow.com/comment/39120601
has text: You didn't need to go through all this. A quick glance at the documentation for [`Double`](http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html) shows that `.valueOf(long)` doesn't even exist. The case is implicit and `.valueOf(double)` is called. So regardless of how it compiles, `.valueOf` here is either equivalent to or worse than an explicit cast.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25133325

http://stackoverflow.com/a/27497473
answers question: http://stackoverflow.com/q/25094583
score: -3
type: Answer
upvote count: 0
downvote count: 3
has body: Try this from the Eclipse marketplace 1. Click Help>Eclipse marketPlace (Eclipse marketPlace dialog box will open) 2. Type the name of your plugin (ex: type SWT Designer) in the find edit box, make sure to keep default values for All markets and all categories, and click go button. 3. The page will refresh and display all plugins that have swt designer in their name. 4. Click intsall or update button on the one that fits your needs. 5. The installation or update will be done successfully. 6. Restart your eclipse 7. The installation will be fine.

http://stackoverflow.com/q/25182560
has answer: http://stackoverflow.com/a/25182672
tagged with: java
tagged with: jpanel
type: Question
possible better answer: http://stackoverflow.com/a/25182672
has answer: http://stackoverflow.com/a/25184892
answer count: 2
has comment: http://stackoverflow.com/comment/39215619
has comment: http://stackoverflow.com/comment/39214619
tagged with: user-interface
has title: Having trouble using external JPanel with JTabbed pane
has comment: http://stackoverflow.com/comment/39215121
tagged with: jtabbedpane
has body: I'm learning to create a GUI in school. I have made these 2 separate JPanels. Im trying to create a tabbed pane that adds includes each of these in seeparate tabs. When I open run the code I get three separate windows. One is a window with 2 blank tabs. The other 2 windows are the panels that I want to be inside each tab. Could someone please help me. package Week4; import java.awt.*; import javax.swing.*; public class TabP2 { private JFrame ourFrame = new JFrame("Week 4"); private JTabbedPane ourTabbedPane; private JPanel masterContainer, tab1, tab2; TabP2(){ masterContainer = (JPanel) ourFrame.getContentPane(); masterContainer.setLayout(new BorderLayout()); ourTabbedPane = new JTabbedPane(); tab1 = new OfficeAreaCalculator(); tab2 = new DayGUI(); ourTabbedPane.addTab("Office Area Calculator", tab1); ourTabbedPane.addTab("DayGUI", tab2); masterContainer.add(ourTabbedPane, BorderLayout.CENTER); ourFrame.pack(); ourFrame.setVisible(true); ourFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String[] args){ SwingUtilities.invokeLater(new Runnable() { public void run() { new TabP2(); } }); } } and package Week4; import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import java.awt.*; public class DayGUI2 extends JPanel{ private JButton cmdGood; private JButton cmdBad; public DayGUI2(){ cmdGood = new JButton("Good"); cmdBad = new JButton("Bad"); setBackground(Color.white); add(cmdGood); cmdGood.setBackground(Color.green); add(cmdBad); cmdBad.setBackground(Color.red); cmdGood.setMnemonic('G'); cmdBad.setMnemonic('B'); ButtonsHandler bhandler = new ButtonsHandler(); cmdGood.addActionListener(bhandler); cmdBad.addActionListener(bhandler); setVisible(true); } class ButtonsHandler implement…
has comment: http://stackoverflow.com/comment/39211092
accepted answer: http://stackoverflow.com/a/25184892
score: 0
has comment: http://stackoverflow.com/comment/39213416
has comment: http://stackoverflow.com/comment/39214727
has comment: http://stackoverflow.com/comment/39213353
type: AnsweredQuestion

http://stackoverflow.com/comment/39044743
score: 1
has text: The last paragraph is confusing/incorrect. Passing objects to a function in java **is not** like passing objects by reference in C++.
type: AnswerComment
comment on: http://stackoverflow.com/a/25092333
type: Comment

http://stackoverflow.com/comment/80115352
score: 0
type: Comment
has text: Can you help on this issue ? https://github.com/EsotericSoftware/kryonet/issues/134#issuecomment-333369190
comment on: http://stackoverflow.com/a/25593263
type: AnswerComment

http://stackoverflow.com/q/25092904
tagged with: java
type: Question
has body: here is what the problem arises and here is the code that gives problem private void formMouseClicked(java.awt.event.MouseEvent evt) { int x;`` int y; if (check == true) { x = evt.getX(); xcod1 = x; y = evt.getY(); ycod1 = y; check = false; } else { x = evt.getX(); xcod2 = x; y = evt.getY(); ycod2 = y; check = true; } System.out.println(xcod1+" "+xcod2+" "+ycod1+" "+ycod2); } @SuppressWarnings("null") private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { Graphics g = null;`` g.drawLine(xcod1, ycod1, xcod2, ycod2); }
has answer: http://stackoverflow.com/a/25092921
answer count: 2
downvote count: 3
favorite count: 0
has title: Exception in thread "AWT-EventQueue-0"NullPointerException
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/25092935
upvote count: 0

http://stackoverflow.com/comment/39665596
type: QuestionComment
comment on: http://stackoverflow.com/q/25124773
score: 0
type: Comment
has text: Unfortunately I don't have any examples :/

http://stackoverflow.com/a/25126182
type: Answer
answers question: http://stackoverflow.com/q/25126020
has body: There are a couple of problems with your current implementation - you can only have a kill list of 25 entries, and your loop won't kill the right entries because you are iterating through every entry in the kill array, not every other one. It will null entries at (x1, y1), (y1, x2), (x2, y2) etc. The best way to do this is create a coordinate object like this: class Coordinate { int x; int y; } Then store a set of these, and iterate through them. The set is unbounded so this will support a huge kill list.
score: 0

http://stackoverflow.com/comment/39278597
type: QuestionComment
comment on: http://stackoverflow.com/q/25218174
score: 1
has text: can you paste your pom.xml?
type: Comment

http://stackoverflow.com/comment/39095001
has text: Best if your code is a [minimal complete runnable example](http://stackoverflow.com/help/mcve).
comment on: http://stackoverflow.com/q/25119477
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/q/25080678
accepted answer: http://stackoverflow.com/a/25080750
has title: JAppet loading images
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
tagged with: japplet
answer count: 1
has answer: http://stackoverflow.com/a/25080750
tagged with: initialization
tagged with: static
has body: I made a game using JFrame, and now I want to deploy it in JApplet, yet I get the following exception: java.lang.ExceptionInInitializerError As much as Google told me it is caused by static initializers, and the only thing I do in my static initialization blocks is call to the following function: public static BufferedImage[] loadAnimation (String fileName, int subimagewidth, int subimageheight, int pixelsbetweensprites) { BufferedImage spr = null; BufferedImage[] animation; int x, y; //amount of images in each direction try { Object ob = new Object(); spr = ImageIO.read(ob.getClass().getResourceAsStream(fileName)); } catch (IOException ex) { System.exit(0); Logger.getLogger(AnimationLoader.class.getName()).log(Level.SEVERE, null, ex); } x = spr.getWidth() / subimagewidth; y = spr.getHeight() / subimageheight; animation = new BufferedImage[x*y]; for (int i = 0; i &lt; x; i++) { for (int j = 0; j &lt; y; j++) { animation[j*x+i] = spr.getSubimage(i*(subimagewidth + pixelsbetweensprites), j*(subimageheight+pixelsbetweensprites), subimagewidth, subimageheight); } } return animation; } Is this problem occurs because it is JApplet, or because it is unsigned? How to fix it (preferably without spending money on signature)?
tagged with: java-2d

http://stackoverflow.com/comment/39121550
score: 0
type: Comment
has text: I edited the code and question, now do you have an idea, what is the mistake, thanks
type: AnswerComment
comment on: http://stackoverflow.com/a/25121330

http://stackoverflow.com/a/25298212
answers question: http://stackoverflow.com/q/25187446
downvote count: 0
has body: The following actions do not cause a class to be loaded: Referring to a static final primitive field that is known at compile time. classLoader.getResource(className.replace('.', '/') + ".class") The following cause a class to be loaded (i.e., the .class file is parsed, and a Class&lt;?&gt; object is created): Any line of code that refers to the class symbolically e.g. Foo.class Class.forName(String, false, ClassLoader) ClassLoader.loadClass(String) Loading a subclass or array of the class, or initializing a class whose code or method signatures refer to the class. The following cause a class to be initialized (i.e., the static blocks are executed): Constructing a new instance Calling a static method Getting or setting a static field that is not a compile-time constant. Class.forName(String, true, ClassLoader) and Class.forName(String) If you do initialize the class from multiple ClassLoaders, the static blocks are indeed executed multiple times. For example, the following code: import java.net.URL; import java.net.URLClassLoader; public class InitializeClassMultipleTimes { static class Foo { static { System.out.format(" %s initialized by %s%n", Foo.class.getSimpleName(), Foo.class.getClassLoader()); } public static void foo() {} } private static Class&lt;Foo&gt; loadClass() { System.out.println("Loading class."); // Load the .class file. This will fail if the class file is gone or has // the wrong file format. return Foo.class; } private static void initializeClass(Class&lt;?&gt; innerClass) { System.out.println("Initializing class"); try { Class.forName(innerClass.getName(), true, innerClass.getClassLoader()); } catch (ClassNotFoundException e) { throw new IllegalStateException(e); } } public static void main(String... argv) throws ClassNotFoundException { Class&lt;Foo&gt; fooClass = loadClass(); initializeClass(fooClass); URLClassLoader myClassLoader = ((URLClassLoader) InitializeClassMultipleTimes.class.getClassLoader()); URL[] urls = myClassLoader.getURLs(); fo…
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/25190446
answers question: http://stackoverflow.com/q/25190213
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39226608
accepted answer of: http://stackoverflow.com/q/25190213
type: Answer
has body: First of all, why do you have: location.setLocation(2, 10); add(location); inside your for loop? No values are changing. (Unless you're still working on it) Second of all, you need to setBounds for the JLabel as well for it to appear. I just put: location.setBounds(100,100,100,100); and it appears. If you change the location.setLocation(2, 10); in the first part to location.setLocation(loc, 10); the JLabel will move.

http://stackoverflow.com/comment/41668307
score: 0
type: AnswerComment
type: Comment
has text: I suppose all I/O is blocking on some level, in the hardware if not in the software. Whether you call it blocking depends on what API is presented to you, i.e., whether it blocks *your* threads. If the I/O is non-blocking *outside* the API, it's because it's been made asynchronous on some level *inside* the API. That's why it's redundant to say "non-blocking async I/O." Non-blocking and async imply each other.
comment on: http://stackoverflow.com/a/25100342

http://stackoverflow.com/a/25230162
has body: To be able to use java -version in a command prompt and have Java 8 as the result, the Java 8's bin directory must be in the PATH environment variable, before the other directories where java.exe exists (so, for example, at the very beginning of the PATH. In IntelliJ IDEA, you have to open File - Project structure and under SDKs, make sure the 1.8 SDK is selected and not 1.7. If 1.8 isn't listed, then click the + icon at the top and add it under Project, make sure the project SDK is 1.8, and the project language level is 8.0.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25230033
accepted answer of: http://stackoverflow.com/q/25230033
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25225933
type: Question
has answer: http://stackoverflow.com/a/25226133
has comment: http://stackoverflow.com/comment/39293048
answer count: 1
has title: single activity with multiple xml file
tagged with: android
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39292656
has comment: http://stackoverflow.com/comment/39292685
tagged with: java
downvote count: 3
score: -1
has body: how to create single activity and multiple xml file for that activity? button click from main activity should should display different button in next activity(which has multiple xml file) when i click different button. I created different xml file but how to link that with java?

http://stackoverflow.com/a/25225310
answers question: http://stackoverflow.com/q/25215320
has body: The best approach is to create simple immutable value container classes (too bad we do not have scala support, you could just use case classes :P), eg public final class StringHolder { private final String s; StringHolder(final String s) { this.s = Preconditions.checkNotNull(s, "null string input"); } public String get() { return s; } @Override public String toString() { return "StringHolder{" + "s='" + s + '\'' + '}'; } // hashCode and equals are optional @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final StringHolder that = (StringHolder) o; return s.equals(that.s); } @Override public int hashCode() { return s.hashCode(); } } The null check is optional, you may choose to allow nulls though in that case, you can even introduce a factory method and always return the same NullStringHolder instance in case of null inputs, which is leaner as it doesn't really have to hold data, just hardcore it to return null in get(). It would only make a difference if you happen to expect tons of nulls as a valid response (which is probably questionable). Hope this helps!
score: 0
type: Answer

http://stackoverflow.com/comment/39186951
type: QuestionComment
comment on: http://stackoverflow.com/q/25168922
score: 0
has text: I find the Google Groups to be more responsive that SO to general Scala-IDE questions: https://groups.google.com/forum/#!forum/scala-ide-user
type: Comment

http://stackoverflow.com/a/25203665
type: AcceptedAnswer
has body: I suppose the valid json is like { "took": 4, "timed_out": false, "hits": { "total": 14, "max_score": 1, "hits": [ { "_index": "someIndex", "_source": { "id": "de", "title": "something 1" } }, { "_index": "someIndex", "_source": { "id": "def", "title": "something 1" } } ] } } If so you can get it as ObjectMapper mapper = new ObjectMapper(); JsonNode data = mapper.readTree(json); data.findValues("_source"); // [{"id":"de","title":"something 1"}, {"id":"def","title":"something 1"}] //If you want to convert it to custom object List&lt;Source&gt; sources = mapper.convertValue(data.findValues("_source"), new TypeReference&lt;List&lt;Source&gt;&gt;() {});
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25203429
accepted answer of: http://stackoverflow.com/q/25203429
has comment: http://stackoverflow.com/comment/39253189
upvote count: 2
has comment: http://stackoverflow.com/comment/39253588

wikipedia-api
tag name: wikipedia-api
tags question: http://stackoverflow.com/q/25103754
type: Tag

http://stackoverflow.com/a/25139553
has comment: http://stackoverflow.com/comment/39132620
has body: Do all parts of the path exist? So in your example: /u01/app/webapps/out/pj/Create.xlsx Do all subdirectories exist? /u01/app/webapps/out/pj If not, than trying to write there might fail with a FileNotFoundException. You should create the directories with Files.creatDirectories(Path) first.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/39131883
has comment: http://stackoverflow.com/comment/39133121
has comment: http://stackoverflow.com/comment/39156637
has comment: http://stackoverflow.com/comment/39238485
answers question: http://stackoverflow.com/q/25139379
has comment: http://stackoverflow.com/comment/39132022

http://stackoverflow.com/a/25178349
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25178180
answers question: http://stackoverflow.com/q/25178180
type: Answer
has body: In the Apache Derby documentation for triggers you can find everything you asked for.
score: 3
downvote count: 0
upvote count: 3

insert
tags question: http://stackoverflow.com/q/25229597
tags question: http://stackoverflow.com/q/25071705
tag name: insert
tags question: http://stackoverflow.com/q/25221617
tags question: http://stackoverflow.com/q/25191992
tags question: http://stackoverflow.com/q/25183948
type: Tag
tags question: http://stackoverflow.com/q/25225970

http://stackoverflow.com/comment/39244077
score: 1
has text: FYI you need to do `new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS)`
type: AnswerComment
comment on: http://stackoverflow.com/a/25199822
type: Comment

http://stackoverflow.com/a/25086568
answers question: http://stackoverflow.com/q/25085910
has comment: http://stackoverflow.com/comment/39034105
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/39034533
has comment: http://stackoverflow.com/comment/39034540
has comment: http://stackoverflow.com/comment/39034592
has comment: http://stackoverflow.com/comment/39034317
has body: i have found some little errors in your implementation. I tried it with my own list, although i'm not totally sure, if it fulfits your Format. Here's my list: 2 1000 2 2 1001 1 3 I adapted your code a little bit, but the style can easily be better. But you can do this afterwards. I commented out parts of your implementation, so that you can easily see the change. number = scanFile.nextInt(); //number *= 3; partNumb = new int[number]; // Set partNumb[] Size = to count qoh = new int[number]; // Set qoh[] Size = to count reorder = new int[number]; // Set reorder[] Size = to count count = number; number = 0; //while (countAt &lt; (count * 3)) { while (countAt &lt; (count * 3)) { //if(number == 0) // Number 0 = partNumb[] if (countAt%3 == 0) // Number 0 = partNumb[] { number = scanFile.nextInt(); partNumb[index] = number; index++; //number++; countAt++; //else if(number == 1) //Number 1 = qoh[] } else if (countAt%3 == 1) // Number 1 = qoh[] { number = scanFile.nextInt(); qoh[index2] = number; index2++; //number++; countAt++; //else if(number == 2) //Number 2 = reorder[] } else if (countAt%3 == 2) // Number 2 = reorder[] { number = scanFile.nextInt(); reorder[index3] = number; index3++; //number = 0; countAt++; } } System.out.println("Data Loaded to Arrays"); // Confirmation of Data // Acceptance. // Reset all Counter &amp; Index Variables for use with next Loop. index = 0; index2 = 0; index3 = 0; countAt = 0; number = 0; //number2 = 0; //while(countAt &lt; (count * 3)) while (countAt &lt; (count)) { System.out.println(partNumb[index]); // Print All Values in the // partNumb[] Array. index++; countAt++; } // ----END PROGRAM // -----////////////////////////////////////////////////////////////// } The test shows the correct output, if my file is correct: Enter the Inventory File Name. C:\Users\Markus\Desktop\test.txt File Loaded. Data Loaded to Arrays 1000 1001 I hope this will help you with your implementation. Sincerely, Max

http://stackoverflow.com/comment/39209923
has text: Okay, I was just wondering if the package content is different between the two versions. Another possibility is that the static class initializer is failing, and the exception gets swallowed and wrapped as a NCDFE.
type: Comment
comment on: http://stackoverflow.com/q/25178582
score: 0
type: QuestionComment

http://stackoverflow.com/a/25201413
type: Answer
answers question: http://stackoverflow.com/q/25201304
has comment: http://stackoverflow.com/comment/107766373
upvote count: 5
score: 5
downvote count: 0
has body: In principle, you could just multiply it by 100000, convert it to int, then subtract -32,767 and convert it to short. If that still puts it in the -32,767 to 32,767 range for all your values, that's likely the best you can do. Otherwise, you'll have to limit your precision and multiply by 10000. And when you use the short of course you have to remember to divide it back down.
has comment: http://stackoverflow.com/comment/39293600

http://stackoverflow.com/comment/39023553
type: Comment
score: 2
has text: If it's sorted and you already output in descending order... you can just reverse the order in which you access the array. `for (int i = nInputs - 1; i >=0; i--)`
comment on: http://stackoverflow.com/q/25081506
type: QuestionComment

user-interface
tags question: http://stackoverflow.com/q/25108870
tags question: http://stackoverflow.com/q/25140342
tags question: http://stackoverflow.com/q/25225312
tags question: http://stackoverflow.com/q/25104536
tags question: http://stackoverflow.com/q/25110588
tags question: http://stackoverflow.com/q/25224288
tags question: http://stackoverflow.com/q/25118642
tags question: http://stackoverflow.com/q/25205883
tags question: http://stackoverflow.com/q/25100023
tags question: http://stackoverflow.com/q/25125563
tags question: http://stackoverflow.com/q/25091384
type: Tag
tags question: http://stackoverflow.com/q/25101415
tags question: http://stackoverflow.com/q/25186959
tags question: http://stackoverflow.com/q/25150915
tags question: http://stackoverflow.com/q/25090821
tags question: http://stackoverflow.com/q/25182560
tags question: http://stackoverflow.com/q/25105330
tags question: http://stackoverflow.com/q/25113274
tags question: http://stackoverflow.com/q/25167378
tags question: http://stackoverflow.com/q/25188925
tags question: http://stackoverflow.com/q/25092575
tags question: http://stackoverflow.com/q/25103538
tags question: http://stackoverflow.com/q/25150488
tags question: http://stackoverflow.com/q/25098557
tags question: http://stackoverflow.com/q/25223254
tags question: http://stackoverflow.com/q/25134298
tags question: http://stackoverflow.com/q/25107945
tags question: http://stackoverflow.com/q/25228843
tags question: http://stackoverflow.com/q/25169545
tags question: http://stackoverflow.com/q/25197408
tags question: http://stackoverflow.com/q/25215386
tags question: http://stackoverflow.com/q/25130495
tags question: http://stackoverflow.com/q/25087807
tags question: http://stackoverflow.com/q/25098247
tags question: http://stackoverflow.com/q/25179319
tags question: http://stackoverflow.com/q/25095578
tags question: http://stackoverflow.com/q/25214658
tags question: http://stackoverflow.com/q/25100366
tags question: http://stackoverflow.com/q/25214074
tags question: http://stackoverflow.com/q/25131827
tags question: http://stackoverflow.com/q/25119211
tags question: http://stackoverflow.com/q/25154064
tags question: http://stackoverflow.com/q/25205201
tag name: user-interface
tags question: http://stackoverflow.com/q/25130608
tags question: http://stackoverflow.com/q/25105415
tags question: http://stackoverflow.com/q/25229499
tags question: http://stackoverflow.com/q/25179705
tags question: http://stackoverflow.com/q/25224124
tags question: http://stackoverflow.com/q/25177003
tags question: http://stackoverflow.com/q/25150646
tags question: http://stackoverflow.com/q/25073661

http://stackoverflow.com/q/25218836
has comment: http://stackoverflow.com/comment/39279811
has answer: http://stackoverflow.com/a/25218859
type: AnsweredQuestion
has title: Smallest number with digits product of n
has comment: http://stackoverflow.com/comment/39286904
has comment: http://stackoverflow.com/comment/39280478
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25219056
linked to: http://stackoverflow.com/q/21403720
has answer: http://stackoverflow.com/a/25218946
accepted answer: http://stackoverflow.com/a/25219056
answer count: 6
has comment: http://stackoverflow.com/comment/39279872
possible better answer: http://stackoverflow.com/a/25218859
score: 0
has answer: http://stackoverflow.com/a/25218960
has answer: http://stackoverflow.com/a/25220121
has comment: http://stackoverflow.com/comment/39279962
has comment: http://stackoverflow.com/comment/39280559
has body: I need to find the smallest number which digit numbers product is equal to a given num. import java.util.Scanner; class timus_1014_2 { public static void main(String[] args){ int[] arr = new int[10]; // eskan ban@ chem imanum inchi a statik, int prod = 1; int j = 0; Scanner in = new Scanner(System.in); int n = in.nextInt(); for (int i = 2; i &lt; 10; ++i){ if (n % i == 0) { arr[j] = i; j++; } } prod = prod * arr[j]; System.out.print(prod); } } Something is wrong with the logic, whats is the problem when I input 10 it should give 25 but it gives 0. Please give ideas of how to make a program find a number which digits product is a given num.
has answer: http://stackoverflow.com/a/25219776
has comment: http://stackoverflow.com/comment/39279884

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/25134263
tags question: http://stackoverflow.com/q/25163586
type: Tag
tags question: http://stackoverflow.com/q/25159195

http://stackoverflow.com/comment/39415609
type: AnswerComment
score: 0
type: Comment
has text: great! this was indeed part of my problem
comment on: http://stackoverflow.com/a/25233972

http://stackoverflow.com/a/25071151
has body: Try resp.sendRedirect("login"); Details: If the location is relative without a leading '/' the container interprets it as relative to the current request URI. If the location is relative with a leading '/' the container interprets it as relative to the servlet container root. If the location is relative with two leading '/' the container interprets it as a network-path reference (see RFC 3986: Uniform Resource Identifier (URI): Generic Syntax).
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25070639

http://stackoverflow.com/a/25149297
accepted answer of: http://stackoverflow.com/q/25149087
type: Answer
answers question: http://stackoverflow.com/q/25149087
has body: The method isDuplicated does not use parameter i! Actually I think it always returns True. Replacing the entire code of the function by return p2Shingles.contains(i) should be enough.
upvote count: 1
has comment: http://stackoverflow.com/comment/39150566
has comment: http://stackoverflow.com/comment/39151756
score: 1
has comment: http://stackoverflow.com/comment/39150559
has comment: http://stackoverflow.com/comment/39151037
has comment: http://stackoverflow.com/comment/39150537
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39151416

http://stackoverflow.com/a/25167734
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/39280291
has body: You can have the column name whatever you want. @PrimaryKeyJoinColumn annotation is used to tell hibernate what is the name of the foreign key column in the joining table. @Entity @Table(name = "manager") @PrimaryKeyJoinColumn(name = "employee_id") public class Manager extends Employee{ private String branch; } This code means that in manager table you have a column named employee_id which is a foreign key for employee table. This annotation is optional so if you don't provide it then the foreign key column name will of same as the key name in the base class(super base if multilevel inheritance), in your case if you don't provide then any subclass will have person_id as the foreign key. If you want to keep the field name as employee_id in manager table then you have to provide like this. @PrimaryKeyJoinColumn(name="employee_id") if you don't provide this annotation at all then there will be a column name person_id to be used as foreign key for employee table. Here's what documentation says. This annotation specifies a primary key column that is used as a foreign key to join to another table. It is used to join the primary table of an entity subclass in the JOINED mapping strategy to the primary table of its superclass; it is used within a SecondaryTable annotation to join a secondary table to a primary table; and it may be used in a OneToOne mapping in which the primary key of the referencing entity is used as a foreign key to the referenced entity. If no PrimaryKeyJoinColumn annotation is specified for a subclass in the JOINED mapping strategy, the foreign key columns are assumed to have the same names as the primary key columns of the primary table of the superclass Edit The query being executed by Hibernate when I try to retrieve manager by id. select manager0_.id as id1_4_0_, manager0_2_.name as name2_4_0_, manager0_1_.employee_id as employee1_1_0_, manager0_1_.salary as salary2_1_0_, manager0_.branch as branch1_2_0_ from manager manager0_ inner join employee ma…
type: Answer
answers question: http://stackoverflow.com/q/25145697
has comment: http://stackoverflow.com/comment/39286508
score: 5

http://stackoverflow.com/comment/39186577
score: 1
has text: I was able to fix the issue by deleting the following folder **org.eclipse.e4.workbench** from .metadata\.plugins. I appreciate your help though :)
type: AnswerComment
comment on: http://stackoverflow.com/a/25168501
type: Comment

http://stackoverflow.com/q/25143096
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39139767
type: Question
score: 0
has body: I have three Java Class, A which is the parent and B & C are subclasses of A. I have a Hibernate mapping file for A where I have mapped B & C using joined-subclass. Now when I try to query C I get [Ljava.lang.Object; cannot be cast to A. The query that Hibernate generates is correct but why it is not allowing the casting to A? I have tried the following queries, both result in the same error. session.createQuery("from Request as req inner join req.category where req.class=Externalrequest and req.requestId=:id"); session.createQuery("from ExternalRequest as ereq inner join ereq.category where ereq.requestId=:id"); Where Request is the parent class and ExternalRequest & InternalRequest are the child class. And here is the basic structure of my mapping file <?xml version="1.0"?> <hibernate-mapping> <column name="request_id" /> request_request_id_seq <many-to-one name="category" column="category" class="RequestCategory" /> <key column="request_id"/> ......... <key column="request_id"/> .......
tagged with: casting
has comment: http://stackoverflow.com/comment/39140189
answer count: 1
tagged with: inheritance
has answer: http://stackoverflow.com/a/25144191
has comment: http://stackoverflow.com/comment/39140124
has title: Hibernate subclass query : Java.lang.object cannot be cast to, ERROR
has comment: http://stackoverflow.com/comment/39139942
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25144191

http://stackoverflow.com/q/25155696
upvote count: 5
has comment: http://stackoverflow.com/comment/84418331
downvote count: 0
has comment: http://stackoverflow.com/comment/84420370
has comment: http://stackoverflow.com/comment/84420025
favorite count: 0
has comment: http://stackoverflow.com/comment/39743531
tagged with: eclipse-rcp
tagged with: powermock
type: UnansweredQuestion
has title: UnsatisfiedLinkError with PowerMockito and SWT on running a test suite
has comment: http://stackoverflow.com/comment/39876254
answer count: 0
has comment: http://stackoverflow.com/comment/92468993
tagged with: java
has body: I'm writing unit test with JUnit and PowerMockito for classes in a Eclipse RCP application. If I run every test as stand-alone, everything works fine. But when I group the test to a TestSuite, all tests fail with this error: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: no swt-win32-3836 in java.library.path no swt-win32 in java.library.path Native Library C:\Users\franzm\.swt\lib\win32\x86_64\swt-win32-3836.dll already loaded in another classloader Can't load library: C:\Users\franzm\.swt\lib\win32\x86_64\swt-win32.dll at org.eclipse.swt.internal.Library.loadLibrary(Library.java:331) at org.eclipse.swt.internal.Library.loadLibrary(Library.java:240) at org.eclipse.swt.internal.C.&lt;clinit&gt;(C.java:21) at org.eclipse.swt.widgets.Widget.&lt;clinit&gt;(Widget.java:103) at com.example.app.client.ui.filters.FilterDtoUtil.formatDateFormat(FilterDtoUtil.java:325) at com.example.app.client.ui.filters.FilterDtoUtil.getMarketVariantsProductionSitesWithDates(FilterDtoUtil.java:358) at com.example.app.client.ui.filters.factories.FilterContributor.getFilterRow(FilterContributor.java:566) at com.example.app.client.ui.filters.factories.AbstractBigFilterFactory.getFilterRow(AbstractBigFilterFactory.java:59) at com.example.app.client.ui.excelexport.AbstractExcelTest.before(AbstractExcelTest.java:73) 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.junit.internal.runners.MethodRoadie.runBefores(MethodRoadie.java:132) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:95) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:294) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMo…
tagged with: swt
tagged with: unit-testing
type: Question
linked to: http://stackoverflow.com/q/16832078
score: 5

http://stackoverflow.com/q/25158851
answer count: 1
has answer: http://stackoverflow.com/a/27892809
type: UnansweredQuestion
tagged with: java
has body: I can't run vertx module for eclipse project on windows 7 I have followed the instructions here: http://vertx.io/gradle_dev.html download the template https://github.com/vert-x/vertx-gradle-template run the tests cd vertx-gradle-template-master gradlew.bat test BUILD SUCCESSFUL setup the ide gradlew.bat eclipse BUILD SUCCESSFUL trying to run module gradlew.bat runMod I got this: :collectDeps UP-TO-DATE :runMod Module directory build\mods\com.mycompany~my-module~1.0.0-final already exists. Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties. Deprecated dynamic property: "args" on "task ':runMod'", value: "[runmod, com.mycompany...". Building 50% &gt; :runMod What I should do with this? I don't understand.
tagged with: gradle
type: Question
has title: Cant run vertx module for eclipse project on windows 7
tagged with: eclipse
score: 0
tagged with: vert.x

http://stackoverflow.com/a/25143200
accepted answer of: http://stackoverflow.com/q/25143120
has body: You don't have to throw any caught exception, you can log them very easily like this: try { myMethodThatThrows(); } catch (Exception e) { Crashlytics.logException(e); // handle your exception here! } Source: http://support.crashlytics.com/knowledgebase/articles/202805-logging-caught-exceptions
type: AcceptedAnswer
upvote count: 10
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25143120
score: 10

http://stackoverflow.com/a/25119999
has comment: http://stackoverflow.com/comment/39096004
has comment: http://stackoverflow.com/comment/39095973
accepted answer of: http://stackoverflow.com/q/25119957
has comment: http://stackoverflow.com/comment/39096164
type: Answer
score: 3
downvote count: 0
type: AcceptedAnswer
upvote count: 3
answers question: http://stackoverflow.com/q/25119957
has body: PersistenceException has sub-classes which you can catch separately, such as : EntityExistsException EntityNotFoundException NonUniqueResultException NoResultException OptimisticLockException RollbackException TransactionRequiredException Catch whichever one of them you care about separately, before catching PersistenceException. For example : try { .... } catch (EntityExistsException exception) { .... } catch (PersistenceException exception) { .... } EntityExistsException is probably the exception you want to catch to find out when the object you try to persist already exists : Thrown by the persistence provider when EntityManager.persist(Object) is called and the entity already exists.

http://stackoverflow.com/a/25091880
has body: Nothing wrong with having same property name with different value but getProperty(String key) can not differentiate between them as it will return the first value. Secondly you can not access nested property directly.Right now here getProperty will return whole String including {} as value because that's what your value contains.You may get value and perform some operations to fetch values from that whole String.Because property file should have only key=value format means left hand side should be key and right hand side should be value.That's it. If you want to store values as you have specified in your code you should go for JSON format than you can store whole JSON data to file and get it back from the file while you want to use it.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25091818
downvote count: 0

http://stackoverflow.com/q/25081842
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/25088014
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/39024243
has body: I have 3 activities that require a Json to show data, the second activity get the values from the main activity based on its ID, I need to pass that Json to each one of them so it can receive the data, How can I pass it through intent to another activity? I'm very new to android development, I've read some questions related to this case, but I didn't understand it very well. public void updateList() { feedListView= (ListView) findViewById(R.id.custom_list); feedListView.setVisibility(View.VISIBLE); progressbar.setVisibility(View.GONE); feedListView.setAdapter(new CustomListAdapter(this, feedList)); feedListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; a, View v, int position, long id) { TextView clienteId = (TextView) v.findViewById(R.id.clienteId); System.out.println("Clicou " + clienteId.getText()); int idCliente = Integer.valueOf(String.valueOf(clienteId.getText())); for(int x=0; x&lt;feedList.size(); x++) { if(feedList.get(x).getId_rm() == idCliente) { ArrayList&lt;ClientesContatosModel&gt; contatosDoCliente = new ArrayList&lt;ClientesContatosModel&gt;(); System.out.println(feedList.get(x).getNome() + " tem " + feedList.get(x).getContatos().size() + " contatos"); if(feedList.get(x).getContatos().size() &gt; 0) { System.out.println("Valor de x " + x); for(int y=0; y&lt;feedList.get(x).getContatos().size(); y++) { ClientesContatosModel mClientesContatosModel = new ClientesContatosModel(); mClientesContatosModel.setNomeContato(feedList.get(x).getContatos().get(y).getNomeContato() ); mClientesContatosModel.setCargo(feedList.get(x).getContatos().get(y).getCargo()); contatosDoCliente.add(mClientesContatosModel); } } Intent intent = new Intent(FeedListActivity.this, FeedDetailsActivity.class); intent.putExtra("data", contatosDoCliente); startActivity(intent); } } } }); } Parse Json: public void parseJson(JSONObject json) throws JSONException { try { JSONArray dados = json.getJSONArray("dados")…
favorite count: 0
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/39024297
has answer: http://stackoverflow.com/a/25087469
accepted answer: http://stackoverflow.com/a/25087469
possible better answer: http://stackoverflow.com/a/25088014
has comment: http://stackoverflow.com/comment/39024375
has title: How to parse a Json to another activity
tagged with: android-intent
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/25209833
score: 1
has comment: http://stackoverflow.com/comment/39263291
has comment: http://stackoverflow.com/comment/39263084
has comment: http://stackoverflow.com/comment/39263387
downvote count: 0
has comment: http://stackoverflow.com/comment/39294977
has comment: http://stackoverflow.com/comment/39263257
answers question: http://stackoverflow.com/q/25209788
has body: If you just want to put them in by the second index. (edited to allow multiple per index): List&lt;Pair&gt;[][] matrix = new LinkedList&lt;Pair&gt;[5][5]; //Replace 5 here a getter for the maximum value of A //Here it's 5 because the max of your example is 4. //Initialize all positions of matrix to empty list. for (int r = 0; r &lt; matrix.length; r++){ for(int c = 0; c &lt; matrix[r].length; c++){ matrix[r][c] = new LinkedList&lt;Pair&gt;(); } } for (Pair p : patternList){ if (matrix[p.second][p.second] == null) matrix[p.second][p.second] = new LinkedList&lt;Pair&gt;(); matrix[p.second][p.second].add(p); } This isn't really using the 2d aspect of the array though; you could accomplish exactly the same thing with a 1d array of lists: List&lt;Pair&gt;[] arr = new LinkedList&lt;Pair&gt;[5]; //Replace 5 here a getter for the maximum value of A //Here it's 5 because the max of your example is 4. //Initialize all positions of array to empty list. for (int r = 0; r &lt; matrix.length; r++){ arr[r] = new LinkedList&lt;Pair&gt;(); } for (Pair p : patternList){ if (arr[p.second] == null) arr[p.second] = new LinkedList&lt;Pair&gt;(); arr[p.second].add(p); }
has comment: http://stackoverflow.com/comment/39263762
type: Answer
has comment: http://stackoverflow.com/comment/39262870
has comment: http://stackoverflow.com/comment/39262985
has comment: http://stackoverflow.com/comment/39263061
upvote count: 1
has comment: http://stackoverflow.com/comment/39263459

vb6
type: Tag
tags question: http://stackoverflow.com/q/25101994
tag name: vb6

http://stackoverflow.com/q/25117276
has answer: http://stackoverflow.com/a/25119909
tagged with: java
linked to: http://stackoverflow.com/q/18737774
type: Question
score: 0
tagged with: jvm-hotspot
has body: I am starting to develop with google app engine. Does google change the default size of MaxInlineSize ? Can I set jvm options with google app engine ? Looked in the obvious place, could not find an answer : https://developers.google.com/appengine/docs/java/ edit App engine questions never attract much attention.
answer count: 1
has title: the default MaxInlineSize for java methods is 35 bytes of bytecode
tagged with: jvm
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: jvm-arguments
has comment: http://stackoverflow.com/comment/39212176

http://stackoverflow.com/comment/39092288
comment on: http://stackoverflow.com/a/25095116
score: 0
type: AnswerComment
type: Comment
has text: The "openConnection" method is a bit misleading. It does not actually establish the connection. That can occur at the earliest when you start writing content to the request body (but even then only if you set chunked or fixed length streaming mode). By default the actual connection occurs when you ask for something about the response (such as the InputStream or response code).

http://stackoverflow.com/q/25170395
accepted answer: http://stackoverflow.com/a/25170770
has comment: http://stackoverflow.com/comment/39189805
has comment: http://stackoverflow.com/comment/39189711
has comment: http://stackoverflow.com/comment/39189646
type: AnsweredQuestion
tagged with: java
has body: The app I'm building is for playing videos, but it needs the ability to download the videos so they can be watched when the user is not connected to the internet. Whenever my phone downloads a file it goes to the phone's downloads folder, but I want the downloaded file to only be able to be accessed from the app. Can someone point me in the right direction? All my searches lead to apps for downloading videos.
type: Question
has title: Android restricting downloaded files to app
has comment: http://stackoverflow.com/comment/39190495
has comment: http://stackoverflow.com/comment/39189911
has comment: http://stackoverflow.com/comment/39189687
has answer: http://stackoverflow.com/a/64096820
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/64096820
has answer: http://stackoverflow.com/a/25170770
has comment: http://stackoverflow.com/comment/39189742
tagged with: android

http://stackoverflow.com/a/25072660
has comment: http://stackoverflow.com/comment/39007755
has comment: http://stackoverflow.com/comment/39007768
has comment: http://stackoverflow.com/comment/39007479
has comment: http://stackoverflow.com/comment/39007968
has comment: http://stackoverflow.com/comment/39007261
answers question: http://stackoverflow.com/q/25072442
type: Answer
has comment: http://stackoverflow.com/comment/39007548
has body: Your code is very sloppy and is missing semi-colons and closing brackets. And your loop can be simplified a lot, although your method CAN work, you are making it much harder than it should be. try this code: String str = getIpAddress(); String [] arrayOfString = editText.getText().toString().split(","); for (int i = 0; i &lt; arrayOfString.length; i++) { if (str.substring(0,arrayOfString[i].length()).equals(arrayOfString[i])) { addMessage("Success! Your IP address is " + str); break; } else { //not found addMessage("Retrying") } }
score: 0

http://stackoverflow.com/comment/39211234
score: 0
comment on: http://stackoverflow.com/q/25180785
has text: @opensourcegeek I imagine that this has to do with [this](http://docs.jboss.org/hibernate/core/3.3/reference/en/html/collections.html#collections-indexed). Hibernate has use of positions of elements in a List - using an index column. As it helpfully states - if you wish to use List semantics but do not have an index column - use a bag
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39262080
score: 1
comment on: http://stackoverflow.com/a/25209166
has text: When i try this the code looks for the methods called(that reside in the version class) in their super class... they don't exist there
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25071900
type: Question
upvote count: 2
has body: I have an ear file that will have root deployments (deploy configuration), lib deployments (earlibs configuration) and an additional custom utilJars configuration that I want to place in a utilJars folder at the root of the ear. I am aware that the first two configurations are automatically handled by the Ear task. How can I add an additional CopySpec to the Ear task (or any AbstractCopyTask for that matter) to handle the third configuration?
answer count: 1
has answer: http://stackoverflow.com/a/25072004
accepted answer: http://stackoverflow.com/a/25072004
has title: multiple copyspecs in a single copytask in gradle (nested copyspecs)
favorite count: 0
tagged with: groovy
downvote count: 0
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: gradle

overloading
tags question: http://stackoverflow.com/q/25101977
tags question: http://stackoverflow.com/q/25200248
type: Tag
tag name: overloading
tags question: http://stackoverflow.com/q/25077800

http://stackoverflow.com/comment/39130694
has text: Its giving an exception : `java.lang.IndexOutOfBoundsException: setSpan (0 ... 9) ends beyond length 1`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25138542
type: AnswerComment

http://stackoverflow.com/q/25205584
tagged with: java
tagged with: hibernate
has body: I have an abstact class A public abctract class A{} and 2 implementing classes B and C public class B extends A{ private String bProperty; private String b2Property; } public class C extends A{ private String cProperty; } There is no relation in database between bProperty,b2Property and cProperty, but in my grid on ui they need to be displayed in the same column (concatenated for B). What is more in my grid I have paging in which I need eg. 25 results on each page. To achive that I need to sort my entities by the following order bProperty, cProperty, b2Property. Is there any way to create criteria for class A, and still be able to define ordering based on the mentioned fields and avoid org.hibernate.QueryException: could not resolve property: bProperty of: A?
type: Question
has title: Hibernate order by property from extending entity
tagged with: criteria
downvote count: 0
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: hibernate-criteria
tagged with: criteria-api
upvote count: 1
score: 1

ftp
tags question: http://stackoverflow.com/q/25113849
type: Tag
tag name: ftp
tags question: http://stackoverflow.com/q/25163910

swiperefreshlayout
type: Tag
tag name: swiperefreshlayout
tags question: http://stackoverflow.com/q/25072547

http://stackoverflow.com/q/25089796
tagged with: android
tagged with: android-studio
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/32921456
has answer: http://stackoverflow.com/a/25089955
type: Question
tagged with: libgdx
answer count: 3
downvote count: 0
has title: Touched Project Structure now the project cannot find any packages
favorite count: 0
has body: I just ruined my android project. I touched the Project structure added a dependency (for gdx-tools). There weren't any dependencies before. Now Gradle cannot find find any libraries. Error:(32, 0) Gradle: A problem occurred evaluating project ':android'. &gt; Could not resolve all dependencies for configuration ':android:natives'. &gt; A problem occurred configuring project ':core'. &gt; Could not open buildscript class cache for build file '..\build.gradle' (..\.gradle\caches\1.11\scripts\build_5nf261mprglcnmchu7kvpoddt6\ProjectScript\buildscript). &gt; Timeout waiting to lock buildscript class cache for build file '..\core\build.gradle' (..\.gradle\caches\1.11\scripts\build_5nf261mprglcnmchu7kvpoddt6\ProjectScript\buildscript). It is currently in use by another Gradle instance. Owner PID: unknown Our PID: 3732 Owner Operation: unknown Our operation: Initialize cache Lock file: ..\.gradle\caches\1.11\scripts\build_5nf261mprglcnmchu7kvpoddt6\ProjectScript\buildscript\cache.properties.lock Anyone knows how to fix this, without generating a new project?
has answer: http://stackoverflow.com/a/25477516
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/39203638
has text: Someone already did it, accept @user3218114's answer :)
type: QuestionComment
comment on: http://stackoverflow.com/q/25178318
score: 0
type: Comment

http://stackoverflow.com/q/25185746
type: AnsweredQuestion
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39257096
tagged with: java
tagged with: selenium
type: Question
tagged with: selendroid
has title: Stop adb screenrecord from java
has comment: http://stackoverflow.com/comment/62945310
has answer: http://stackoverflow.com/a/25209363
has body: I'm using Selendroid in order to test my app. At the beginning of each test I run adb shell screenrecord with the following function: public static Process startScreenRecord(String fileName) throws IOException{ ProcessBuilder builder = new ProcessBuilder( "cmd.exe", "/c", "cd C:\\Users\\user\\Downloads\\adt-bundle-windows-x86_64-20140702\\adt-bundle-windows-x86_64-20140702\\sdk\\platform-tools\\ &amp;&amp; adb shell screenrecord /sdcard/" + fileName); builder.redirectErrorStream(true); Process p = builder.start(); return p; } The recording is starting and everything looks OK. At the end of each test I try to stop the record via the following code: public static void stopScreenRecord(Process p) throws IOException{ p.destroy(); } And in the test I use the following structure: Process p = CmdHelper.startScreenRecord("e1.mp4"); //TestCode CmdHelper.stopScreenRecord(p); The problem is that the video recording doesn't stop. How can I stop the call recording at the end of each test?
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/39221357
accepted answer: http://stackoverflow.com/a/25209363
tagged with: android

http://stackoverflow.com/comment/39246547
type: Comment
has text: Can you open console on Chrome when on your GWT page with this script injected and type infoString and press enter. Can you share that output here.
type: AnswerComment
comment on: http://stackoverflow.com/a/25198326
score: 0

http://stackoverflow.com/comment/39098385
score: 2
type: Comment
type: QuestionComment
has text: Please show us the code. Please...We will get some idea, if you show us your code.
comment on: http://stackoverflow.com/q/25121520

http://stackoverflow.com/a/25128983
has comment: http://stackoverflow.com/comment/39113061
accepted answer of: http://stackoverflow.com/q/25128894
has comment: http://stackoverflow.com/comment/39112930
answers question: http://stackoverflow.com/q/25128894
has comment: http://stackoverflow.com/comment/39113022
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39113013
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39112937
downvote count: 1
has body: What I would do is first implement the method Octagon.clone() by creating an Octagon with the same side length Public Octagon clone(){ return new Octagon(this.side); } In Driver have it clone your newly created Octagon and compare the two (older and newer) with something like this: String cloneComparison = "Clone Comparision: "; if ( older.getArea() == newer.getArea() ){ cloneComparison = cloneComparison + "Equal"; } else { cloneComparison = cloneComparison + "Not Equal"; } System.println(cloneComparison); Which also returns the correct string depending on the result.
type: Answer
has comment: http://stackoverflow.com/comment/39113695
has comment: http://stackoverflow.com/comment/39113233
has comment: http://stackoverflow.com/comment/39112872

http://stackoverflow.com/comment/39170724
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25160738
has text: Wow, what an amazing solution :). Good job
score: 0

http://stackoverflow.com/a/25175883
has body: Could you show how you've configured CACHE_JOURNALS? You've enabled logging on SSM to see put command when invoking cache.put. Can you do the same for @Cacheable? Let's see under what key this object is stored in cache. If you want to update element in cache you don't have to use SSM classes. You can use Spring annotation @CachePut.
answers question: http://stackoverflow.com/q/25161609
score: 0
has comment: http://stackoverflow.com/comment/39220046
type: Answer

http://stackoverflow.com/q/25190531
has body: I am trying to create a simple program to read emails in my company's MS Exchange inbox. I wrote a simle program as below, but it does not work. Can someone guide me, what is wrong here? I tried both with Autodiscovery and URL mode. When I run the program I see the following output: 111111111111111 Aug 08, 2014 12:37:12 AM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme INFO: NTLM authentication scheme selected Aug 08, 2014 12:37:12 AM org.apache.commons.httpclient.HttpMethodDirector processWWWAuthChallenge INFO: Failure authenticating with NTLM &lt;any realm&gt;@autodiscover.&lt;cmpany&gt;:443 The program: package com.experiment; import microsoft.exchange.webservices.data.ExchangeCredentials; import microsoft.exchange.webservices.data.ExchangeService; import microsoft.exchange.webservices.data.ExchangeVersion; import microsoft.exchange.webservices.data.FindItemsResults; import microsoft.exchange.webservices.data.Item; import microsoft.exchange.webservices.data.ItemView; import microsoft.exchange.webservices.data.WebCredentials; import microsoft.exchange.webservices.data.WellKnownFolderName; public class MSOutlookIntg { private static final String EMAIL_ID = "myid@company.com"; private static final String EMAIL_PWD = "mypwd"; public static void main(String[] args) { ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2); ExchangeCredentials credentials = new WebCredentials(EMAIL_ID, EMAIL_PWD); service.setCredentials(credentials); try { System.out.println("111111111111111"); service.autodiscoverUrl(EMAIL_ID); //service.setUrl(new URI("https://&lt;email-server&gt;/EWS/Exchange.asmx")); service.setTraceEnabled(true); System.out.println("222222222222222"); ItemView view = new ItemView(10); FindItemsResults&lt;Item&gt; findResults; findResults = service.findItems(WellKnownFolderName.Inbox, view); for(Item item : findResults.getItems()) { item.load(); System.out.println(item.getSubject()); } } catch (Exception e) { e.pr…
answer count: 1
has answer: http://stackoverflow.com/a/25191023
has title: Read email from MS Exchange using Java EWS
type: UnansweredQuestion
tagged with: java
tagged with: exchangewebservices
type: Question
score: 0

http://stackoverflow.com/a/25188242
type: Answer
has body: Can you check userList's size? in the debugger? This is in your matchingActivity class My guess is that it's an empty list and you are accessing the first element of an empty list
answers question: http://stackoverflow.com/q/25188156
score: 0

http://stackoverflow.com/comment/39087808
has text: `new StringTokenizer(entireFileText[o])` here `entireFileText[o]` is null .Please debug.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25115910
type: QuestionComment

http://stackoverflow.com/q/25178488
favorite count: 0
upvote count: 0
tagged with: compiler-errors
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25178539
score: -4
tagged with: java
has comment: http://stackoverflow.com/comment/39203905
has comment: http://stackoverflow.com/comment/39203773
has comment: http://stackoverflow.com/comment/39203912
type: Question
has answer: http://stackoverflow.com/a/25178567
answer count: 2
has title: errors in the program
has comment: http://stackoverflow.com/comment/39203911
has body: This is a copied program and thought i would get the output. But damn its not even compiling. can anyone correct these errors and explain why 6 errors on the same line? if there are any websites i can learn java through example codes, ill be glad to know that. (beginner) Thanks in advance import java.*; import java.util.*; class beer{ public static void main(String[] args) { int beernum=99; String word="bottles"; while(beernum &gt; 0) { if (beernum==1) { word="bottle"; } System.out.println(beernum+""+word+"of beer on wall"); System.out.println(beernum+""+word+"of beer"); System.out.println("take one down."); System.out.println("pass it around"); beernum=beernum-1; if(beernum&gt;0) { System.out.println(beernum+""+word+"of beer on wall"); } else { System.out.println("no more bottles on the wall"); } } } } Errors which im getting C:\mywork&gt;javac beer.java beer.java:4: error: &lt;identifier&gt; expected public Static void main(String[] args) ^ beer.java:4: error: invalid method declaration; return type required public Static void main(String[] args) ^ beer.java:44: error: class, interface, or enum expected beer.java:4: error: &lt;identifier&gt; expected ^ beer.java:45: error: class, interface, or enum expected public Static void main(String[] args) ^ beer.java:47: error: class, interface, or enum expected beer.java:4: error: invalid method declaration; return type required ^ beer.java:48: error: class, interface, or enum expected public Static void main(String[] args) ^ 6 errors
downvote count: 4

http://stackoverflow.com/a/25126660
has body: I am sure there may be several approaches and tricks to achieve what you're asking for, but, you are overriding a default, expected and standard UI behavior when you do so. Prompt text should be cleared when focus is grabbed to signal readiness to receiving user input, not after user starts typing.
has comment: http://stackoverflow.com/comment/39109491
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25125563
downvote count: 0
type: Answer

http://stackoverflow.com/q/25153624
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25156049
upvote count: 5
tagged with: java
type: Question
score: 5
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/2318848
linked to: http://stackoverflow.com/q/25113624
has body: Note: The similar question has been already asked three years ago, in time of EE 6, see how to instantiate more then one CDI/Weld bean for one class? Has something changed in EE 7? In Spring there is possible to instantiate any class by defining the corresponding bean in xml conf. It is also possible to instantiate more beans for one class with different parameters..... Is it possible to do it in CDI, I mean to create an instance without creating another class? Spring Example: &lt;bean id="foo" class="MyBean"&gt; &lt;property name="someProperty" value="42"/&gt; &lt;/bean&gt; &lt;bean id="hoo" class="MyBean"&gt; &lt;property name="someProperty" value="666"/&gt; &lt;/bean&gt;
has answer: http://stackoverflow.com/a/25156049
favorite count: 0
tagged with: cdi
tagged with: java-ee-7
has title: How to instantiate more CDI beans for one class?

http://stackoverflow.com/comment/39108796
type: AnswerComment
type: Comment
has text: poor response, please elaborate more (eg: in design trade-offs, API exposure, testing).
comment on: http://stackoverflow.com/a/25126905
score: 1

http://stackoverflow.com/q/25188452
has body: I'm using Java 8. I'm not a java expert (haven't looked at java since college 10 years ago) I create an instance of a ScriptEngine (Nashorn if it matters). I use it to eval several javascript files. The script chugs along quite happily in its own little javascript world. I love it. I also have a File System WatchService running, in case some of my java scripts get modified. When they get modified, I create a new ScriptEngine, and eval the new versions of the javascript files using the new ScriptEngine object. My problem is, I cant "kill" the old scriptEngine once I create the new one. The old script keeps on running indefinitely. I really want to free up the resources being used by the old scriptEngine object. AND I want it to stop doing the stuff its doing (since it could conflict with the new instance if they both try doing the same things). So ... How do I completely eliminate the old ScriptEngine, including any threads spawned inside of it?
tagged with: scriptengine
type: Question
tagged with: nashorn
score: 5
has answer: http://stackoverflow.com/a/25188587
tagged with: javascript
has comment: http://stackoverflow.com/comment/73321515
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/66617030
upvote count: 5
has comment: http://stackoverflow.com/comment/73321469
type: UnansweredQuestion
has title: How do I destroy a Java ScriptEngine Instance?
has comment: http://stackoverflow.com/comment/39473596
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/39005075
type: Comment
has text: I appreciate your help, time and your detailed comment. You made it very easy to understand. Thanks for helping a noob
comment on: http://stackoverflow.com/a/25071388
score: 0
type: AnswerComment

http://stackoverflow.com/a/25071499
has body: like this , add"()": &lt;h:outputText value="#{bill.GenBill()}" /&gt; or add get method for bean: public class Bill { public double getBill(){ return 4.565654; } public double GenBill(){ return 4.565654; } } then you can do this : &lt;h:outputText value="#{bill.bill}" /&gt;
has comment: http://stackoverflow.com/comment/39269109
type: Answer
answers question: http://stackoverflow.com/q/25071353
score: 0

http://stackoverflow.com/comment/39094402
comment on: http://stackoverflow.com/a/25118024
type: AnswerComment
score: 0
type: Comment
has text: The top RelativeLayout is commented, tht was the actual one which I've used but I did not get the o/p. So, commented that part and added another RelativeLayout section which I found in this website.

http://stackoverflow.com/q/25142373
tagged with: interface
tagged with: architecture
answer count: 1
has body: I wanna do a service that distributs tasks amongst several servers, which execute those tasks. To do that, I made use of the Java RMI technology and all works just fine, but it is a mess. I have a big class, which is mixed with remote methods which are called by the servers to post messages and client methods to schedule tasks to the service which are called by the client. I am now trying to find a proper solution to encapsulate the remote methods from the business methods, but struggle as they are thighly coupled. The message implementation (see the example class diagramm) interacts thightly with the private business methods. This might also include invoking events which the Client class subscribed. My first thought was the approach with a message handler. But how can the message handler still interact with private methods of the server and invoke events on the service. I like to ask you if you have any idea for my problem. How can I encapsulte the remote interface and its methods from the non remote methods?
has comment: http://stackoverflow.com/comment/39137671
score: 0
type: UnansweredQuestion
has title: Encapsulate Java RMI remote methods
has comment: http://stackoverflow.com/comment/39147685
has comment: http://stackoverflow.com/comment/39137990
tagged with: rmi
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25319903

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/25178389

variables
tag name: variables
tags question: http://stackoverflow.com/q/25213432
tags question: http://stackoverflow.com/q/25157183
tags question: http://stackoverflow.com/q/25204903
tags question: http://stackoverflow.com/q/25197935
tags question: http://stackoverflow.com/q/25112400
type: Tag
tags question: http://stackoverflow.com/q/25191697
tags question: http://stackoverflow.com/q/25103811
tags question: http://stackoverflow.com/q/25214070
tags question: http://stackoverflow.com/q/25118444
tags question: http://stackoverflow.com/q/25106390
tags question: http://stackoverflow.com/q/25176932
tags question: http://stackoverflow.com/q/25171186

http://stackoverflow.com/comment/39125522
has text: It is not real. Are you going to translate server calls into interaction with UI?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25135544

http://stackoverflow.com/q/25077549
has answer: http://stackoverflow.com/a/59427207
has answer: http://stackoverflow.com/a/44942810
has answer: http://stackoverflow.com/a/25077659
has answer: http://stackoverflow.com/a/43996948
downvote count: 0
answer count: 10
has answer: http://stackoverflow.com/a/51596228
accepted answer: http://stackoverflow.com/a/43742074
favorite count: 0
has title: Spring-Batch without persisting metadata to database?
has answer: http://stackoverflow.com/a/27267778
has answer: http://stackoverflow.com/a/51636996
tagged with: spring
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/39359840
tagged with: java
has answer: http://stackoverflow.com/a/42677607
type: Question
has body: I want to create a spring-batch job, but I want to run it without any database persistence. Unfortunately spring-batch requires to write metadata ob the job cycles to a database somehow, thus procing me to provide at least some kind of db with transactionmanager and entitymanager. It it possible to prevent the metadata and run independently from txmanagers and databases? Update: ERROR org.springframework.batch.core.job.AbstractJob: Encountered fatal error executing job java.lang.NullPointerException at org.springframework.batch.core.repository.dao.MapJobExecutionDao.synchronizeStatus(MapJobExecutionDao.java:158) ~[spring-batch-core-3.0.1.RELEASE.jar:3.0.1.RELEASE] at org.springframework.batch.core.repository.support.SimpleJobRepository.update(SimpleJobRepository.java:161) ~[spring-batch-core-3.0.1.RELEASE.jar:3.0.1.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_51] at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_51] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-4.0.6.RELEASE.jar:4.0.6.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.0.6.RELEASE.jar:4.0.6.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.0.6.RELEASE.jar:4.0.6.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) ~[spring-tx-4.0.6.RELEASE.jar:4.0.6.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) ~[spring-tx-4.0.6.RELEASE.jar:4.0.6.RELEASE] at org.springframe…
score: 65
upvote count: 65
possible better answer: http://stackoverflow.com/a/42677607
has comment: http://stackoverflow.com/comment/39178347
has answer: http://stackoverflow.com/a/48532528
tagged with: spring-batch
has answer: http://stackoverflow.com/a/43742074

http://stackoverflow.com/q/25134391
has comment: http://stackoverflow.com/comment/39123744
downvote count: 0
upvote count: 4
has comment: http://stackoverflow.com/comment/39122433
has comment: http://stackoverflow.com/comment/39124618
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has title: Hibernate JPA Column "NEXTVAL" not found
type: Question
answer count: 1
tagged with: jpa
score: 4
has body: We changed the JPA provider from EclipseLink to Hibernate 4.1.3. A problem occured when attempting to persist entity using generated id. This gives the following error: JdbcSQLException: Column "NEXTVAL" not found; SQL statement: select nextval for SCHEMA.ID_SEQ_GENERATOR The sequence for the entity looks like the following: @Id @SequenceGenerator(name = "ID_GENERATOR", initialValue = 100000, allocationSize = 1, sequenceName = "ID_SEQ_GENERATOR") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ID_GENERATOR") @Column(name = "ID", nullable = false) public Long getId() { return this.id; } I tried changing the 'strategy = GenerationType.IDENTITY', but it had no effect. Any advice?
has answer: http://stackoverflow.com/a/25157872
accepted answer: http://stackoverflow.com/a/25157872
favorite count: 0

http://stackoverflow.com/q/25150130
possible better answer: http://stackoverflow.com/a/25150141
has comment: http://stackoverflow.com/comment/39152038
has answer: http://stackoverflow.com/a/25150207
accepted answer: http://stackoverflow.com/a/25150207
type: AnsweredQuestion
has body: I am trying to export my java project to an executable file (a .jar) but it wont bring along the assets with it(such as pictures and things). I am programming with Eclipse. I have looked at other forums about this and try their fixes but it doesn't seem to work for me. I think the problem has something to do with where i put my .gif and .wav. I put them in the same folder as the src folder with my .java files. Here is my code. Thanks for the help! class ImagePaneTest extends JFrame { ImageIcon ic = new ImageIcon("scary.gif"); JDesktopPane dp = new JDesktopPane(); JLabel lbl = new JLabel(ic); JPanel transparentPanel = new JPanel(); public ImagePaneTest() { lbl.setBounds(0, 0, 553, 421); dp.add(lbl,new Integer(50)); dp.add(transparentPanel,new Integer(350)); setLayeredPane(dp); } public static void main(String a[]) { try { Thread.sleep(8000); } catch(InterruptedException ex) { Thread.currentThread().interrupt(); } ImagePaneTest fr = new ImagePaneTest(); Image icon = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB_PRE); fr.setIconImage(icon); fr.setSize(553,421); fr.setVisible(true); fr.toFront(); fr.setLocation(370, 200); sound play = new sound(); play.playSound("wail.wav"); System.exit(0); } }
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/25150141
answer count: 2
tagged with: jar
has comment: http://stackoverflow.com/comment/39151992
has title: When exporting my Java Project, It won't export my Assets
score: 0
tagged with: packaging

http://stackoverflow.com/q/25185650
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/39217851
has comment: http://stackoverflow.com/comment/39219785
has comment: http://stackoverflow.com/comment/39222412
tagged with: java
has comment: http://stackoverflow.com/comment/39222953
has body: I have problem with sqlite database adapter in my project.I'm new to android development so I don't have much idea to how can handle this problem. I want to save user information in data base .Although no error while execution,database doesn't create? can any one help. DatabaseAdapter : public class DatabaseAdapter { private final String TAG = "DatabaseAdapter"; private DatabaseOpenHelper openHelper; public static final String TBL_PERSONS = "persons"; public static final String PERSON_ID = "_id"; public static final String PERSON_USERNAME = "_username"; public static final String PERSON_HEIGHT = "_height"; public static final String PERSON_WEIGHT = "_weight"; public static final String PERSON_AGE = "_age"; public static final String PERSON_GENDER = "_gender"; public static final String PERSON_PA = "_pa"; public static final String PERSON_BMI = "_bmivalue"; public static final String PERSON_INTERPRETATION = "_bmiInterpretation"; public static final String PERSON_IDEALWEIGHT = "_idealweight"; public static final String PERSON_DAILYCALORIES = "_dailycalories"; // ??????????? public DatabaseAdapter(Context context) { openHelper = new DatabaseOpenHelper(context, "Persons.db", null, 1); } // ====================insert in // database=========================================================== public Long insertPerson(Person person) { SQLiteDatabase db = null; Long id = -1L; try { ContentValues values = new ContentValues(); values.put("PERSON_USERNAME", person.getUsername()); values.put("PERSON_HEIGHT", person.getHeight()); values.put("PERSON_WEIGHT", person.getWeight()); values.put("PERSON_AGE", person.getAge()); values.put("PERSON_GENDER", person.getGender()); values.put("PERSON_PA", person.getPa()); values.put("PERSON_BMI", person.getBmivalue()); values.put("PERSON_INTERPRETAION", person.getBmiInterpretation()); values.put("PERSON_IDEALWEIGHT", person.getIdealweight()); values.put("PERSON_DAILYCALORIES", person.getDailycalories()); db = openHelper.getWritableDatabase(); i…
has comment: http://stackoverflow.com/comment/39217592
type: Question
has comment: http://stackoverflow.com/comment/39217333
tagged with: null
linked to: http://stackoverflow.com/q/21881992
answer count: 1
tagged with: database
has comment: http://stackoverflow.com/comment/39219468
has comment: http://stackoverflow.com/comment/39222872
has comment: http://stackoverflow.com/comment/39218741
has comment: http://stackoverflow.com/comment/39222914
has comment: http://stackoverflow.com/comment/39219988
score: 0
has comment: http://stackoverflow.com/comment/39219562
tagged with: android
has answer: http://stackoverflow.com/a/25185803
tagged with: sqlite
has title: SQLite db isn't created
has comment: http://stackoverflow.com/comment/39219498
favorite count: 0
has comment: http://stackoverflow.com/comment/39217488
has comment: http://stackoverflow.com/comment/39220123

http://stackoverflow.com/comment/39013419
type: Comment
has text: Maybe use some regular expression to look for the existence of a '.'? throw an exception if it returns true? Or maybe just use 'instanceof Integer'?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25076030

http://stackoverflow.com/q/25082649
tagged with: default-constructor
tagged with: java
has title: Converting POJO into XML without default POJO constructor
type: Question
upvote count: 4
possible better answer: http://stackoverflow.com/a/25083368
has answer: http://stackoverflow.com/a/25083368
score: 4
has answer: http://stackoverflow.com/a/25083316
answer count: 3
downvote count: 0
tagged with: javabeans
favorite count: 0
has answer: http://stackoverflow.com/a/25082675
accepted answer: http://stackoverflow.com/a/25083316
tagged with: http://stackoverflow.com/tag/xml
has body: I'm trying to convert a POJO (Plain old Java Object) into XML using java.beans.XMLEncoder. My code works fine but I found one interesting problem that occurs when I omit the default constructor in my POJO. Classes are below. POJO without default constructor public class NFLTeam implements Serializable { private String name; private String description; // public NFLTeam() { // // } public NFLTeam(String name, String description) { this.name = name; this.description = description; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } } Invocation of XMLEncoder public static void main(String args[]) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); XMLEncoder xmlEncoder = new XMLEncoder(byteArrayOutputStream); NFLTeam team = new NFLTeam("Bears", "Play for Chicago"); xmlEncoder.writeObject(team); xmlEncoder.close(); System.out.println(byteArrayOutputStream); } Console output with default constructor omitted java.lang.InstantiationException: oce.wsd.pojos.NFLTeam Continuing ... java.lang.Exception: XMLEncoder: discarding statement XMLEncoder.writeObject(NFLTeam); Continuing ... <?xml version="1.0" encoding="UTF-8"?> Console output with default constructor <?xml version="1.0" encoding="UTF-8"?> Play for Chicago Bears I was googling around but cannot find any explanation for this. Why is the implicit default constructor not enough for XMLEncoder?
type: AnsweredQuestion

http://stackoverflow.com/comment/132651902
type: AnswerComment
comment on: http://stackoverflow.com/a/46465836
has text: getting stream closed Exception.
score: 0
type: Comment

spring-ioc
tag name: spring-ioc
tags question: http://stackoverflow.com/q/25205324
type: Tag

http://stackoverflow.com/comment/39115912
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25130759
has text: Are you using an external library to lex and parse, or are you parsing on your own? Where will you put the grammar rule that you need?

http://stackoverflow.com/a/25588061
score: 0
type: Answer
has body: Both of your references in the code should be to R.layout.activity_display_message, although I do not get any errors there (make sure you followed all the steps in the tutorial). But I am following the same tutorial and am getting the same error with the add method and cannot figure out why.
answers question: http://stackoverflow.com/q/25103142

http://stackoverflow.com/comment/39198358
comment on: http://stackoverflow.com/q/25175289
score: 0
type: Comment
type: QuestionComment
has text: Which line is line 28 in ServletClient.java? Maybe your ` EntityManagerFactory` is not autowired.

http://stackoverflow.com/a/25178966
score: 0
has comment: http://stackoverflow.com/comment/39204755
type: Answer
answers question: http://stackoverflow.com/q/25178841
has comment: http://stackoverflow.com/comment/39205223
has body: String txt = "file1.txt file2.jpg tricky file name.txt other tricky filenames containing áéíőéáóó.gif"; Pattern pattern = Pattern.compile("\\S.*?\\.\\S+"); // Get regex from enrico.bacis Matcher matcher = pattern.matcher(txt); while (matcher.find()) { System.out.println(matcher.group().trim()); }

http://stackoverflow.com/comment/39180339
comment on: http://stackoverflow.com/q/25163637
score: 0
type: QuestionComment
type: Comment
has text: Solved the problem by not using ksoap2 and instead built a request on my own and sent it through a DefaultHttpClient with the request as a HttpEntity.

http://stackoverflow.com/a/25074904
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25074744
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25074744
score: 1
has body: From Running Apache Ant: ant [options] [target [target2 [target3] ...]] Options: ... -buildfile &lt;file&gt; use given buildfile So there should be no = between -buildfile and &lt;file but instead a space. Instead of your: ant -Dfile1=file1 -Dfile2=file2 -buildfile=build.xml -verbose Try: ant -Dfile1=file1 -Dfile2=file2 -buildfile build.xml -verbose

http://stackoverflow.com/comment/39020942
score: 0
type: Comment
type: QuestionComment
has text: These answers are solved your problem?
comment on: http://stackoverflow.com/q/25079887

http://stackoverflow.com/a/25172206
score: 0
type: Answer
has body: There are lots of problems with this, but probably the primary one is that you don't want to override paintComponent of the JFrame, you want to do that on the ContentPane. So create a JPanel derived class, and do that code in there, then call myframe.setContentPane(mypanel); another issue is you don't want to call finalize() on g2 Chances are you want to use a classpath resource to load that image, rather than using File io.
answers question: http://stackoverflow.com/q/25172141

http://stackoverflow.com/q/25181958
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39210332
possible better answer: http://stackoverflow.com/a/25183131
has answer: http://stackoverflow.com/a/25183306
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25183131
tagged with: annotations
upvote count: 1
type: Question
has body: I am not being able to make messageSource work in the Pojo classes,its throwing a nullpointerexception. However in all the other classes namely controller,service messageSource is working alright. Could someone please suggest what needs to be done ? @Autowired private MessageSource messageSource; I have autowired the MessageSource using the above code snippet. public class ProposalWiseSelectionForm implements Serializable { /** * */ private static final long serialVersionUID = 1L; @Autowired private MessageSource messageSource; private String txtPageHierarchy=""; private String txtLineOfBusiness; private String txtProduct; private String btn; private String clickedGo="N"; private List arrLineOfBusiness=new ArrayList(); private List arrProduct=new ArrayList(); @Valid private ArrayList documentList=initiateDocumentList(); private String txtPageMode="I"; private String enableDiscardBtn="N"; private String enableInsertBtn="N"; private String isDivVisible="N"; private int numApplicationType=1; public ProposalWiseSelectionForm() { } public String getTxtPageHierarchy() { return txtPageHierarchy; } public void setTxtPageHierarchy(String txtPageHierarchy) { this.txtPageHierarchy = txtPageHierarchy; } public String getTxtLineOfBusiness() { return txtLineOfBusiness; } public void setTxtLineOfBusiness(String txtLineOfBusiness) { this.txtLineOfBusiness = txtLineOfBusiness; } public String getTxtProduct() { return txtProduct; } public void setTxtProduct(String txtProduct) { this.txtProduct = txtProduct; } public String getBtn() { return btn; } public void setBtn(String btn) { this.btn = btn; } public String getClickedGo() { return clickedGo; } public void setClickedGo(String clickedGo) { this.clickedGo = clickedGo; } public List getArrLineOfBusiness() { return arrLineOfBusiness; } public void setArrLineOfBusiness(List arrLineOfBusiness) { this.arrLineOfBusiness = arrLineOfBusiness; } public List getArrProduct() { return arrProduct; } public void setArrProduct(List arrProduct) { t…
linked to: http://stackoverflow.com/q/4703206
accepted answer: http://stackoverflow.com/a/25183306
answer count: 3
has title: Can't make messageSource work in the Pojo classes
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/39211772
has answer: http://stackoverflow.com/a/25183448
tagged with: spring-mvc

for-loop
tags question: http://stackoverflow.com/q/25191893
tags question: http://stackoverflow.com/q/25111632
tags question: http://stackoverflow.com/q/25076696
tags question: http://stackoverflow.com/q/25095803
tags question: http://stackoverflow.com/q/25224552
tags question: http://stackoverflow.com/q/25195397
tags question: http://stackoverflow.com/q/25101659
tag name: for-loop
tags question: http://stackoverflow.com/q/25124499
tags question: http://stackoverflow.com/q/25086785
tags question: http://stackoverflow.com/q/25088919
tags question: http://stackoverflow.com/q/25081541
tags question: http://stackoverflow.com/q/25145634
tags question: http://stackoverflow.com/q/25166160
tags question: http://stackoverflow.com/q/25172520
type: Tag
tags question: http://stackoverflow.com/q/25180645
tags question: http://stackoverflow.com/q/25193480
tags question: http://stackoverflow.com/q/25184589
tags question: http://stackoverflow.com/q/25128716
tags question: http://stackoverflow.com/q/25194992

http://stackoverflow.com/comment/39272471
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25203525
has text: no need for jsp-api.jar it's already included in the tomcat lib by default. and also what's the difference between jstl-1.2 and jstl-1.2.1? I notice it won't work if combine jstl-1.2.1.jar and jstl-1.2-source.jar.
type: AnswerComment

http://stackoverflow.com/q/25097435
score: 0
has comment: http://stackoverflow.com/comment/39054119
has comment: http://stackoverflow.com/comment/39053543
has comment: http://stackoverflow.com/comment/39053886
has comment: http://stackoverflow.com/comment/39053753
has comment: http://stackoverflow.com/comment/39054171
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/59658512
duplicate of: http://stackoverflow.com/q/4112686
type: Question
has title: Send data from servlet to jsp using ajax
tagged with: java
tagged with: servlets
has comment: http://stackoverflow.com/comment/39053816
has comment: http://stackoverflow.com/comment/39053665
answer count: 2
linked to: http://stackoverflow.com/q/4112686
upvote count: 1
has comment: http://stackoverflow.com/comment/39053777
downvote count: 1
tagged with: jsp
tagged with: jquery
has body: Here I am sending data from servlet to jsp using ajax request.But i didn't get any value from servlet on my client side.This is my code Servlet protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String s="msg"; System.out.print("Servlet"); response.setContentType("text/plain"); PrintWriter out=response.getWriter(); out.print(s); out.flush(); out.close(); } jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Insert title here output: Am getting empty alert box and "No element found" on the browser debugging tool.
favorite count: 0
tagged with: ajax
has answer: http://stackoverflow.com/a/25097925

http://stackoverflow.com/a/25222302
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25222120
has body: You almost got it right. You should consider understanding the principles behind your methods declaration. In your case you did not provide a local name for the method to assign to the double value it was expecting. Read on if you're interested in understanding the principles as I understand them. Each word in the method declaration serves a purpose. From left to right. public - means this method can be accessed publicly and not just by code in that class. static - means the methods is static and belongs to that class, is not a object member. void - means the methods does not return any value. yourmethod name - any name you see fit. Now the interesting part. The method parameters. These are the values you may pass into the method. In the paramaters you include the type and a name for the value. eg: methodName(int anInteger) This means the method can expect an integer type to be passed to is and the method will call that integer anInteger for use within it's body. For whatever purpose you see fit.
downvote count: 0
type: Answer

http://stackoverflow.com/a/25113349
answers question: http://stackoverflow.com/q/25113293
has comment: http://stackoverflow.com/comment/39090208
has comment: http://stackoverflow.com/comment/39083500
upvote count: 2
downvote count: 0
has body: What Enum&lt;Gender&gt;? Gender is already an Enum and this type of declaration is not what you want. Try a more easy: @Column(name="gender") @Enumerated(EnumType.ORDINAL) private Gender gender=Gender.M;
has comment: http://stackoverflow.com/comment/39084198
has comment: http://stackoverflow.com/comment/39083458
has comment: http://stackoverflow.com/comment/39086714
type: Answer
score: 2

http://stackoverflow.com/comment/39076327
type: AnswerComment
has text: There's also the issue of async code, the `findInBackground()` will do just that, do a background request. the `for()` request will (usually) be hit before the background task has finished, so at that point `mUsers` will still be empty.
type: Comment
comment on: http://stackoverflow.com/a/25107849
score: 1

http://stackoverflow.com/comment/39137948
comment on: http://stackoverflow.com/q/25142342
score: 0
type: Comment
has text: And what is your `filePath`? Content type detection in Java is based on file extensions. If you need something more clever you should check Apache Tika (http://tika.apache.org/1.4/detection.html) or similar projects (e.g. http://256.com/sources/simplemagic/).
type: QuestionComment

rjava
tags question: http://stackoverflow.com/q/25085569
type: Tag
tag name: rjava
tags question: http://stackoverflow.com/q/25110980
tags question: http://stackoverflow.com/q/25126884

http://stackoverflow.com/comment/39052580
has text: Why are you using nested enums, anyway? One enum (`Type`) seems like it'd be plenty here, and you wouldn't run into weird use case issues like this.
comment on: http://stackoverflow.com/q/25096898
score: 0
type: QuestionComment
type: Comment

image-processing
tags question: http://stackoverflow.com/q/25094200
tags question: http://stackoverflow.com/q/25165355
tags question: http://stackoverflow.com/q/25085871
tags question: http://stackoverflow.com/q/25140204
tags question: http://stackoverflow.com/q/25178810
tags question: http://stackoverflow.com/q/25187942
tags question: http://stackoverflow.com/q/25216050
tags question: http://stackoverflow.com/q/25193738
type: Tag
tags question: http://stackoverflow.com/q/25099511
tag name: image-processing
tags question: http://stackoverflow.com/q/25126971

http://stackoverflow.com/comment/39038047
comment on: http://stackoverflow.com/a/25088872
type: AnswerComment
type: Comment
has text: @Azar he didn't have enough rep to comment.
score: 1

http://stackoverflow.com/comment/39156796
has text: Actually i want the mounted storage path (sd-card). This gives me the external storage path and this doesn't assure it is sd-card.
type: AnswerComment
comment on: http://stackoverflow.com/a/25145942
score: 1
type: Comment

http://stackoverflow.com/a/25214028
score: 1
has comment: http://stackoverflow.com/comment/39270883
upvote count: 1
answers question: http://stackoverflow.com/q/25196198
has body: Thank you Shishir Kumar for your quick response I saw it last night but was to tired to reply. The way you posted is one way I tried it before asking for help. I do apologize if I am breaking the rule of this forum, but this is my first time asking for help. Here is another version of the code I tried I changed variable names to match yours. import java.util.*; public class Project { public static void main(String[] args) { getInput(); } public static void getInput() { char a; a = Input.getChar("Enter m for Morse to English or e for English to Morse."); if (a == 'm') translateMorse(); else if (a == 'e') translateEnglish(); else System.out.println("Your input is not valid."); } public static void translateEnglish() { String englishToMorse = Input.getString("Enter a phrase in English."); englishToMorse = englishToMorse.toLowerCase(); int i = 0; while(i &lt;englishToMorse.length() ){ Map&lt;Character, String&gt; morse = new HashMap&lt;Character, String&gt;(); morse.put('a', ".-"); morse.put('b', "-..."); morse.put('c', "-.-"); morse.put('d', "-.."); morse.put('e', "."); morse.put('f', "..-."); morse.put('g', "--."); morse.put('h', "...."); morse.put('i', ".."); morse.put('j', ".---"); morse.put('k', "-."); morse.put('l', ".-.."); morse.put('m', "--"); morse.put('n', "-."); morse.put('o', "---"); morse.put('p', ".--."); morse.put('q', "--.-"); morse.put('r', ".-."); morse.put('s', "..."); morse.put('t', "-"); morse.put('u', "..-"); morse.put('v', "...-"); morse.put('w', ".--"); morse.put('x', "-..-"); morse.put('y', "-.--"); morse.put('z', "--.."); morse.put('1', ".----"); morse.put('2',"..---"); morse.put('3', "...--"); morse.put('4', "....-"); morse.put('5', "....."); morse.put('6', "-...."); morse.put('7', "--..."); morse.put('8', "---.."); morse.put('9', "----."); morse.put('0', "-----"); System.out.print(morse.get(englishToMorse.charAt(i))); i++; } } public static void translateMorse() { String morseToEnglish = Input.getString("Enter a phrase in Morse Code."); mors…
downvote count: 0
has comment: http://stackoverflow.com/comment/39271267
type: Answer

http://stackoverflow.com/a/25246964
score: 0
has body: To be able to map an entity to a table, Hibernate requires a unique id property, that maps to a unique (primary) key on the table. As you have stated that you don't have this and if this is the only table your application is using, then Hibernate might not be the best choice. You could still get the required information through Hibernate from your database by executing a native SQL query: SQLQuery q = session.createSQLQuery("select OwnerID from OwnerEmailIds where emailId = :email"); q.setScalar("OwnerID", StandardBasicTypes.LONG); q.setParameter("email", emailId) List&lt;Long&gt; ids = (List&lt;Long&gt;) q.list(); Storing the ids could also be done with a native query, but here you would have to take into account data that is already there, so it is a little harder.
type: Answer
answers question: http://stackoverflow.com/q/25212636

http://stackoverflow.com/comment/39300061
comment on: http://stackoverflow.com/q/25228713
type: Comment
type: QuestionComment
has text: I get the same on Chrome and FF. However, based on your post, I tried on IE and that treats it like XML. Thanks. Update - actually Chrome is OK now too. STrange.
score: 0

http://stackoverflow.com/q/25194572
type: Question
upvote count: 1
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/25194892
has title: I want to use a BoxLayout in a ScrollPane that has an ArrayList of Panels
tagged with: java
has comment: http://stackoverflow.com/comment/39234320
tagged with: jpanel
has comment: http://stackoverflow.com/comment/39234697
tagged with: boxlayout
has body: When I set the outpanel into a BoxLayout then the panel disappears. However the scrollbar shows that indicates my panel in ArrayList are in the right position. I am totally new to Java so I'll appreciate any comments. import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.util.*; import javax.swing.*; public class gui extends JFrame{ int ctr=0, top=5; public List&lt;JPanel&gt; o_panels = new ArrayList&lt;JPanel&gt;(); //Your List public gui(){ super("MCC"); setLayout(null); //Output panel for the results JPanel outpanel = new JPanel(); outpanel.setBackground(Color.blue); outpanel.setVisible(true); outpanel.setLayout(new BoxLayout(outpanel, BoxLayout.PAGE_AXIS)); //Scroll pane JScrollPane scrollPane = new JScrollPane(outpanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setBounds(0,0,780,400); add(scrollPane); //result panel //creating and adding panels in to the array list while(ctr&lt;=4){ JPanel label1 = new JPanel(); label1.setPreferredSize(new Dimension(600,100)); o_panels.add(label1); outpanel.add(o_panels.get(ctr)); ctr++; } } public void runGui(){ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(800,600); this.setVisible(true); this.setResizable(false); //i call this on the other class } }
linked to: http://stackoverflow.com/q/7229226
downvote count: 0
accepted answer: http://stackoverflow.com/a/25194892
type: AnsweredQuestion
score: 1
favorite count: 0

http://stackoverflow.com/comment/39315687
type: Comment
type: QuestionComment
has text: I want every action individual to particular Document only.For example I check viewSpaces to Doc1 then I open Doc2,here viewspace must be uncheck upto manually check.Please check it once.I had tried this for long time.But,I didn't get idea.
score: 0
comment on: http://stackoverflow.com/q/25153089

http://stackoverflow.com/a/25207665
score: 3
has comment: http://stackoverflow.com/comment/39473622
answers question: http://stackoverflow.com/q/25202275
has comment: http://stackoverflow.com/comment/39474760
upvote count: 3
type: Answer
has body: Well, as nothing is in charge of converting %PATH% it simply is not converted ! More seriously, it is the cmd.exe interpretor that actually does the translation of environment variables and you do not use it. To have it to work, you must : convert the environment variable PATH to its value in java code String path = System.getenv("PATH"); use the converted String in your command Process p = rt.exec("setx PATH \"" + path + ";" + folderPath + "\""); EDIT : To really be sure of what happens, you can display the generated command before executing it : String cmd = "setx PATH \"" + path + ";" + folderPath + "\""; Process p = rt.exec(cmd);
downvote count: 0
has comment: http://stackoverflow.com/comment/39472430

http://stackoverflow.com/q/25102726
has title: error in jsp : NullPointerException
tagged with: java
tagged with: database
tagged with: mysql
has answer: http://stackoverflow.com/a/25102785
has comment: http://stackoverflow.com/comment/39063277
type: Question
has comment: http://stackoverflow.com/comment/39063231
answer count: 1
tagged with: jsp
score: 0
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39063249
has comment: http://stackoverflow.com/comment/39063234
has body: I have a MyDb class that getConnetion from existed database and a COURSES class that insert and update the courses table in data base . i use this class in my jsp file but when i run this its error : http 500 error : org.apache.jasper.JasperException: java.lang.NullPointerException MYDB class : public MYDB() throws ClassNotFoundException, SQLException { Class.forName(DRIVER); con = DriverManager.getConnection(DB_URL, UNAME, PASS); stmt = this.con.createStatement(); } public Connection getCon() { return con; } public void setSQL(String SQL) throws SQLException { res = stmt.executeQuery(SQL); } COURSES class : public COURSES() throws ClassNotFoundException, SQLException { MYDB c = new MYDB(); } public void Insert(int id, String name, int unit) throws ClassNotFoundException, SQLException { String SQL = "INSERT INTO courses VALUES(" + id + ",'" + name + "' , " + unit + ")"; c.getStmt().executeUpdate(SQL); } public void updateName(int id, String newName) throws SQLException { String s = newName ; String SQL = "update courses set name=" + s + "where id is" + id; c.getStmt().executeUpdate(SQL); } jsp : &lt;% COURSES d = new COURSES() ; d.updateName(12, "op"); %&gt; and this id exist befor in courses table . its insert func is ok and work . where is my mistake ?
type: UnansweredQuestion

http://stackoverflow.com/a/68133626
type: Answer
answers question: http://stackoverflow.com/q/25186004
has body: A problem I encountered is incompatible dependencies. The spock-core dependency of course pulls in a dependency on the version of groovy it needs. But it is possible that other dependencies or plugins (I think thegmaven-plus plugin in my case) pull in a different, incompatible, version of groovy. I fixed the problem by explicitly giving a dependency on the groovy package I wanted to use.
score: 0

java-native-interface
tags question: http://stackoverflow.com/q/25128185
tags question: http://stackoverflow.com/q/25214786
tags question: http://stackoverflow.com/q/25161323
tags question: http://stackoverflow.com/q/25107427
tags question: http://stackoverflow.com/q/25117107
tags question: http://stackoverflow.com/q/25128706
tags question: http://stackoverflow.com/q/25163928
type: Tag
tags question: http://stackoverflow.com/q/25123942
tag name: java-native-interface
tags question: http://stackoverflow.com/q/25153076
tags question: http://stackoverflow.com/q/25089569
tags question: http://stackoverflow.com/q/25201939
tags question: http://stackoverflow.com/q/25131064
tags question: http://stackoverflow.com/q/25138413

http://stackoverflow.com/comment/39275541
comment on: http://stackoverflow.com/q/25216514
type: Comment
type: QuestionComment
has text: If you have more than n^5 ids, where n is the number of symbols in your alphabet, you'll have collisions. if you use randomization you'll probably end up with collisions approximately after n^2 insertions, or even earlier.
score: 0

http://stackoverflow.com/comment/39301114
comment on: http://stackoverflow.com/a/25230221
score: 0
type: Comment
has text: First part of answer suits my case. What if I use spinner and 'name' string instead ID's showing in spinner? Could you suggest solution?
type: AnswerComment

http://stackoverflow.com/a/25216291
upvote count: 1
downvote count: 0
type: Answer
has body: Components will be accessed from within the thread context they are called, wch leads to a problem... All Swing components (or enough not to matter) MIST be accessed within the context of the Event Dispatching Thread once they have been added to a displayable container (attached to a native peer). This makes Swing components NOT thread safe and you are responsible for ensuring that they are modified/accessed from the EDT correctly, the framework will NOT do it for you Take a look at Concurrency in Swing for more details
answers question: http://stackoverflow.com/q/25216217
score: 1

http://stackoverflow.com/q/25180859
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39219747
has comment: http://stackoverflow.com/comment/39209570
type: Question
has body: When i am trying to call back() method more than once in my code.the script is not running as expected.Here is my script @Test public void testfun() throws Exception{ WebDriver d= new FirefoxDriver(); d.get("http://selenium.googlecode.com/git/docs/api/java/index.html"); assertEquals("Overview",d.getTitle()); d.switchTo().frame(d.findElement(By.name("packageListFrame"))); d.findElement(By.cssSelector("a[href='com/thoughtworks/selenium/package-frame.html']")).click(); Thread.sleep(3000); d.navigate().back(); d.switchTo().parentFrame(); d.switchTo().frame(d.findElement(By.name("packageFrame"))); d.findElement(By.cssSelector("a[href*='AddApplicationCache']")); d.navigate().back(); d.switchTo().parentFrame(); d.switchTo().frame(d.findElement(By.name("classFrame"))).click(); d.findElement(By.cssSelector("a[href='org/openqa/selenium/firefox/package-summary.html']")).click(); } Any one with answers? Thanks in advance
score: 0
tagged with: java
tagged with: selenium
tagged with: webdriver
has comment: http://stackoverflow.com/comment/39210843
has title: How many times can we call back() method in one script in Webdriver
has comment: http://stackoverflow.com/comment/42015284
answer count: 0

http://stackoverflow.com/q/25219518
accepted answer: http://stackoverflow.com/a/25274748
has body: I would like to connect to my mindstorms nxt robot over bluetooth with java. Also keep in mind that I have lejos installed. Lejos includes classes to connect with the robot. Thank you so much I have spent weeks trying to figure this out and would really appreciate your help! I would like my mac to initiate the connection. Thank you post a comment if you don't understand what I am asking. Thank you! The code running on the mac: //package package bluetoothtest; //imports import lejos.nxt.LCD; import lejos.pc.comm.*; import lejos.pc.*; //main class public class test { //main method public static void main(String[] args) throws Exception { //establish a connection... NXTComm nxtComm = NXTCommFactory.createNXTComm(NXTCommFactory.BLUETOOTH); NXTInfo nxtInfo = new NXTInfo(NXTCommFactory.BLUETOOTH, "NXT", "00:16:53:0B:9C:CA"); } } code on robot: //package package bluetoothrobottest; //imports import java.io.DataInputStream; import java.io.DataOutputStream; import lejos.nxt.comm.Bluetooth; import lejos.nxt.comm.NXTConnection; //main class public class test { //main method public static void main(String[] args) { //wait for connection... System.out.println("waiting for bluetooth connection..."); NXTConnection connection = Bluetooth.waitForConnection(); System.out.println("connected..."); //create streams DataInputStream dis = connection.openDataInputStream(); DataOutputStream dos = connection.openDataOutputStream(); } } When I put this line of code in it gives me an error saying that the bluecove library isn't available: nxtComm.open(nxtInfo,NXTComm.PACKET);
has answer: http://stackoverflow.com/a/25219853
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/25219853
has title: Connect to nxt with java bluetooth
tagged with: bluetooth
has answer: http://stackoverflow.com/a/25274748
type: Question
type: AnsweredQuestion
tagged with: lejos-nxj
tagged with: macos
tagged with: nxt
answer count: 2

http://stackoverflow.com/comment/39094586
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25117158
has text: @Reimeus okay I edited the above code again. Did like you said. I'm still not getting the right thing. It's still giving me first sentence and that's it.
score: 0

http://stackoverflow.com/comment/39018894
type: Comment
comment on: http://stackoverflow.com/a/25078999
has text: what is the value of path_file
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39136032
comment on: http://stackoverflow.com/q/25140857
type: Comment
type: QuestionComment
has text: How do I get json data??
score: 0

mouselistener
tags question: http://stackoverflow.com/q/25129280
tags question: http://stackoverflow.com/q/25110272
tags question: http://stackoverflow.com/q/25113048
type: Tag
tags question: http://stackoverflow.com/q/25134108
tag name: mouselistener

http://stackoverflow.com/q/25102316
has comment: http://stackoverflow.com/comment/39062623
tagged with: android-asynctask
type: UnansweredQuestion
score: 0
has body: Sooo here is my OnCreateView code public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_profile, container, false); tvMemberName = (TextView) v.findViewById(R.id.member_name); UrlPostHelper uph = new UrlPostHelper(); uph.execute(); return v; } and AsyncTask private class UrlPostHelper extends AsyncTask&lt;Void, Void, String&gt; { @Override protected String doInBackground(Void... params) { String url = "http://localhost:8080/MP/Profile"; HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); HttpResponse response; String data = "no response"; try { response = httpClient.execute(httpGet); data = EntityUtils.toString(response.getEntity()); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } String s = "yow"; try { JSONArray ja = new JSONArray(data); for (int i = 0 ; i &lt; ja.length(); i++ ){ JSONObject j = ja.getJSONObject(i); String firstName = j.getString("firstName"); String lastName = j.getString("lastName"); System.out.println(firstName); s = firstName +" " + lastName; } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return s; } protected void onPostExecute(String result){ super.onPostExecute(result); Log.i("TAG", result ); tvMemberName.setText(result); } } My problem is that in my android app it does not show anything at first but after a while like around 1-2 minutes the "yow" will show. It is not replaced with the member name though. I tried running my servlet and it works just fine. Please help me.
has title: How to set a text from my AsyncTask to a textview in a fragment?
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/25102540
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/39062554
has comment: http://stackoverflow.com/comment/39062867
tagged with: android
tagged with: textview

http://stackoverflow.com/a/47832258
type: Answer
has body: Here is a solution to your problem. I don't know why Spring guys decided to base their repositories on concrete classes. But at least they made it possible to change that. You need to provide custom repositoryFactoryBeanClass in EnableJpaRepositories e.g. something like that: import org.springframework.data.jpa.repository.config.EnableJpaRepositories; /** * @author goraczka */ @EnableJpaRepositories( repositoryFactoryBeanClass = InterfaceBasedJpaRepositoryFactoryBean.class ) public class DatabaseConfig { } Then you need to implement InterfaceBasedJpaRepositoryFactoryBean. It is a Spring hook to enable creating a custom factory for repository beans. import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean; import org.springframework.data.repository.Repository; import org.springframework.data.repository.core.support.RepositoryFactorySupport; import javax.persistence.EntityManager; /** * @author goraczka */ public class InterfaceBasedJpaRepositoryFactoryBean&lt;T extends Repository&lt;S, ID&gt;, S, ID&gt; extends JpaRepositoryFactoryBean&lt;T, S, ID&gt; { public InterfaceBasedJpaRepositoryFactoryBean(Class&lt;? extends T&gt; repositoryInterface) { super(repositoryInterface); } protected RepositoryFactorySupport createRepositoryFactory(EntityManager entityManager) { return new InterfaceBasedJpaRepositoryFactory(entityManager); } } And last but not least the custom repository bean factory that tries to match interface defined on the repository itself with a entity class registered on EntityManager. import org.springframework.data.jpa.repository.support.JpaEntityInformation; import org.springframework.data.jpa.repository.support.JpaEntityInformationSupport; import org.springframework.data.jpa.repository.support.JpaRepositoryFactory; import org.springframework.util.Assert; import javax.persistence.EntityManager; import java.util.AbstractMap; import java.util.Arrays; import java.util.Map; import java.util.stream.Collectors; /** * @author goraczka */ p…
score: 6
has comment: http://stackoverflow.com/comment/82633830
has comment: http://stackoverflow.com/comment/108346190
upvote count: 7
downvote count: 1
answers question: http://stackoverflow.com/q/25187532

http://stackoverflow.com/comment/39300757
comment on: http://stackoverflow.com/q/25230027
has text: IIS is the most used server for .Net applications and offers a host of configurable options. If you can be more specific with the options you want configured, someone will be able to help you I am sure :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25080660
has comment: http://stackoverflow.com/comment/39023367
has body: I need help to read a decimal number in a text file using JNA. It looks funny but the problem is real. I created a simple Java program which calls a simple Fortran subroutine using JNA. Main class : package Appli; public class Appli { /** * @param args the command line arguments */ public static void main(String[] args) { // call to subroutine lecture with LECT LectInterface.LECT.lecture(); } } Interface : package Appli; import com.sun.jna.Library; import com.sun.jna.Native; /** * Interface. */ public interface LectInterface extends Library { // dynamic library. public final static LectInterface LECT = (LectInterface) Native.loadLibrary("libLect.so", LectInterface.class); /** * Fonction LECTURE. * */ public double lecture(); } The Fortran subroutine just reads a number in a text file: SUBROUTINE LECTURE () DOUBLE PRECISION VALDOUBLE INTEGER IFILE PARAMETER(IFILE=1) WRITE(*,*)'START LECTURE' OPEN(UNIT=1,FILE='/home/Fortran/fort.txt') READ(IFILE,*) VALDOUBLE WRITE(*,*)VALDOUBLE WRITE(*,*)'END LECTURE' END SUBROUTINE The text file : 2.36 When I call this subroutine with my Java program (using NetBeans) it returns : run : START LECTURE 2.000000000000000 END LECTURE I use NetBeans 8, java 7, gfortran and JNA-4.1.0 I compile with: gfortran -fno-underscoring -fPIC -c -g -o LECTURE.o LECTURE.f Then gfortran -shared -o libLect.so LECTURE.o I can't explain why the READ function only takes the first part of the number (before the decimal point), for example: 2.200 =&gt; 2.000000000000000 0.12 =&gt; 0.000000000000000 12.023 =&gt; 12.000000000000000 100000.0182 =&gt; 100000.000000000000000 I did several tests with the compilers ifort (Intel) and pgf90 (PGI). With pgf90, the result is still false, but with ifort, the value is read correctly. Compilation: ifort -c -fPIC LECTURE.f Creation of the dynamic library: ifort -shared -o libLect.so LECTURE.o Result: 2.3 I also compile the sources with gfortran using the same options than ifort. The value is false (2.0). Is there a compilat…
answer count: 0
upvote count: 2
tagged with: fortran
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39029574
has comment: http://stackoverflow.com/comment/39083580
tagged with: java
has title: Can't read a decimal number in a file using JNA
type: Question
has comment: http://stackoverflow.com/comment/39029369
has comment: http://stackoverflow.com/comment/39083315
has comment: http://stackoverflow.com/comment/69364391
has comment: http://stackoverflow.com/comment/39022751
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/1126028
tagged with: jna
tagged with: gfortran
has comment: http://stackoverflow.com/comment/39022113
score: 2

http://stackoverflow.com/a/25223838
upvote count: 1
score: 1
has body: This could happen if you are using an older MySQL driver with a newer MySQL database. Make sure you are using the latest version of the MySQL Connector/J.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39615817
answers question: http://stackoverflow.com/q/25221542
type: Answer
accepted answer of: http://stackoverflow.com/q/25221542
has comment: http://stackoverflow.com/comment/39629370
has comment: http://stackoverflow.com/comment/39632183

http://stackoverflow.com/q/25179366
has comment: http://stackoverflow.com/comment/39209785
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25180096
tagged with: java
possible better answer: http://stackoverflow.com/a/25180087
downvote count: 1
type: Question
tagged with: regex-greedy
accepted answer: http://stackoverflow.com/a/25180429
has answer: http://stackoverflow.com/a/25180754
score: 0
tagged with: regex-alternation
upvote count: 1
has answer: http://stackoverflow.com/a/25180087
favorite count: 0
has answer: http://stackoverflow.com/a/25180429
has comment: http://stackoverflow.com/comment/39206033
has comment: http://stackoverflow.com/comment/39206095
has title: Priority in regex manipulating
tagged with: regex
has body: I write some java code to split string into array of string. First, I split that string using regex pattern "\\,\\,|\\," and then I split using pattern "\\,|\\,\\,". Why there are difference between output of the first and output of the second? public class Test2 { public static void main(String[] args){ String regex1 = "\\,\\,|\\,"; String regex2 = "\\,|\\,\\,"; String a = "20140608,FT141590Z0LL,0608103611018634TCKJ3301000000018667,3000054789,IDR1742630000001,80507,1000,6012,TCKJ3301,6.00E+12,ID0010015,WADORI PURWANTO,,3000054789"; String ss[] = a.split(regex1); int index = 0; for(String m : ss){ System.out.println((index++)+ ": "+m+"|"); } } } Output when using regex1: 0: 20140608| 1: FT141590Z0LL| 2: 0608103611018634TCKJ3301000000018667| 3: 3000054789| 4: IDR1742630000001| 5: 80507| 6: 1000| 7: 6012| 8: TCKJ3301| 9: 6.00E+12| 10: ID0010015| 11: WADORI PURWANTO| 12: 3000054789| And when using regex2: 0: 20140608| 1: FT141590Z0LL| 2: 0608103611018634TCKJ3301000000018667| 3: 3000054789| 4: IDR1742630000001| 5: 80507| 6: 1000| 7: 6012| 8: TCKJ3301| 9: 6.00E+12| 10: ID0010015| 11: WADORI PURWANTO| 12: | 13: 3000054789| I need some explanation of how regex engine works when handling this situation.
answer count: 4

awk
tag name: awk
type: Tag
tags question: http://stackoverflow.com/q/25085630

http://stackoverflow.com/q/25222811
has answer: http://stackoverflow.com/a/39610637
has answer: http://stackoverflow.com/a/43816268
has comment: http://stackoverflow.com/comment/39287301
linked to: http://stackoverflow.com/q/860187
linked to: http://stackoverflow.com/q/20196936
linked to: http://stackoverflow.com/q/6881622
linked to: http://stackoverflow.com/q/1089904
has answer: http://stackoverflow.com/a/64110518
tagged with: macos
has answer: http://stackoverflow.com/a/28331980
favorite count: 0
has comment: http://stackoverflow.com/comment/39287354
has answer: http://stackoverflow.com/a/43572320
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/47657513
has body: Here is the code: package mscontroller; import javax.swing.*; import com.apple.eawt.Application; public class Main { public static void main(String[] args) { Application app = new Application(); app.setEnabledAboutMenu(true); AMEListener listener = new AMEListener(); app.addApplicationListener(listener); JFrame mainFrame = new JFrame("Application Menu Example"); mainFrame.setSize(500, 500); mainFrame.setVisible(true); } } here is the error: Exception in thread "main" java.lang.Error: Unresolved compilation problems: Access restriction: The type 'Application' is not API (restriction on required library '/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar') Access restriction: The constructor 'Application()' is not API (restriction on required library '/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar') Access restriction: The type 'Application' is not API (restriction on required library '/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar') Access restriction: The method 'Application.setEnabledAboutMenu(boolean)' is not API (restriction on required library '/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar') AMEListener cannot be resolved to a type AMEListener cannot be resolved to a type at mscontroller.Main.main(Main.java:9) eclipse says this: Access restriction: The type 'Application' is not API (restriction on required library '/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar')
has answer: http://stackoverflow.com/a/41651410
has answer: http://stackoverflow.com/a/58036771
has answer: http://stackoverflow.com/a/29551851
has comment: http://stackoverflow.com/comment/39287115
has comment: http://stackoverflow.com/comment/106903602
answer count: 22
has comment: http://stackoverflow.com/comment/39287399
linked to: http://stackoverflow.com/q/4183864
has answer: http://stackoverflow.com/a/43836904
has answer: http://stackoverflow.com/a/37169990
has answer: http://stackoverflow.com/a/40626294
has comment: http://stackoverflow.com/comment/41951346
tagged with: java
score: 210
has answer: http://stackoverflow.com/a/30732564
tagged with: eclipse
upvote count: 210
has answer: http://stackoverflow.com/a/40996017
has answer: http://stackoverflow.com/a/55753341
type: Question
has answer: http://stackoverflow.com/a/46513651
has answer: http://stackoverflow.com/a/50223720
has answer: http://stackoverflow.com/a/61324272
has answer: http://stackoverflow.com/a/29329228
downvote count: 0
tagged with: jar
has answer: http://stackoverflow.com/a/71613322
has answer: http://stackoverflow.com/a/68836080
linked to: http://stackoverflow.com/q/9266632
has comment: http://stackoverflow.com/comment/39287124
has answer: http://stackoverflow.com/a/54184608
has answer: http://stackoverflow.com/a/26676046
has title: Access restriction: The type 'Application' is not API (restriction on required library rt.jar)

http://stackoverflow.com/comment/39073210
type: Comment
has text: i am not how to store a sublist to find the product.
type: AnswerComment
comment on: http://stackoverflow.com/a/25107917
score: 0

http://stackoverflow.com/q/25164177
tagged with: swing
tagged with: java
type: Question
tagged with: bufferstrategy
has answer: http://stackoverflow.com/a/25164356
answer count: 1
has title: Flicking Image in Java with BufferStrategy
score: 0
has body: I'm trying to render an Image with a BufferStrategy and Graphics2D. The Code works well, but the Image is flickering. Before I tested it with Graphics2D, I tried only with Graphics and the Frame was flickering crazy. Here's the Code: public Main() { x = 0; Dimension size = new Dimension(sx, sy); setPreferredSize(size); frame = new JFrame(); ImageIcon player2 = new ImageIcon("res/gfx/char.png"); player = player2.getImage(); addKeyListener(new AL()); time = new Timer(5, this); time.start(); } public synchronized void start() { running = true; thread = new Thread(this, "Display"); thread.start(); } public synchronized void stop() { running = false; try { thread.join(); } catch (InterruptedException e) { e.printStackTrace(); } } public void run() { while (running) { render(); update(); } } public void render() { BufferStrategy bs = getBufferStrategy(); if (bs == null) { createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics(); Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.WHITE); g2d.fillRect(0, 0, 800, 600); g2d.drawImage(player, x, 350, null); g.dispose(); bs.show(); } (Sorry for my bad english)
tagged with: graphics2d
tagged with: timer
type: UnansweredQuestion

http://stackoverflow.com/comment/39013311
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25076030
has text: @SilviuBurcea Unfortunately, no, as the client requirement is that the age should be an Integer value. **Later Edit:** indeed, manipulating the bits is a bit overkill. I would only like to use this as a very last resort :)

http://stackoverflow.com/comment/39195291
has text: +1 because of the effort.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25173208

http://stackoverflow.com/comment/39120498
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25133274
has text: @AntonioE. I would like to give you 1000 for it. Because, downvoting has become a fashion.

http://stackoverflow.com/a/25087379
has body: The update method returns encrypted block. But as I see you take the ciphertext only from doFinal. You supposed to use all blocks from update and from the doFinal for completed encrypted stream of blocks. Note: you are using ECB mode, it means each block encrypted independently, it is less secure and should be used only if you know what are you doing. That's why you are able to decrypt the last block (16 bytes for AES) and see truncated plaintext. More info: http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation
score: 7
upvote count: 7
answers question: http://stackoverflow.com/q/25087094
accepted answer of: http://stackoverflow.com/q/25087094
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/25082542
score: 4
answers question: http://stackoverflow.com/q/25082462
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39026101
accepted answer of: http://stackoverflow.com/q/25082462
has body: Have you tried .setMessage(String.ValueOf(&lt;YourIntValue&gt;);

http://stackoverflow.com/comment/39119284
type: QuestionComment
has text: Where is the code of the web service you are trying to invoke?
comment on: http://stackoverflow.com/q/25132642
score: 0
type: Comment

http://stackoverflow.com/q/25187619
has answer: http://stackoverflow.com/a/25195923
tagged with: java
linked to: http://stackoverflow.com/q/5982422
has comment: http://stackoverflow.com/comment/39221698
has comment: http://stackoverflow.com/comment/39221056
linked to: http://stackoverflow.com/q/14069418
tagged with: bufferedimage
type: Question
has body: Currently I am saving a jtable as jpeg using the below method, when the dimension of the jtable became 2590, 126181, java.lang.OutOfMemoryError: Java heap space exception occurs at "BufferedImage constructor", when the size of the table is small the image gets saved successfully. public BufferedImage saveComponentAsJPEG(JTable table, String filename) { Dimension size = table.getSize(); BufferedImage myImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = myImage.createGraphics(); table.paint(g2); return myImage; } How to save a jtable with bigger size in pdf or jpeg image?
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/39229332
answer count: 1
has comment: http://stackoverflow.com/comment/39221923
type: UnansweredQuestion
has title: OutOfMemoryError: Jave heap space when jtable saved as Image

http://stackoverflow.com/comment/39110138
type: Comment
has text: @Pshemo yup, is truth. Let's add it too
comment on: http://stackoverflow.com/a/25127431
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39224775
has text: can you provide an [MCVE](http://stackoverflow.com/help/mcve) so we can test? Also a screenshot if possible? (Post link and we edit it since you don't have enough rep yet). Also... if I'm not wrong the `getMaximumSize()` and `getMinimumSize()` should be outside the void. Try it and tell me if worked, else consider the part about MCVE :) I'll be glad to try to help you ^^
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25181929
score: 0

http://stackoverflow.com/comment/39036917
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25074043
has text: Ah I see, the filtering from the object is excellent, I will do that. Thanks.

http://stackoverflow.com/a/25201703
answers question: http://stackoverflow.com/q/25201602
downvote count: 0
type: Answer
has body: Here's how you can do that in xml: Region: %1$s And the java code: String str = getString(R.string.action_about_msg, "France"); tvRegion.setText(Html.fromHtml(str));
score: 5
upvote count: 5

http://stackoverflow.com/comment/39267951
type: QuestionComment
has text: Like the brackets and the arrow? That will always be the same no matter what.
comment on: http://stackoverflow.com/q/25212468
score: 0
type: Comment

datagram
tags question: http://stackoverflow.com/q/25085989
type: Tag
tag name: datagram

http://stackoverflow.com/a/25119839
has comment: http://stackoverflow.com/comment/39095843
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25119798
has body: You can use REGEX with \\d+. public static void main(String[] args) { String s = "1 \n2 4 \n18 \n 3 20 12 \n 4\n23"; Pattern p = Pattern.compile("\\d+"); Matcher m = p.matcher(s); while (m.find()) { System.out.println(m.group()); } } O/P : 1 2 4 18 3 20 12 4 23

http://stackoverflow.com/q/25222713
has answer: http://stackoverflow.com/a/25222828
downvote count: 0
has comment: http://stackoverflow.com/comment/39289491
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: design-patterns
tagged with: 2d
score: 1
tagged with: java
has title: Differences between drawing: eg. Graphics.drawRect or Rectangle.draw
upvote count: 1
has comment: http://stackoverflow.com/comment/39287011
type: Question
has body: I am making a basic Java graphics library using OpenGL, and I was thinking about something. My library will be capable of drawing basic shapes, but as far as I am aware, there are two different ways I could do this. The first way would be similar to how Java draws graphics. There would just be one Graphics class with methods for drawing all different shapes. So it would look like Graphics g; g.drawRect(0, 0, 100, 20); The second way I thought of doing it would be to have a class for every shape (inside a Graphics package). So it would look something like this: Rectangle rect = new Rectangle(100, 20); Then you would draw it like this: rect.draw(0, 0); That way you could also have methods like rect.setSize(50, 50); rect.setColor(Color.BLUE); To change the properties of the rectangle before it is actually drawn. What are the advantages of both?
tagged with: graphics

http://stackoverflow.com/comment/39175245
score: 0
has text: Actually those are sample codes from my app. But yea you're right about that ugly names!:) Now I'm gonna try that inject thing then let you know!.
type: Comment
comment on: http://stackoverflow.com/a/25162812
type: AnswerComment

http://stackoverflow.com/comment/39282742
type: QuestionComment
has text: @JBNizet not *that* much faster unless you use a distributed algo to calculate 1+1.
score: 0
comment on: http://stackoverflow.com/q/25220281
type: Comment

http://stackoverflow.com/q/25155747
has answer: http://stackoverflow.com/a/25155864
answer count: 1
tagged with: jsp
has title: How to write request.getRemoteHost() method in servlet init() method?
has comment: http://stackoverflow.com/comment/39162212
has body: How to write request.getRemoteHost() method in servlet init() method? eg: public void init() throws ServletException { String remoteHost = request.getRemoteHost(); System.out.println("----------"); System.out.println("------ ServletInitializer Servlet Initialized successfully ------"); System.out.println("----------remoteHost :"+remoteHost); }
duplicate of: http://stackoverflow.com/q/6164167
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6164167
type: Question
has comment: http://stackoverflow.com/comment/39162088
tagged with: java
tagged with: servlets
score: 0
linked to: http://stackoverflow.com/q/16448995

http://stackoverflow.com/q/25186238
has comment: http://stackoverflow.com/comment/39224268
downvote count: 0
has comment: http://stackoverflow.com/comment/39222973
favorite count: 0
has body: I have a JavaFX PieChart, and I want to have a color associated with specific regions. However, it seems like I can only have colors associated with the order that the Data is added to the chart. For example, if I want to plot the colors of cars in a parking lot, I could do this: .default-color0.chart-pie { -fx-pie-color: #FF0000; } .default-color1.chart-pie { -fx-pie-color: #00FF00; } .default-color2.chart-pie { -fx-pie-color: #0000FF; } .default-color3.chart-pie { -fx-pie-color: #FFFF00; } .default-color4.chart-pie { -fx-pie-color: #00FFFF; } As long as I add my "red car" data first, and then the "green car" data, etc, everything is fine. But If there are no red cars, and I don't add that Data, then the green cars become red, as they are the first data point. I could add a Data("Red", 0), but then that shows up in my PieChart as a slice with zero area, but it still has a label, and it could be confusing. Is there any way to avoid this? Either to mark Data objects with zero data as invisible, or assign constant colors to categories?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39224178
upvote count: 1
linked to: http://stackoverflow.com/q/15219334
has comment: http://stackoverflow.com/comment/39223141
tagged with: charts
has answer: http://stackoverflow.com/a/25194025
score: 1
tagged with: java
tagged with: javafx
has title: Constant colors on a PieChart
has comment: http://stackoverflow.com/comment/39227849
has comment: http://stackoverflow.com/comment/39220649
type: Question
has answer: http://stackoverflow.com/a/25191596
answer count: 2

http://stackoverflow.com/comment/39358951
type: AnswerComment
comment on: http://stackoverflow.com/a/25259362
type: Comment
has text: Yes, and most components do not trigger these events, that's why the RenderNotification mixin is so helpful. I usually look at the top of each component to see which events it may fire (they are defined with the @Events annotation, which is for documentation purposes only).
score: 2

http://stackoverflow.com/q/25125619
type: Question
tagged with: ejb
tagged with: jpa
has body: How to fetch data on the basis of YEAR using openjpa from database. I have a timestamp(RECEIPT_DATE) field in my database. Now i went to fetch the data from the database on the basis of selected year. Query is as below: select contact_names from contact where YEAR(RECEIPT_DATE)='2014'. This works perfectly in database. The same i wrote in JPA like this. select contactNames from contact where year(receiptDate)='2014'. But i get an error like Year Arguement cannot be recognized. Is there any way to how can i perform the same query using JPA preferably not making use of any additional plugins for the same. Please guide.
has comment: http://stackoverflow.com/comment/39106431
has comment: http://stackoverflow.com/comment/39106566
score: 0
answer count: 3
tagged with: sql
has title: Filtering in query using JPA in java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25128675
has answer: http://stackoverflow.com/a/25134044
linked to: http://stackoverflow.com/q/15802989
tagged with: java
has answer: http://stackoverflow.com/a/25125969

http://stackoverflow.com/a/25291016
has body: You need to configure Web Deployment Assembly in STS. Try following: Go to myproject_mvc's properties -> Deployment Assembly. Click Add button. Add dependency projects. Hope this helps.
answers question: http://stackoverflow.com/q/25229361
has comment: http://stackoverflow.com/comment/39416907
score: 0
type: Answer

http://stackoverflow.com/q/25097408
answer count: 1
tagged with: jsp
tagged with: tomcat
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39053780
has answer: http://stackoverflow.com/a/25097689
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39053551
has comment: http://stackoverflow.com/comment/39053653
has title: How to call images from file system?
has comment: http://stackoverflow.com/comment/39053654
has body: I am using eclipse WTP for developing web applications on on Ubuntu OS being deployed on a tomcat server. I want to make use of images in my file system in the web app (display them). How can I do it efficiently ? Is it by using context path to location on drive ? or is it by loading them (or something like that) using streaming ? Also, I could not find any web.xml or server.xml file in WTP project (since newer version doesn't even require them). Rephrasing : I want to use images (static content) from file system in my web app. Using JSTL on the front-end. Edit : If web app is xyz then its location is : /home/webaapp/xyz/..... and images are at /home/akshay/images/....... I want to access a folder far away (in same hard drive) from web app
tagged with: servlets
score: 0
tagged with: jstl

http://stackoverflow.com/q/25204448
type: Question
tagged with: appium
has answer: http://stackoverflow.com/a/34715622
score: 0
answer count: 2
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25260817
tagged with: cordova
type: UnansweredQuestion
tagged with: android
has title: Java/Selenium/Appium Android APK Device Chromedriver Issue
linked to: http://stackoverflow.com/q/34376582
tagged with: java
tagged with: selenium
has body: This is a Sencha Touch 2 application, Cordova wrapped, and built as an APK, that I am testing on a physical device. The second screen in the application after log in is entirely wrapped in an android.webkit.WebView, and I am unable to interact with any of the elements that I can find (typically in the wrong spot or completely off the screen) using UIAutomatorviewer. My last ditch attempt at getting this to work was to switch to the WEBVIEW_com.tgs.senchabuild context on that page (and in future pages) in able to interact with aforementioned UI elements. Now that I have had webcontent debugging enabled on the APK, I am now getting this error that my chrome version does not meeting the requirement of being >= 33.0.1750.0, which it clearly does. I'm testing a hybrid Cordova application and finally was able to switch to WebView, however when it does, Chromedriver fails launch: My capabilities: DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("appPackage", "com.tgs.senchabuild"); capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("app", app.getAbsolutePath()); capabilities.setCapability("udid", n10Udid); capabilities.setCapability("deviceName", "Nexus 10"); Appium output (at least the piece that gives me an error): ERROR: error: Chromedriver create session did not work. Status was 200 and body was {"sessionId":"fde047ed1f488a11366a6f3a10c25458","status":13,"value":{"message":"unknown error: Chrome version must be >= 33.0.1750.0\n (Driver info: chromedriver=2.10.267521,platform=Windows NT 6.1 SP1 x86_64)"}} I am so close to getting this darn automation to work...please HELP!!! :)

http://stackoverflow.com/a/25102133
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25102058
type: Answer
accepted answer of: http://stackoverflow.com/q/25102058
has body: Add a break after each case. Without this, all your cases are executed, with the last one setting the color to blue.
upvote count: 2
score: 2

http://stackoverflow.com/q/25141194
accepted answer: http://stackoverflow.com/a/25141717
has title: Music Service stopped onPressing backbutton
type: Question
tagged with: android-service-binding
has comment: http://stackoverflow.com/comment/39136180
has comment: http://stackoverflow.com/comment/39156458
has body: I have a actionbaractivity with one fragment attached with it and one service class which is streaming music from url. below i paste some code for reference TopTenFragment.java public class ToptenFragment extends Fragment { private ListView TrackList; private CustomAdapter songadapter; private ArrayList&lt;Song&gt; songList; int currentduration; ArrayList&lt;Integer&gt; buttonposiotion = new ArrayList&lt;Integer&gt;(); private int curBtnIndex = -1; // private boolean paused = false; private int lastpos; // service private MyService musicSrv; private Intent playIntent; // binding private boolean musicBound = false; // activity and playback pause flags private boolean paused = false, playbackPaused = false; int i = 0; int start = 0; String urlindex; public ImageView imageView; private ProgressBar bar; private WeakReference&lt;Activity&gt; mainActivityWeakRef; @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); System.out.println("onActivityCreated"); mainActivityWeakRef = new WeakReference&lt;Activity&gt;( (Activity) getActivity()); if (mainActivityWeakRef.get() != null &amp;&amp; !mainActivityWeakRef.get().isFinishing()) { getData(); } SharedPreferences onStopPf = getActivity().getSharedPreferences( "On Stop", 0); Editor stEditor = onStopPf.edit(); curBtnIndex = onStopPf.getInt("btnIndex", -1); stEditor.commit(); System.out.println("curt index from top -&gt; " + curBtnIndex); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { System.out.println("onCreateView"); View v = inflater.inflate(R.layout.main, container, false); initLayout(v); return v; } private void initLayout(View v) { TrackList = (ListView) v.findViewById(R.id.songList); // get image for ad imageView = (ImageView) v.findViewById(R.id.radio_adview); bar = (ProgressBar) v.findViewById(R.id.load); } public void getData() { Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;…
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
tagged with: android
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/25141717
tagged with: java

http://stackoverflow.com/a/25191076
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/25190987
score: 2
answers question: http://stackoverflow.com/q/25190987
has body: The map keys are of type long[] (binary name [J) but you're trying to use a hasher that works with byte[] ([B). Try using Hasher.LONG_ARRAY instead.
has comment: http://stackoverflow.com/comment/39233175
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39005380
type: Comment
has text: @pez the operator regex should be changed. See fix above.
comment on: http://stackoverflow.com/a/25070185
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39270508
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25213700
has text: `Singleton is a Java pattern` wrong, it is not specific to Java. `People use singleton when they want unscoped global values, you know, just like C global variables` Wrong again. Unscoped C global variables are just that - *unscoped*. They are dangling symbols with no ownership, thus making them *wild-west*-ey and thus hard to maintain/predict. Singleton classes provide a scope, and **do** provide logic and proper ownership and management. What you believe `static {}` to be meant for is your own concern - it was simply provided here for informational accuracy.

http://stackoverflow.com/q/25110438
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39078018
tagged with: java
has comment: http://stackoverflow.com/comment/39078114
tagged with: methods
type: Question
tagged with: object
has body: I have a program where I must see if the two names entered are equal and get other information about the names(such as length, or get the initials). Everything else runs properly but the equals method. I get the error: the method equals(object) in the type object is not applicable to the arguments(Name, Name) and I cannot figure out how to resolve this error. Can someone please help me understand what the error means? Here is my class name with all the methods: class Name { private String firstName; private String middleName; private String lastName; public Name(String first, String middle, String last) { firstName = first; middleName = middle; lastName = last; } public String getFirst() { return firstName; } public String getMiddle() { return middleName; } public String getLast() { return lastName; } public String firstMiddleLast() { return (firstName + " " + middleName + " " + lastName); } public String lastFirstMiddle() { return (lastName + ", " + firstName + " " + middleName); } public boolean equals(Object name, Object otherName) { (name.toString()).toUpperCase(); (otherName.toString()).toUpperCase(); if (name.equals(otherName)) return true; else return false; } public String initials() { String initials = (firstName.toUpperCase().substring(0, 1) + middleName.toUpperCase().substring(0, 1) + lastName.toUpperCase().substring(0, 1)); return initials; } public int length() { String wholeName = (firstName + middleName + lastName); return wholeName.length(); } } Here is the other class that tests name. import java.util.Scanner; public class TestName { public static void main(String[] args) { String first, middle, last; String firstOne, middleOne, lastOne; Scanner input = new Scanner(System.in); System.out.println("Name Program"); System.out.println(); System.out.println("Name of the first person..."); System.out.println("Enter the first name: "); first = input.nextLine(); System.out.println("Enter the middle name: "); middle = input.nextLine(); System.out.println("En…
has comment: http://stackoverflow.com/comment/39077994
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/39078129
has title: the method equals(object) in the type object is not applicable to the arguments
answer count: 1
tagged with: equals
has answer: http://stackoverflow.com/a/25110516
accepted answer: http://stackoverflow.com/a/25110516

http://stackoverflow.com/tag/csv
type: Tag
tag name: csv
tags question: http://stackoverflow.com/q/25204496
tags question: http://stackoverflow.com/q/25155736
tags question: http://stackoverflow.com/q/25220864
tags question: http://stackoverflow.com/q/25133037
tags question: http://stackoverflow.com/q/25135285
tags question: http://stackoverflow.com/q/25107158
tags question: http://stackoverflow.com/q/25184911

http://stackoverflow.com/comment/39071681
has text: http://docs.oracle.com/javase/tutorial/essential/regex/matcher.html
comment on: http://stackoverflow.com/q/25107008
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25134979
upvote count: 2
has body: 1st: Check if a horse is alive like @Momo posted, with a small correction by @CrypticStorm 2nd: Class HorseTimer should extend BukkitRunnable onstead of implementing Rumnable so it can cancel itself see http://wiki.bukkit.org/Scheduler_Programming#Self-Canceling_Example_2
answers question: http://stackoverflow.com/q/25119125
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/39144645
type: Comment
type: QuestionComment
has text: @Athanor yes I want to interact with it that is why synchronizing would be a challange
score: 0
comment on: http://stackoverflow.com/q/25145494

http://stackoverflow.com/a/34464856
upvote count: 1
has body: Generally, in ProGuard, you can use the following to shrink your APK (this is in your module's build.gradle file): ... android { ... buildTypes { release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } ... } ... Specifically, look at minifyEnabled true and shrinkResources true: minifyEnabled is responsible for obfuscating and shrinking your code files (e.g. Java). It is the main feature of ProGuard, and helps to shrink your APK as well as making it difficult to reverse engineer. shrinkResources is used to remove unused resource files (such as images and other assets). For example, if you are compiling with an Android library, but you are not using some images in that Android library, they will not be included in the final build. There is a good Android Developers video about it here.
downvote count: 0
answers question: http://stackoverflow.com/q/25101534
type: Answer
score: 1

http://stackoverflow.com/comment/39135662
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25141321
score: 0
has text: I'm sorry, I really didn't follow that - you should explain in more detail *exactly* what you mean in your question.

http://stackoverflow.com/comment/39215045
comment on: http://stackoverflow.com/q/25183635
score: 0
type: Comment
type: QuestionComment
has text: Please show us the code behind `TestClass.testMethod(letters, numbers)`: I suspect it cannot handle an empty List.

http://stackoverflow.com/comment/39255127
type: Comment
type: QuestionComment
has text: What persistence framework are you using? You could set your relationships to lazy-load, and simply not fetch child objects when making requests to particular controller methods.
comment on: http://stackoverflow.com/q/25194535
score: 0

http://stackoverflow.com/a/25191429
score: 2
accepted answer of: http://stackoverflow.com/q/25191388
answers question: http://stackoverflow.com/q/25191388
has body: Try calling c.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36"); It will set the user agent property to Chrome (desktop) browser.
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/39145404
type: QuestionComment
comment on: http://stackoverflow.com/q/25101559
type: Comment
has text: In 3.9, there's no constructor which takes a File. Make sure you use either the latest version or use a constructor that is available in your version.
score: 0

http://stackoverflow.com/q/25207613
tagged with: shutdown-hook
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/25208282
tagged with: java
has title: Java Concurrency: Run until terminated
tagged with: terminate
tagged with: concurrency
type: Question
has comment: http://stackoverflow.com/comment/39258896
has body: I'm currently refactoring a chunk of code that pretty much goes like this: public static void main(String... args) { while (true) { // Do something... Thread.sleep(300000); // Every 5 minutes } } The idea is that I want to use a ScheduledExecutorService to do the running of the code: public static void main(String... args) { ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); service.scheduleAtFixedRate(new Task(...), 0, 5, TimeUnit.MINUTES); } There are a few concerns that I have with this, though: firstly, the fact that the program "terminates" (as in main() returns) after scheduling, but the JVM is kept alive because the ScheduledExecutorService remains running. I believe that this is intentional, in order to maintain the old code's behavior of "keep running until terminated from the outside", but I believe that I would have to install a shutdown hook to ensure that the ScheduledExecutorService shuts down properly. Will that actually be the case, or will "killed from the outside" also prevent execution of the shutdown hook? Secondly, I'm also squeamish about having a shutdown hook in the first place. If I had code like try { while (true) {} } finally { // Shutdown hook code goes here instead service.shutdown(); if (!service.awaitTermination(1, TimeUnit.SECONDS)) { service.shutdownNow(); } } will the same "killed from the outside" concern as above still exist? EDIT: Yes, the original program loops through without ever breaking through the loop; it was only meant to be terminated from, say, SIGINT (control-C in a terminal). It is a rather poorly-defined termination condition, but that is the only thing that I have right now...
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25210501
has answer: http://stackoverflow.com/a/25207896
score: 1
favorite count: 0
tagged with: scheduledexecutorservice

http://stackoverflow.com/q/25083153
has answer: http://stackoverflow.com/a/25083450
has comment: http://stackoverflow.com/comment/39027303
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39026889
has comment: http://stackoverflow.com/comment/39026969
has title: Split by regex with no particular range
type: UnansweredQuestion
tagged with: regex
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39026858
has body: im facing a problem regarding parsing of this text. I want to split it by unique account#. see below: Account#: 1 Data1 Data2 Data3 Account#: 1 Data4 Data5 Data6 Account#: 1 Data7 Data8 Data9 Account#: 2 Data10 Data11 Data12 Account#: 2 Data13 Data14 Data15 Account#: 3 Data16 Data17 Data18 Account#: 3 Data19 Data20 Data21 The result should be in my first index it will composed of Account#: 1 with Data1-9, then in my second index Account#: 2 with Data 10-15 and so on.. ("Data" here is composed of new lines and etc) I'm thinking to use the split(regex) but, how can i regex the range of account#? is there any chance that regex can match unique values? Thanks for the response.

http://stackoverflow.com/comment/39258648
comment on: http://stackoverflow.com/a/25207575
type: AnswerComment
score: 0
has text: it doesnt provide an api and developer key at current stage :(
type: Comment

http://stackoverflow.com/comment/39181404
type: Comment
has text: @AngeloAlvisi - Do you realize that (for example) `2 +/- 25%` cannot be reasonably expressed as integer?
comment on: http://stackoverflow.com/a/25165913
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39242491
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25198890
has text: No it is plain text file (.txt)

http://stackoverflow.com/q/25216955
type: UnansweredQuestion
tagged with: plugins
score: 0
tagged with: java
tagged with: bukkit
type: Question
tagged with: location
has body: Im trying to write a plugin, that allows the players to fly. While they are flying, there level goes down every second, and if there level is 0, fly would turned off. But in my while loop the position isnt updated and so there level wents down, altought they are back at the ground again. I read that this is because i stop the Thread, but how can i write it in an other way, so that it is still lightweight? Here is my code: public void onPlayerToggleFlight(final PlayerToggleFlightEvent e) { if(!e.getPlayer().isFlying()){ final Player p = e.getPlayer(); if(p.getGameMode() == GameMode.CREATIVE) return; getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable(){ public void run() { while((p.getLevel() &gt;= 0) &amp;&amp; (p.getLocation().subtract(0, 1, 0).getBlock().getType() == Material.AIR)){ System.out.println(e.getPlayer().getLocation()); p.setLevel(p.getLevel() - 1); try { Thread.sleep(1000); } catch (InterruptedException e1) { e1.printStackTrace(); } } p.setAllowFlight(false); System.out.println(p.getLocation()); }}); } } And the Levelindicator is only updated when its 0. For example my level is 8 and i start flying, 8 seconds later i fall down and my level changes. So i cant see how much time i have left to fly... Thanks you for your answers and sorry for my bad english ;D
has answer: http://stackoverflow.com/a/25217127
tagged with: while-loop
answer count: 1
has title: Location isnt updated in Bukkit-Plugin

http://stackoverflow.com/a/27483371
has comment: http://stackoverflow.com/comment/107662019
accepted answer of: http://stackoverflow.com/q/25229124
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25229124
downvote count: 0
has comment: http://stackoverflow.com/comment/101878021
upvote count: 531
has body: Time Zone To format an Instant a time-zone is required. Without a time-zone, the formatter does not know how to convert the instant to human date-time fields, and therefore throws an exception. The time-zone can be added directly to the formatter using withZone(). DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedDateTime( FormatStyle.SHORT ) .withLocale( Locale.UK ) .withZone( ZoneId.systemDefault() ); If you specifically want an ISO-8601 format with no explicit time-zone (as the OP asked), with the time-zone implicitly UTC, you need DateTimeFormatter.ISO_LOCAL_DATE_TIME.withZone(ZoneId.from(ZoneOffset.UTC)) Generating String Now use that formatter to generate the String representation of your Instant. Instant instant = Instant.now(); String output = formatter.format( instant ); Dump to console. System.out.println("formatter: " + formatter + " with zone: " + formatter.getZone() + " and Locale: " + formatter.getLocale() ); System.out.println("instant: " + instant ); System.out.println("output: " + output ); When run. formatter: Localized(SHORT,SHORT) with zone: US/Pacific and Locale: en_GB instant: 2015-06-02T21:34:33.616Z output: 02/06/15 14:34
type: Answer
has comment: http://stackoverflow.com/comment/54375464
score: 531
has comment: http://stackoverflow.com/comment/84255794
has comment: http://stackoverflow.com/comment/96656568

http://stackoverflow.com/q/25140925
downvote count: 0
possible better answer: http://stackoverflow.com/a/25141575
favorite count: 0
has answer: http://stackoverflow.com/a/25141575
has body: Im trying to get the code flow of an open source platform. I have got the source code and ran the program from eclipse. The program has an option called "Run job" and I want to know where the control goes when that option is clicked. How can achieve this?
has answer: http://stackoverflow.com/a/25143906
tagged with: eclipse-rcp
has title: Eclipse debugging : Stack trace on event
has comment: http://stackoverflow.com/comment/39135060
has comment: http://stackoverflow.com/comment/39134844
upvote count: 1
accepted answer: http://stackoverflow.com/a/25143906
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
type: Question
answer count: 2

http://stackoverflow.com/q/25163805
answer count: 3
accepted answer: http://stackoverflow.com/a/25163933
has comment: http://stackoverflow.com/comment/39193830
favorite count: 0
has body: I'm fairly new to Java Swing and I'm running into a few problems. As a side question, when making a fairly large Java Swing Application, what is the best way to split up code? In my case I want to have an application that has a layout just as Microsoft Word where there is a JToolBar filled with buttons and a main JPanel where changes are made based on the buttons pressed in the Tool Bar. So as shown in the code below, I have a JFrame and I call the MainPanel class in order to create a panel and add a ToolBar with a button. When the button is pressed it adds a button to the panel. The problem comes when you click the button nothing shows up until you resize the window(in my case I simply manually drag the screen to make it larger). public class Main { private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("MathMaker"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create the menu bar. Make it have a green background. //MainToolBar mainTB = new MainToolBar(); MainPanel mainPanel = new MainPanel(); frame.getContentPane().add(mainPanel.getGUI(), BorderLayout.CENTER); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } } public class MainPanel implements ActionListener{ JPanel mPanel; JToolBar mToolBar; JButton addQuestion; public MainPanel() { mPanel = new JPanel(new BorderLayout()); mToolBar = new JToolBar(); addQuestion = new JButton("test"); addQuestion.addActionListener(this); mPanel.setLayout(new BorderLayout()); mPanel.setBackground(new Color(248, 213, 131)); mPanel.setPreferredSize(new Dimension(200, 180)); mToolBar.add(addQuestion); mPanel.add(mToolBar, BorderLayout.PAGE_START); } public JComponent getGUI() { return mPanel; } @Override public void actionPerformed(ActionEvent e) { JB…
has answer: http://stackoverflow.com/a/25163917
tagged with: jtoolbar
has answer: http://stackoverflow.com/a/25163933
tagged with: swing
linked to: http://stackoverflow.com/q/4279435
upvote count: 4
tagged with: jbutton
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
downvote count: 0
possible better answer: http://stackoverflow.com/a/25163897
tagged with: java
tagged with: jpanel
has answer: http://stackoverflow.com/a/25163897
type: Question
linked to: http://stackoverflow.com/q/5621338
score: 4
has title: JPanel doesn't update when adding Component in another class

http://stackoverflow.com/q/25163960
downvote count: 0
answer count: 5
tagged with: lazy-loading
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/25242377
has answer: http://stackoverflow.com/a/25336463
has answer: http://stackoverflow.com/a/25251700
tagged with: java
tagged with: hibernate
score: 9
tagged with: jpa
has answer: http://stackoverflow.com/a/25243269
has title: Hibernate override "lazy=false"
upvote count: 9
has answer: http://stackoverflow.com/a/36137012
linked to: http://stackoverflow.com/q/4374528
tagged with: hibernate-mapping
linked to: http://stackoverflow.com/q/8815209
favorite count: 0
has body: I am working on a new module in an existing project. The project already has a user table, a pojo and a corresponding mapping file. The problem is that they are fetching all the properties eagerly by mentioning lazy="false". But, in my module, I am doing lot of read &amp; write in a single request, so I don't want to fetch eagerly. What I want to know is that, is it possible to create an another mapping file for the same table &amp; same pojo to load all the properties lazily? I have tried by assigning different entity-name for the mapping files, but while deploying, I am getting the error "Repeated column in mapping for entity". I saw this answer, but it says "do not map child", then how will I get the proxies?

http://stackoverflow.com/comment/39087210
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25115114
type: Comment
has text: I had the exact same requirements as you, the only way is to use setAccountUser for each user. I also tried using an admin user but it does not work.

http://stackoverflow.com/comment/39122369
has text: It might be due to serverdown..
type: Comment
comment on: http://stackoverflow.com/q/25132171
type: QuestionComment
score: 0

http://stackoverflow.com/a/25092873
has body: Looks like your project having build issue project-&gt;properties-&gt;java build path-&gt;libraries and check if any jar showing with red color.Remove these from path and add only required jars, and Do the project clean and build it again. To ensure whether your project is working fine or not you can try to execute a simple "helloworld" programs. Once its done you will find that import error is automatically gone.
answers question: http://stackoverflow.com/q/25092460
score: 0
type: Answer

http://stackoverflow.com/comment/39289074
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25220492
has text: @EJP Fixed the question, the JavaDoc isn't *that* clear on what generateSeed does in my opinion, "the seed generation algorithm" is not specified at all.
type: QuestionComment

http://stackoverflow.com/q/25073684
has answer: http://stackoverflow.com/a/25073749
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/25073749
has answer: http://stackoverflow.com/a/25073703
has comment: http://stackoverflow.com/comment/39008920
has comment: http://stackoverflow.com/comment/40078769
has answer: http://stackoverflow.com/a/25073739
has body: I'm trying to make a number squared (for example, x^2) in Android code, but I get this error: The operator ^ is undefined for the argument type(s) int, boolean is there a different way to square a number/variable in Android?
type: AnsweredQuestion
tagged with: math
tagged with: java
accepted answer: http://stackoverflow.com/a/25073703
type: Question
has title: How to take the square of a number in Android
tagged with: perfect-square

http://stackoverflow.com/q/25101589
possible better answer: http://stackoverflow.com/a/25101606
has answer: http://stackoverflow.com/a/25101606
answer count: 4
has title: In Java, how can I wait for one of multiple threads to exit?
has answer: http://stackoverflow.com/a/25101616
has comment: http://stackoverflow.com/comment/39061380
upvote count: 2
has answer: http://stackoverflow.com/a/25102210
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39061365
accepted answer: http://stackoverflow.com/a/25101616
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25107256
has body: In Java you can use Thread.join() to wait for a thread to exit Is there a similar method that will allow you to wait for any thread in a list of threads to exit? This would be similar to the wait(2) Unix system call that returns when any child process exits.
tagged with: java
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/24981726
favorite count: 0
has comment: http://stackoverflow.com/comment/39061391

http://stackoverflow.com/a/25093352
score: 1
answers question: http://stackoverflow.com/q/25090721
upvote count: 1
type: Answer
downvote count: 0
has body: You can't tell in a standard Thread and as mentioned if you need this, then a Queue is more likely to be useful. In this case, a better solution is likely to be a state change. e.g. // change state in a thread safe manner sharedObject.setState(Mode.ACTION); thread.interrupt(); // doesn't need to know about other threads, just state changes. if (isInterrupted()) { switch(sharedObject.getState()) { case ACTION: } } More generically, you could inject tasks for the thread to run. // calling thread needs an action to perform. sharedThread.execute(runnable); // or invokeLater() // polling thread, use take() if you want to block. for(Runnable run; (run = runQueue.poll()) != null;) run.run(); However, this doesn't mean it can't be done just because it's probably not a good idea. public class Main { static class MyThread extends Thread { protected final Queue&lt;Thread&gt; interruptingThreads = new ConcurrentLinkedQueue&lt;&gt;(); MyThread(Runnable target) { super(target); } public Queue&lt;Thread&gt; getInterruptingThreads() { return interruptingThreads; } @Override public void interrupt() { interruptingThreads.add(Thread.currentThread()); super.interrupt(); } } public static void main(String... ignored) throws Exception { Thread t = new MyThread(new Runnable() { @Override public void run() { try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); System.err.println("Interrupted by :" + ((MyThread) Thread.currentThread()).getInterruptingThreads()); } } }); t.start(); Thread.sleep(500); t.interrupt(); } } prints java.lang.InterruptedException: sleep interrupted at java.lang.Thread.sleep(Native Method) at Main$1.run(Main.java:53) at java.lang.Thread.run(Thread.java:745) Interrupted by :[Thread[main,5,]] If this is debugging purposes, you could also add a stack trace of where the interrupting thread, called interrupt()

http://stackoverflow.com/q/25148719
has title: Synchronization across classes
possible better answer: http://stackoverflow.com/a/25148851
upvote count: 2
tagged with: multithreading
has body: I have two threads running concurrently, a main thread and a listener that implements Runnable. The main thread and listener each have a critical section, specifically the method getObjectList(String) in the Manager class that runs in the main thread and handleNewObjects(String, List&lt;Object&gt;) that runs in the listener thread. My current plan is to make getObjectList() a synchronized method: class Manager { protected synchronized getObjectList() { // Do critical section stuff } } and make handleNewObjects() look like this class Listener implements Runnable { private final Manager myManager; handleNewObjects() { synchronized (myManager) { // Do critical section stuff } } } Will this ensure my critical sections never run simultaneously? Should I synchronize some other way?
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25148883
has answer: http://stackoverflow.com/a/25148953
type: Question
answer count: 3
score: 2
downvote count: 0
tagged with: critical-section
favorite count: 0
tagged with: synchronization
tagged with: synchronized
has answer: http://stackoverflow.com/a/25148851
has answer: http://stackoverflow.com/a/25148883

object-to-string
tags question: http://stackoverflow.com/q/25132734
tag name: object-to-string
type: Tag

http://stackoverflow.com/comment/39130223
score: 0
type: QuestionComment
has text: Hi. While we'd love to help, the information you have provided is simply not enough. What did you try, what error messages did you get exactly, and all that kind of information would be helpful.
type: Comment
comment on: http://stackoverflow.com/q/25138623

http://stackoverflow.com/comment/39138621
comment on: http://stackoverflow.com/a/25110578
type: Comment
score: 1
has text: This stuff is great! Easy to use too! My display looks awesome now, thanks!!
type: AnswerComment

http://stackoverflow.com/comment/39273938
type: AnswerComment
has text: I think JButton does not have focus because it should work if I press Enter of Spacebar, but it is not.
comment on: http://stackoverflow.com/a/25215701
type: Comment
score: 0

http://stackoverflow.com/q/25200248
favorite count: 0
has answer: http://stackoverflow.com/a/25200401
linked to: http://stackoverflow.com/q/10901259
possible better answer: http://stackoverflow.com/a/25200401
accepted answer: http://stackoverflow.com/a/25200293
has body: Below is the code package org.nagark; class baseClass{ public void callMtd(int i){ System.out.println("integer method"+i); } public void callMtd(double d){ System.out.println("double method"+d); } } public class OverRidingExample { /** * @param args */ public static void main(String[] args) { baseClass bc = new baseClass(); bc.callMtd(10/3); } } In OverRidingExample class I am calling baseClass.callMtd method with argument 10/3(as you can see in the code). As callMtd is overloaded in baseClass, which version should be called by default? as it is overloaded method binding should happen at compile time but can computation of 10/3 happen at compile time?
upvote count: 1
type: Question
tagged with: overloading
type: AnsweredQuestion
has title: Java Overloading - will computation happens at compile time or runtime?
score: 1
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/39244715
has answer: http://stackoverflow.com/a/25200293
downvote count: 0

http://stackoverflow.com/q/25152296
answer count: 1
has comment: http://stackoverflow.com/comment/39156585
has body: I use a jTable jquery for jsp page, I can Add new record and Edit data in record very well on client-server. Also I can delete record at the client, but not remove record on the server (database). Here is the code I am using right now <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Setup and Load Data to jTable using Servlets and JSP Add Reason Code Code in servlet : if (action.equals("delete")) { //Delete record try { ReasonCodeBean record = new ReasonCodeBean(); daorscode.deleteReasonCode(record); //Convert Java Object to Json String json = "{\"Result\":\"OK\"}"; //Return Json in the format required by jTable plugin response.getWriter().print(json); } catch (Exception ex) { String error = "{\"Result\":\"ERROR\",\"Message\":" + ex.getStackTrace().toString() + "}"; response.getWriter().print(error); } } public void deleteReasonCode(ReasonCodeBean record) throws ParseException { try { PreparedStatement preparedStatement = connection .prepareStatement("DELETE FROM reason_code WHERE reason_code=? AND reason_desc=? "); // Parameters start with 1 preparedStatement.setInt(1, record.getReason_code()); preparedStatement.setString(2, record.getReason_desc()); preparedStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26398079
tagged with: jquery-jtable
tagged with: java
has title: jTable jquery Not Delete record in Database
type: Question
tagged with: jsp
tagged with: jquery
accepted answer: http://stackoverflow.com/a/26398079
score: 0

http://stackoverflow.com/q/25100461
tagged with: paint
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39061329
has body: I have built 3 custom controls extending JPanel class. One of these is a slider and the other two are "led panels" where clicking on a led i can light it up or switch it off. The on-off mechanism is done setting visible or invisible 2 overlapped JLabels with an icon inside. Problems come when I move the slider and then clicking on the led panel I see the slider getting back to the default position loosing the setting. I think i got that when I interact with the led panel I create dirty part on the GUI (because of the on-off) and so a painting system-triggered event is called to redraw entirely the GUI. This reposition the knob of the slider to the default position. I need to find a way to to avoid the repainting on the slider area. Any idea? Thanks, Filo
has comment: http://stackoverflow.com/comment/39059328
type: Question
has comment: http://stackoverflow.com/comment/39082808
has title: Java Swing system-triggered painting issue
score: 0
has comment: http://stackoverflow.com/comment/39059506
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/39059331

http://stackoverflow.com/a/25240376
answers question: http://stackoverflow.com/q/25140684
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25140684
type: Answer
score: 1
upvote count: 1
has body: I got Solution.. I have changed my method of opening container. Previous Method : if (container1.open( fileName, IContainer.Type.READ, container1.getContainerFormat()) &lt; 0) { throw new IllegalArgumentException("could not open file: " + fileName); } New Method : InputStream inputStream = null ; try { inputStream = new FileInputStream(new File("fileName")); } catch (FileNotFoundException e2) { logger.error("File not found "); } IContainerFormat format = IContainerFormat.make(); format.setInputFormat("flv"); container1 = IContainer.make(); if (container1.open( inputStream , format) &lt; 0) { throw new IllegalArgumentException("could not open file: " + fileName); } And this works for the MAC OS.. Strange But True

http://stackoverflow.com/q/25171186
tagged with: spring
answer count: 1
tagged with: java
tagged with: selenium
has body: Below is the context of an xml file where I am defining a map and its elements. Some of the elements in the map will end up being comprised of xpaths where some portion of the xpaths will be the same. I want to create variables that will represent the portions of those xpaths that are redundant across elements. I have defined a bean with an id and a property and a value. No matter what I try, I am unable to reference the value of the bean. All I ever get when I ask for the value of Map.get("devo").get("error404CategoriesContainer") is "${errorContainer}". I want it to give me "//div[@id='noResultsFeatures']//div[contains(@class,'noResultsFeaturesContainer')]". The bean I am trying to create as a variable starts at <bean id="errorContainer" The map entry where I am trying to use it is the <entry key="error404CategoriesContainer" element. Regardless of which 3 things I try, I always get the same value. The text value of the item in the map, not the text value of the variable. I have searched everywhere, but I am not able to find a solution. I have tried a # symbol instead of a $ symbol. I have tried different ways of defining the bean and trying to "ref" the bean, all to no avail. Can someone guide me to a solution? Here is the content of the xml file <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd"> <property name="error404CategoryContainer" value="//div[@id='noResultsFeatures']//div[contains(@class,'noResultsFeaturesContainer')]"/> <util:map id="devo"> <util:map> None of these works – I only have one in the file at a time. </util:map> </util:map>
upvote count: 1
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: variables
has title: How can I reference a string variable in a map:util element in a spring xml file when the string is defined in the same file?
favorite count: 0
tagged with: xpath
type: Question
has answer: http://stackoverflow.com/a/25171576

http://stackoverflow.com/a/25089894
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25089755
upvote count: 1
answers question: http://stackoverflow.com/q/25089755
has comment: http://stackoverflow.com/comment/39040139
has body: When you do profileData.put("name", p.name); you are overwriting the same object, so in the final you will have an array with 3 references to the same object. To fix it create a new instance inside the loop (see comments): for(int i=profiles.size()-1; i&gt;=0; i--) { Profile p = profiles.get(i); profileData = new JsonObject(); // &lt;- create a new object in each iteration profileData.put("name", p.name); profileData.put("mods", p.mods.toString()); System.out.println(p.name + "..." + p.mods.toString()); profileDataList.add(profileData); System.out.println("list.." + profileDataList.toString()); profileListObj.put("profile"+i, profileDataList); // Is this really needed? } //profileList.add(profileListObj); obj.put("profiles", profileDataList);
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25141253
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25139974
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25139974
downvote count: 0
has body: I think you have two problems here: First, you need to use <mvc:annotation-driven /> to enable annotation based controller. Second, it seems to me that you want to have a default page when typing the context root only. In this case, you need to add mapping like this: <mvc:view-controller path="/" view-name="index.htm"/> Or change indexController to indexController

http://stackoverflow.com/comment/39091394
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58607/discussion-between-user2015552-and-help).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25116084

content-length
type: Tag
tags question: http://stackoverflow.com/q/25074359
tag name: content-length
tags question: http://stackoverflow.com/q/25128161

http://stackoverflow.com/comment/39238299
comment on: http://stackoverflow.com/q/25196798
score: 0
has text: @ScaryWombat Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - incompatible types: possible lossy conversion from int to char
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25183840
has body: I have been implementing a simple algorithm that parses an XML file and resort its nodes based on an attribute value in node . I retrieve all nodes and insert the whole node to a sorted ArrayList. Then I created a new XML document and created new and tags but when I try to copy sorted Node and append it to , an exception stating that is still used in another document. I am using Node sortedCnode= cNode.cloneNode(false); //tried true as well b.appendChild(sortedCnode); I think my code is trying to append the whole true. But, I don't know the proper way to do it The XML looks like below <C> <D> </D> <E> </E> </C>
downvote count: 0
linked to: http://stackoverflow.com/q/873247
favorite count: 0
has title: Copying an XML node from a document to another document using Java DOM Parser
upvote count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/30765136
has comment: http://stackoverflow.com/comment/39214167
tagged with: java
has answer: http://stackoverflow.com/a/25185151
accepted answer: http://stackoverflow.com/a/25185151
tagged with: dom
type: Question
score: 4
has answer: http://stackoverflow.com/a/30765136
answer count: 2
tagged with: xml-parsing

http://stackoverflow.com/q/25224033
has title: Does immutability guarantee thread safety?
answer count: 2
has comment: http://stackoverflow.com/comment/39289186
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25224075
possible better answer: http://stackoverflow.com/a/25224074
accepted answer: http://stackoverflow.com/a/25224075
tagged with: immutability
has answer: http://stackoverflow.com/a/25224074
linked to: http://stackoverflow.com/q/14653739
upvote count: 3
has body: Well, consider the immutable class Immutable as given below: public final class Immutable { final int x; final int y; public Immutable(int x,int y) { this.x = x; this.y = y; } //Setters public int getX() { return this.x; } public int getY() { return this.y; } } Now I am creating an object of Immutable in a class Sharable whose object is going to be shared by multiple threads: public class Sharable { private static Immutable obj; public static Immutable getImmutableObject() { if (obj == null) ---&gt;(1) { synchronized(this) { if(obj == null) { obj = new Immutable(20,30); ---&gt; (2) } } } return obj; ---&gt; (3) } } Thread A sees the obj as null and moves into the synchronized block and creates object. Now, Since The Java Memory Model (JMM) allows multiple threads to observe the object after its initialization has begun but before it has concluded. So, Thread B could see the write to objas occurring before the writes to the fields of the Immutable. Hence Thread B could thus see a partially constructed Immutable that may well be in an invalid state and whose state may unexpectedly change later. Isn't it making Immutable non-thread-safe ? EDIT OK, After having lot of look up on SO and going thorough some comments,I got to know that You can safely share a reference to an immutable object between threads after the object has been constructed. Also, as mentioned by @Makoto, it is usually required to declare the fields containing their references volatile to ensure visibility. Also , as stated by @PeterLawrey , declaring the reference to immutable object as final makes the field as thread-safe
tagged with: java
tagged with: multithreading
type: Question
type: AnsweredQuestion
score: 3
tagged with: thread-safety

http://stackoverflow.com/comment/39279623
type: QuestionComment
score: 0
has text: why you have take two timers ?
comment on: http://stackoverflow.com/q/25218138
type: Comment

http://stackoverflow.com/a/25219525
downvote count: 0
answers question: http://stackoverflow.com/q/25219491
score: 4
type: Answer
has body: This will re-declare the variables as local variables. Since local variables take precedence to class members (fields), you will write the parameter values into these local variables, not the fields. What you want is the first approach.
upvote count: 4

http://stackoverflow.com/q/25215984
has title: Routing diffent url(which are not define in web.xml) to same jsp
answer count: 2
possible better answer: http://stackoverflow.com/a/25216401
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/25216031
has answer: http://stackoverflow.com/a/25216401
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: I am working in jsp and this is my web.xml <?xml version="1.0" encoding="UTF-8"?> Panel index.jsp dash.jsp /dash.jsp dash.jsp /dash.jsp So if user types /dash.jsp in browser it will redirected to dash.jsp My problem is that if a user types any other url which is not defined in web.xml it should be forwarded to one specific page(permission_denied.jsp) Any help would be appreciated. thanks
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25216031
upvote count: 1
type: Question

http://stackoverflow.com/comment/39095630
comment on: http://stackoverflow.com/q/25119477
has text: Please check out the link in my comment above. If your posted code complies with this standard, you will likely get better help, quicker.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39217477
comment on: http://stackoverflow.com/q/25185521
score: 0
has text: @Hooplehead24 Do you have control of the code being run in the thread. If so, use William F. Jameson's answer to make sure it *is* interuptable
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25090132
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/25086150
downvote count: 0
has body: Have a look at the ExecHelper from OstermillerUtils. The idea is that the thread waiting for the process to complete, does not just wait but reads input from stdout and stderr if there is input available and regurarly checks if the process has finished. If you do not do any heavy processing with the input from stdout and stderr, you might not need an extra thread to handle the input. Just copy ExecHelper and add some extra functions/methods to process any new input. I've done this before to show the process output while the process is running, it is not difficult to do (but I lost the source code). If you do need a separate thread for processing the input, make sure to synchronize the output and error StringBuffers when these buffers are updated or read. Another thing you might want to consider is adding an abort time-out. It is a little bit harder to implement but was very valuable to me: if a process takes too much time, the process gets destroyed which in turn ensures nothing remains hanging. You can find an old (outdated?) example this gist.
type: Answer

http://stackoverflow.com/comment/50312952
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25223414
has text: I have a question. If our websphere application server' version is 7.0.0.37. How can I change java from 1.6 to 1.7. By the way, os is Windows 2008 &2012.

http://stackoverflow.com/comment/39195159
has text: Sorry, I am confused. Why would basic DBCP not be concurrent out-of-the-box? What is the point of having multiple connections, if you can only use one?
comment on: http://stackoverflow.com/q/25172331
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25194984
has comment: http://stackoverflow.com/comment/39267859
has comment: http://stackoverflow.com/comment/39271506
has comment: http://stackoverflow.com/comment/39268117
has comment: http://stackoverflow.com/comment/39235448
score: 8
has comment: http://stackoverflow.com/comment/39235110
has comment: http://stackoverflow.com/comment/39235048
answers question: http://stackoverflow.com/q/25194903
has comment: http://stackoverflow.com/comment/39271283
has comment: http://stackoverflow.com/comment/39264256
has body: C#, Java (and I'll toss it in there too - JavaScript) are languages. Languages are not fast or slow, they just are specifications for how we humans write things that are to eventually be handled by a computer. The JVM is the Java Virtual Machine. But there are several different versions of it. There's HotSpot (the original), OpenJDK, And then one can look at JRockit from BEA, Apache Harmony and a bunch more. For C# there is the CLR, but there's also Mono's runtime. There are also others that have been abandoned over time. JavaScript (because I'm tossing that in there) has an entire army of runtimes. Some of those runtimes are faster than others. It is the runtime that is faster or slower than another - even possibly for the same language. But that one is 'cross platform' and another is not is not enough of an indication to say that one is faster than the other. There are a great many other things at work and benchmarks can be constructed that show one combination being faster than another for each one. Going even further, one can look at languages that span multiple runtimes. You've got Python with CPython as its default implementation - but there's Jython that runs in the JVM and IronPython that runs in the CLR. Similar examples can be found with Ruby, IronRuby, and JRuby or Clojure which can be compiled to JavaScript via ClojureScript and then run on one of the JavaScript runtimes rather than a JVM. Again, its not the language that is fast or slow - but rather how its implemented in its runtime.
downvote count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/39235114
type: Answer

http://stackoverflow.com/comment/39301762
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25230247
type: Comment
has text: Thanks for a very detailed answer. I need this method for GUI, thus I can't use neither **Mats.floor** nor **printf**.

http://stackoverflow.com/q/25164932
tagged with: exception
has comment: http://stackoverflow.com/comment/39179068
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/43655392
possible better answer: http://stackoverflow.com/a/41935892
tagged with: java
has comment: http://stackoverflow.com/comment/39214951
has comment: http://stackoverflow.com/comment/39182145
type: Question
has comment: http://stackoverflow.com/comment/39179301
tagged with: servlets
upvote count: 2
has body: I have a Servlet which has request ratio around 10,000 request/hour. In which, I got one of these two exception frequently at same line which is around daily 5 to 6 times but not every time when this Servlet is called. java.io.IOException: Stream closed at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:312) at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:200) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177) at java.io.InputStreamReader.read(InputStreamReader.java:184) at java.io.BufferedReader.fill(BufferedReader.java:154) at java.io.BufferedReader.read1(BufferedReader.java:205) at java.io.BufferedReader.read(BufferedReader.java:279) or java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:287) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177) at java.io.InputStreamReader.read(InputStreamReader.java:184) at java.io.BufferedReader.fill(BufferedReader.java:154) at java.io.BufferedReader.read1(BufferedReader.java:205) at java.io.BufferedReader.read(BufferedReader.java:279) Both exception occurs at the same line.I don't know why? Same type of all requests excecuted and get responded successfully. Here is my code : InputStream ist = request.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(ist)); StringBuffer sb = new StringBuffer(); char[] c = new char[1]; while(in.read(c, 0, 1) == 1) // Getting exception at this line { sb.append(c[0]); } String payload = sb.toString(); Note : Streams are properly closed at the end of the code. Is it because of high request ratio? Give solution/suggestion if you have any.
answer count: 2
has title: java.io.IOException: Stream closed or Underlying input stream returned zero bytes, while reading character from request.getInputStream()
has answer: http://stackoverflow.com/a/41935892
has comment: http://stackoverflow.com/comment/41235998
has comment: http://stackoverflow.com/comment/39180448
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/47051019
accepted answer: http://stackoverflow.com/a/47051019
has comment: http://stackoverflow.com/comment/41235400

http://stackoverflow.com/a/25274103
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25183113
accepted answer of: http://stackoverflow.com/q/25183113
downvote count: 0
type: Answer
upvote count: 16
score: 16
has body: Your diagram is wrong. You have a basic misunderstanding about how kerberos works. ( It's fairly common by the way). A service that uses kerberos for authentication NEVER talks to the kdc. All it ever does is use it's secret key ( keytab ) to decrypt blobs that are presented by the user. The only part of kerberos that ever talks to the KDC is the client or user side. When it attempts to access the service at port 1010, it first asks the KDC for a service ticket for that service. This is a blob encrypted with the service's secret key that has the user's identity inside it. ( plus a bunch of other protocol related stuff ). If you have an GSS based api inside your service on port 1010, all you need to do is tell that API where the keytab is and then ask it what the userid is on the connection. You never need to make any other connections to external services. I am not familiar with the Java API's, but there should only be one or two calls required to verify the user credentials. While this dialogue doesn't exactly match the version of Kerberos currently in use, it will help you understand the basic principals. http://web.mit.edu/kerberos/dialogue.html

http://stackoverflow.com/a/25135226
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25135059
has comment: http://stackoverflow.com/comment/39123882
score: 2
has body: I have got a solution. it may not be a proper solution but yes if i tried to add scrollpane as a parent to Desktop Pane it worked.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25135059

http://stackoverflow.com/comment/39088015
type: QuestionComment
has text: @Absurd-Mind : `if( map.get("SomeKey") instanceof Child1){ Child1 mc=(Child1) map.get("SomeKey");}`
comment on: http://stackoverflow.com/q/25115832
score: 0
type: Comment

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/25118788
type: Tag

http://stackoverflow.com/comment/40128550
comment on: http://stackoverflow.com/a/25116191
has text: Today i had time to test this and i guarantee this is really good solution so far.Thanks again McMa.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39011294
type: Comment
type: QuestionComment
has text: @Eypros Under minimum effort of OP we can close giving reason as off-topic
score: 0
comment on: http://stackoverflow.com/q/25074893

http://stackoverflow.com/q/25179462
has answer: http://stackoverflow.com/a/25179624
has title: Get substring according to occurrence, reg exp java
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25179526
has body: Good day everyone! I wonder if anyone could help me out. I have a string -2.100 CM 1.000 CM 1.025 CM The problem is getting the values before CM, e.g. -2.1, 1.0, 1.025 Pattern pattern = Pattern.compile("(\\-*\\d*.\\d*) CM"); would give me -2.1, Pattern pattern = Pattern.compile(" (\\-*\\d*.\\d*) CM"); 1.0 Can not get the third value ( Is there any way of getting the values according to their occurrences?
possible better answer: http://stackoverflow.com/a/25179624
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25179526
tagged with: string
favorite count: 0
tagged with: regex

http://stackoverflow.com/a/25073795
has comment: http://stackoverflow.com/comment/39009743
has body: Try this way,hope this will help you to solve your problem. String jsonStr ="[{\"id\":\"1\",\"name\":\"Bodrum\",\"program\":null,\"program_link\":null,\"images_array\":[\"http:\\/\\/dev.booking.blancatours.com\\/uploads\\/53d1f3fde123b.jpg\",\"http:\\/\\/dev.booking.blancatours.com\\/uploads\\/53d1f3fde20d4.jpg\",\"http:\\/\\/dev.booking.blancatours.com\\/uploads\\/53d1f3fde21c6.jpg\",\"http:\\/\\/dev.booking.blancatours.com\\/uploads\\/53d1f43b43e37.jpg\"],\"hotels\":[{\"id\":\"3\",\"city_id\":\"1\",\"name\":\"Bodrum Hotel\",\"images_array\":[]}]},{\"id\":\"2\",\"name\":\"Bursa\",\"program\":null,\"program_link\":null,\"images_array\":[\"http:\\/\\/dev.booking.blancatours.com\\/uploads\\/53d1f4ff167a8.jpg\",\"http:\\/\\/dev.booking.blancatours.com\\/uploads\\/53d1f4ff168e1.jpg\",\"http:\\/\\/dev.booking.blancatours.com\\/uploads\\/53d1f4ff169cb.jpg\"],\"hotels\":[{\"id\":\"4\",\"city_id\":\"2\",\"name\":\"Bursa Hotel\",\"images_array\":[]}]},{\"id\":\"3\",\"name\":\"Istanbul\",\"program\":null,\"program_link\":null,\"images_array\":[\"http:\\/\\/dev.booking.blancatours.com\\/uploads\\/53d1f5d1927ce.jpg\"],\"hotels\":[{\"id\":\"2\",\"city_id\":\"3\",\"name\":\"Istanbul Hotel\",\"images_array\":[]}]},{\"id\":\"4\",\"name\":\"Bolu\",\"program\":null,\"program_link\":null,\"images_array\":[\"http:\\/\\/dev.booking.blancatours.com\\/uploads\\/53d1f8f500afc.jpg\"],\"hotels\":[]},{\"id\":\"5\",\"name\":\"Trabzon\",\"program\":null,\"program_link\":null,\"images_array\":[],\"hotels\":[]},{\"id\":\"6\",\"name\":\"Yalova\",\"program\":null,\"program_link\":null,\"images_array\":[],\"hotels\":[]},{\"id\":\"7\",\"name\":\"Sapanca\",\"program\":null,\"program_link\":null,\"images_array\":[],\"hotels\":[]},{\"id\":\"8\",\"name\":\"Antalya\",\"program\":null,\"program_link\":null,\"images_array\":[],\"hotels\":[]}]"; try { JSONArray jsonArr = new JSONArray(jsonStr); ArrayList&lt;HashMap&lt;String,Object&gt;&gt; list = new ArrayList&lt;HashMap&lt;String, Object&gt;&gt;(); for (int…
type: Answer
has comment: http://stackoverflow.com/comment/39009890
has comment: http://stackoverflow.com/comment/39010917
answers question: http://stackoverflow.com/q/25073503
upvote count: 1
has comment: http://stackoverflow.com/comment/39010800
accepted answer of: http://stackoverflow.com/q/25073503
has comment: http://stackoverflow.com/comment/39010414
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39009780
score: 1

http://stackoverflow.com/comment/39233826
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25194009
has text: For the record, some of the `java.awt.Color` class constructors throw an `IllegalArgumentException` if a value is outside of a certain range (0-255 or 0.0-1.0 depending on which constructor is used).

http://stackoverflow.com/q/25084517
type: AnsweredQuestion
has body: I'm making an app for my project in my android studio. I write an app that locate the item in the supermarket. Now whenever the app is opened within the user's phone. I want the app to be able to retrieve the daily's promotion (.jpeg) of the supermarket into the app. For instance, there is a button (txt: daily promotion). Whenever the user click this button, the app will load the picture (change daily) that I created. My question is Is there any free server that I can host my picture? And how can I make my program link to my picture? Anyone have any idea what would be the easiest way to do this? Much Appreciated.
tagged with: java
tagged with: mysql
type: Question
has title: How to make Android app retrieve data daily from the server?
answer count: 1
accepted answer: http://stackoverflow.com/a/25084690
tagged with: android
tagged with: android-studio
score: 0
has answer: http://stackoverflow.com/a/25084690

http://stackoverflow.com/comment/39235926
type: Comment
has text: But how about using an arrayList? Because I want this programme to be run for all integers, thanks!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25195112

http://stackoverflow.com/q/25142602
accepted answer: http://stackoverflow.com/a/25143809
has body: I have many tables in my Java application. When i click "Ctrl + A" in Mac OS X, it selects all rows inside the current table. I wonder if i can change the default shortcut to use "Command + A" instead to select all the rows in the table ? I am trying to do this inside the EventQueue class to be applied automatically on all the tables in my application.
linked to: http://stackoverflow.com/q/17582640
tagged with: jtable
answer count: 3
has answer: http://stackoverflow.com/a/25174586
downvote count: 0
linked to: http://stackoverflow.com/q/9780028
tagged with: keyboard-shortcuts
favorite count: 0
possible better answer: http://stackoverflow.com/a/25145082
upvote count: 2
has answer: http://stackoverflow.com/a/25143809
has answer: http://stackoverflow.com/a/25145082
type: AnsweredQuestion
score: 2
tagged with: java
has title: Java - How can i select all rows in JTable using Command+A shortcut in Mac?
tagged with: swing
type: Question

http://stackoverflow.com/comment/39243137
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25198818
has text: what is `<jsp:userBean` it should be `<jsp:useBean`

http://stackoverflow.com/comment/39309058
type: Comment
has text: Either that, or use `apply from:` to include common logic in subproject scripts.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25221204

http://stackoverflow.com/q/25105974
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25106003
answer count: 2
downvote count: 0
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/25106001
has answer: http://stackoverflow.com/a/25106001
has body: import java.io.IOException; public class Main { public static void main(String[] args) throws IOException, InterruptedException { System.out.println("Creating Process"); Process process = Runtime.getRuntime().exec("notepad.exe"); System.out.println("Waiting for 3 Sec"); Thread.sleep(3000); process.destroy(); System.out.println("process Destroyed"); } } As far as I know Process Class is an abstract class and it has this method for destroy() abstract void destroy(); But as you can see when I invoke the destroy method for the process Object it knows exactly what to do! When this method has been declared ?
accepted answer: http://stackoverflow.com/a/25106003
has title: When the destroy() has been declared?
upvote count: 1

http://stackoverflow.com/comment/39045293
type: Comment
type: QuestionComment
has text: JavaFx, was when it was announced, touted as a Flash competitor, until JavaFx2, it did not have a table or tree component, which, IMHO, are critical UI components for applications. There is now, also a move to introduce 3D into the core, so, as far as I can tell, JavaFX has no idea what it wants to be. Swing is old, and could use a over haul at the core, but it has a large community of very experienced developers behind it, which makes finding help much easier
comment on: http://stackoverflow.com/q/25092306
score: 0

http://stackoverflow.com/q/25100596
tagged with: java
has body: ImageIO.write(image, "png", socket.getInputStream); This is the only way I tried, and it does work but it needs the outputStream to be closed or I can't save the image. My problem is that I need the connection to be alive even after the sending, so I read on the internet that i have to convert a BufferedImage in byte[] and viceversa in the client and in the server. How do I do that?
tagged with: bufferedimage
type: Question
linked to: http://stackoverflow.com/q/15414259
has title: Convert image in byte and viceversa for socket connection in java
duplicate of: http://stackoverflow.com/q/15414259
score: 0
tagged with: client-server
has comment: http://stackoverflow.com/comment/39067688
answer count: 1
has comment: http://stackoverflow.com/comment/39066873
tagged with: byte
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/25100726

http://stackoverflow.com/q/25088247
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am getting no errors in these codes. Instead I am getting empty list with no data parsed into it. Splash is the launcher activity and the button opens the Menu activity which consists of ListView layout. Splash activity just have a button which basically opens the Menu activity via intent and nothing else, so i am not posting the code here for the class. post is the layout for JSONParser activity. Here are the codes: Menu.java package com.example.test; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.ListActivity; import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; public class Menu extends ListActivity{ private ProgressDialog pDialog; private static final String READ_DB_URL ="http://10.0.2.2:1337/webservice/lib.php"; private static final String TAG_TITLE = "title"; private static final String TAG_POSTS = "posts"; private JSONArray mComments = null; private ArrayList&lt;HashMap&lt;String, String&gt;&gt; mCommentList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.menu); } public void updateJSONdata() { mCommentList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); JSONParser jParser = new JSONParser(); JSONObject json = jParser.getJSONFromUrl(READ_DB_URL); try{ mComments = json.getJSONArray(TAG_POSTS); for (int i = 0; i &lt; mComments.length(); i++) { JSONObject c = mComments.getJSONObject(i); String title = c.getString(TAG_TITLE); HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put(TAG_TITLE, title); mCommentList.add(map); } } catch (JSONException e) { e.printStackTrace(); } } private void upd…
has title: Error while Parsing JSON data into ListView
has comment: http://stackoverflow.com/comment/39053218
tagged with: listview
type: Question
has comment: http://stackoverflow.com/comment/39037766
has comment: http://stackoverflow.com/comment/39047050
score: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39045586
has comment: http://stackoverflow.com/comment/39036909

http://stackoverflow.com/comment/39014988
has text: `@class` assures the linker that there's a class with that name, allowing the interface to subclass it without knowing it's details. How does the implementation resolve/expand the `#import`?
comment on: http://stackoverflow.com/a/25074773
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39249748
has text: @user1613360: See my edit... your question is *still* badly worded though.
comment on: http://stackoverflow.com/a/25203067
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39119336
comment on: http://stackoverflow.com/q/25132734
has text: Sounds like xy problem. Before suggesting you a way to implement this could you please explain the reason to do this? Why do you need custom format? Why one of existing standards like XML or JSON does not satisfy you? What are you going to do with the result - 100K lines of text?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/52250173
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25078828
has text: You may only see a large performance difference if running with a cpu-load of near 100% AND a significant difference in cpu cycles spent per sync/async-request. Which is unlikely. Async processing only has the advantage of less threads, thus less (stack-)memory used. And even this advantage is nil due to this feature in jersey: https://java.net/jira/browse/JERSEY-2477

http://stackoverflow.com/comment/39183709
has text: @ Alex Schultz Hi Finally got the code working, Thank you so much for your help, greatly appreciated :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25167075

http://stackoverflow.com/comment/39136699
score: 0
type: Comment
type: QuestionComment
has text: check this out you can also get a map instance by hql, a bit dirty workaround but fyi http://stackoverflow.com/a/19063873/706695
comment on: http://stackoverflow.com/q/25139803

http://stackoverflow.com/q/25192466
has answer: http://stackoverflow.com/a/25192512
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/25192528
possible better answer: http://stackoverflow.com/a/25192512
has title: Why am I getting warnings for overridable method call in the constructor, when nothing is being overriden?
tagged with: netbeans
score: 0
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25192530
has body: I’m getting the warning “overridable method call in contractor” and I don’t know why. The class doesn’t extend or implement anything. When I click on the warning the suggestions are to 1. make the class final 2. make the method final 3. make the method static 4. make the method private Why is this happening and what should I do? Here is the relevant code: import java.util.Random; public class Tester { public Tester(int minLength, int maxLength, int minValue, int maxValue) { rand = new Random(); int[] randData = generateArray(minLength, maxLength, minValue, maxValue);//overridable method call in constructor procArr = new DataManager(randData); doTests();//overridable method call in constructor } public void doTests() { procArr.sort(); } public int[] generateArray(int minLenght, int maxLength, int minVal, int maxVal) { final int length = getRandomVal(minLenght, maxLength); int arr[] = new int[length]; for(int i = 0; i &lt; length; i++) arr[i] = getRandomVal(minVal, maxVal); return arr; } private int getRandomVal(int min, int max) { int n = max - min + 1; int i = rand.nextInt(n); return min + i; } final private Random rand; final private DataManager procArr; }
type: Question
accepted answer: http://stackoverflow.com/a/25192530

http://stackoverflow.com/comment/39170832
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25160651
type: AnswerComment
has text: ya click event.. The method he referred is called by the Click event. updated my answer for you clarification..

http://stackoverflow.com/q/25111335
has answer: http://stackoverflow.com/a/25649721
has answer: http://stackoverflow.com/a/55344843
answer count: 5
tagged with: maven
accepted answer: http://stackoverflow.com/a/25649721
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/39080642
upvote count: 2
tagged with: java
has title: where is dukes-age in maven archetype? per first cup of JEE7
type: Question
tagged with: jakarta-ee
tagged with: ejb
has answer: http://stackoverflow.com/a/25823007
has answer: http://stackoverflow.com/a/41336790
has body: I'm following the JEE7 first cup directions for EJB: Before you can create applications based on the archetypes, you must first install the archetypes and supporting projects to your local Maven repository. In NetBeans IDE select File, then Open Project, navigate to tut-install/, select example, deselect the Open Required Projects check box, and click Open Project. Right-click the firstcup project in the Projects pane and select Build. Only I don't see tut-install, and this seems to be the only reference to tut-install... While I have, I think, installed maven, I don't see dukes-age: Create the Project in NetBeans IDE From the File menu, select New Project. Under Categories, select Maven. Under Projects, select Project from Archetype. Click Next. In the Search field, enter dukes-age. In the Known Archetypes field, select dukes-age-archetype. Click Next. In the Project Name field, enter dukes-age. In the Package field, enter firstcup.dukesage.resource. Click Finish. When browsing archetypes, I see: why doesn't the dukes-age project show up?
linked to: http://stackoverflow.com/q/17071365
score: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/25823007
has answer: http://stackoverflow.com/a/25132779
favorite count: 0

http://stackoverflow.com/comment/39006116
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25072024
has text: You just need to specify the resource as `classpath:persistence-context.xml`
score: 0

http://stackoverflow.com/comment/39128865
has text: @HumanBeing In that case you want `ArrayList`. Also `list.get(i).getRollNo() == rollNo) return list.get(i);` is overly-inefficient because you are iterating from start each time you use `get(i)`. You should use `Iterator` instead so [`for-each` loop](http://docs.oracle.com/javase/1.5.0/docs/guide/language/foreach.html) would be improvement of your original code.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25137922
type: AnswerComment

http://stackoverflow.com/a/25156375
type: Answer
upvote count: 6
score: 6
has comment: http://stackoverflow.com/comment/39163137
has comment: http://stackoverflow.com/comment/39163398
answers question: http://stackoverflow.com/q/25156337
type: AcceptedAnswer
downvote count: 0
has body: You're trying to declare a variable as the only statement in an if statement body. That's not allowed, as it would be pointless - the variable would be out of scope immediately afterwards. Either you should declare the variable first: int variable5 = 0; // Or whatever value you want otherwise if (variable1 - variabl &lt; 0) variable5 = variable3 + variable4; Or if you only need the variable within the body of the if statement, you'll need more statements: if (variable1 - variabl &lt; 0) { int variable5 = variable3 + variable4; // Use variable5 } I would strongly encourage you to always use braces with if statements (and loops etc).
accepted answer of: http://stackoverflow.com/q/25156337

http://stackoverflow.com/q/25218724
tagged with: setter
score: -1
tagged with: getter
has answer: http://stackoverflow.com/a/25218844
has comment: http://stackoverflow.com/comment/39279594
favorite count: 0
has comment: http://stackoverflow.com/comment/39279941
answer count: 4
has title: Setters and getters are not working on test project
has answer: http://stackoverflow.com/a/25218737
accepted answer: http://stackoverflow.com/a/25218737
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25219121
tagged with: java
downvote count: 1
possible better answer: http://stackoverflow.com/a/25218844
type: Question
has answer: http://stackoverflow.com/a/25219649
has body: I have three classes. And I am trying to test getters and setters. For some reason after I set a variable in another class, the variable value is not changed in the original. These are my three classes: package test; public class first { second sec; third t; public static void main(String args[]){ System.out.println("First"); new first(); } public first(){ sec=new second(); t=new third(); sec.update(); } } //Second Class package test; public class second { private int x; private int y; public second (){ this.x=100; this.y=100; System.out.println("Second"); } public void update(){ System.out.println(x); System.out.println(y); } public void setX(int x){ this.x=x;}; public void setY(int y){ this.y=y;}; public int getX (){ return this.x;}; public int getY (){ return this.y;}; } //Third Class package test; public class third { second sec; public third(){ sec=new second(); sec.setX(200); sec.setY(200); System.out.println("Third"); } } This is what prints out: First Second Second Third 100 100 I set x and y in the third class to be 200. And I checked that the third constructor is the last to be called. Therefore setting the values. But the values of x and y are not changed.
upvote count: 0

http://stackoverflow.com/a/25203314
upvote count: 4
downvote count: 0
score: 4
has body: When you manually create a consumer like that with an inlined processor, you need to manually done the UoW of the Exchange when you are done to trigger work that would delete/move the file etc. exchange.getUnitOfWork().done(exchange); You can also try wrapping your processor with the UnitOfWorkProducer that should do the done of the UnitOfWork for you.
has comment: http://stackoverflow.com/comment/39253604
answers question: http://stackoverflow.com/q/25201462
type: Answer

http://stackoverflow.com/q/25216742
upvote count: 1
downvote count: 0
favorite count: 0
tagged with: singleton
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25216756
score: 1
has title: Why does methods for wrapping element in Set/List/Map contains 'singleton' in name ?(java.util.Collections)
tagged with: java
accepted answer: http://stackoverflow.com/a/25216751
has body: I know if I had element and I want to get List/Set/Map with eith element only I should invoke : Collections.singleton() / Collections.singletonList() / Collections.singletonMap() I don't understand why all these methods contains singleton in their names ? I had assumption maybe it return same Collection for same object but this test shows that it is false Object o = new Object(); System.out.println(Collections.singleton(o) == Collections.singleton(o)); output: false For me singleton pattern forbid to create more than one element of concrete type and provided unify gateway for acces to this object. please clarify.
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/25216751
answer count: 2
possible better answer: http://stackoverflow.com/a/25216756

http://stackoverflow.com/a/25117704
answers question: http://stackoverflow.com/q/25117383
has comment: http://stackoverflow.com/comment/39091559
has comment: http://stackoverflow.com/comment/39091297
has body: To show in image with a data/base64 url, you need to encode it in Base64 format (see http://en.wikipedia.org/wiki/Base64). You could modify your backend to write your image into base64 format (see Java BufferedImage to PNG format Base64 String), as a string rather than an array. It's also way more compact for your JSON!
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39092494
upvote count: 1

http://stackoverflow.com/a/25177308
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25177200
type: Answer
answers question: http://stackoverflow.com/q/25177200
has body: An indirect approach with a stream of array indices is probably your best bet, given that there is no "zip" operation in the Streams API: import static java.util.stream.Collectors.toList; import static java.util.stream.IntStream.range; ... range(0, firstnames.length) .mapToObj(i-&gt; String.format("firstname: %s\nlastname: %s\nmailaddress: %s\n", firstnames[i], lastnames[i], mailaddresses[i])) .collect(toList()) .forEach(System.out::print);

http://stackoverflow.com/comment/65697532
has text: I am having memory leak due to quartz worker.How to stop all the conection and quartz thread in jvm .I have my issue in following url.http://stackoverflow.com/questions/39166512/memory-leak-error-in-tomcat-server-even-after-removed-quartz-related-code
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25127077
type: Comment

http://stackoverflow.com/q/25158698
upvote count: 1
tagged with: live
type: Question
linked to: http://stackoverflow.com/q/5942233
linked to: http://stackoverflow.com/q/14915319
answer count: 2
downvote count: 0
has title: Java - "Live" output from Systemcommand
tagged with: cmd
linked to: http://stackoverflow.com/q/15843202
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25159400
has body: I've made a little GUI for youtube-dl, but for this project, I nedd kind of a "live" output from a system command. I already tried this, but this only displays the output when the process has finished. I need something which displays the progress of my download continously (youtube-dl is just a command line tool, so it needs to refresh about every second). How do i do that?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25159317

http://stackoverflow.com/q/25095443
linked to: http://stackoverflow.com/q/13374171
has answer: http://stackoverflow.com/a/25095472
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/39049842
favorite count: 0
has body: I have string "ali22mehdi35abba1lala2". I want to split it to {"ali","mehdi","abba","lala"}; How should I do that ? I saw here and another place. I can't acheive my end.
type: Question
score: -9
possible better answer: http://stackoverflow.com/a/25095481
accepted answer: http://stackoverflow.com/a/25095472
has answer: http://stackoverflow.com/a/25095481
tagged with: java
answer count: 2
has title: How to split a string with numbers in java
has comment: http://stackoverflow.com/comment/39049720
tagged with: split
linked to: http://stackoverflow.com/q/3481828
downvote count: 9

http://stackoverflow.com/q/25086236
tagged with: groovy
tagged with: types
answer count: 1
has answer: http://stackoverflow.com/a/25086335
has body: In a bit of Groovy code I had written the line def intCurrentArray = currentVersion.tokenize('.').each({x -&gt; Integer.parseInt(x)}) which parses a string formatted like a version number XX.XX.XX.XX and converts the resulting list of strings to a list of integers. However, Groovy inferred intCurrentArray to be a list of strings instead, causing an incorrect conversion. When I changed the line to: ArrayList intCurrentArray = [] for (x in currentVersion.tokenize('.')) intCurrentArray.add(Integer.parseInt(x)) the conversion worked just fine. Why would the each method give funky results? Does Groovy not look inside the closure to help infer the type of intCurrentArray?
accepted answer: http://stackoverflow.com/a/25086335
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: inference
tagged with: closures
has title: Groovy each method returning incorrect results
score: 0

http://stackoverflow.com/a/25146835
has comment: http://stackoverflow.com/comment/39146167
has comment: http://stackoverflow.com/comment/39146054
score: 0
has comment: http://stackoverflow.com/comment/39145806
has comment: http://stackoverflow.com/comment/39146525
has body: ResponseStatus has a reason property you could use.
has comment: http://stackoverflow.com/comment/39145926
type: Answer
answers question: http://stackoverflow.com/q/25146155

http://stackoverflow.com/comment/39048512
score: 0
type: AnswerComment
has text: sir it still have same error and i change like this String query = "select * from issues where bdate= '?' and rdate='?'"; try{ con.setAutoCommit(false); ps = con.prepareStatement(query); ps.setString(1, bdate); ps.setString(2,rdate); rs = ps.executeQuery(); con.commit(); } catch (SQLException e) { e.printStackTrace(); }
type: Comment
comment on: http://stackoverflow.com/a/25094504

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/25070892
tags question: http://stackoverflow.com/q/25170036
tags question: http://stackoverflow.com/q/25196179
tags question: http://stackoverflow.com/q/25096744
tags question: http://stackoverflow.com/q/25141724
tags question: http://stackoverflow.com/q/25099291
tags question: http://stackoverflow.com/q/25223393
tags question: http://stackoverflow.com/q/25072146
tags question: http://stackoverflow.com/q/25107273
tags question: http://stackoverflow.com/q/25124451
tags question: http://stackoverflow.com/q/25135332
tags question: http://stackoverflow.com/q/25229342
tags question: http://stackoverflow.com/q/25090636
tags question: http://stackoverflow.com/q/25135042
tags question: http://stackoverflow.com/q/25133504
type: Tag
tags question: http://stackoverflow.com/q/25187454
tags question: http://stackoverflow.com/q/25221692
tags question: http://stackoverflow.com/q/25162215
tags question: http://stackoverflow.com/q/25230007
tags question: http://stackoverflow.com/q/25091221
tags question: http://stackoverflow.com/q/25110081
tags question: http://stackoverflow.com/q/25133371
tags question: http://stackoverflow.com/q/25124662
tags question: http://stackoverflow.com/q/25140735
tags question: http://stackoverflow.com/q/25147392
tags question: http://stackoverflow.com/q/25163994
tags question: http://stackoverflow.com/q/25071769
tags question: http://stackoverflow.com/q/25115400
tags question: http://stackoverflow.com/q/25098647
tags question: http://stackoverflow.com/q/25108788
tags question: http://stackoverflow.com/q/25088725
tags question: http://stackoverflow.com/q/25186316
tags question: http://stackoverflow.com/q/25085353
tags question: http://stackoverflow.com/q/25116597
tags question: http://stackoverflow.com/q/25188223
tags question: http://stackoverflow.com/q/25187301
tags question: http://stackoverflow.com/q/25183262
tags question: http://stackoverflow.com/q/25163089
tags question: http://stackoverflow.com/q/25190357
tags question: http://stackoverflow.com/q/25195086
tags question: http://stackoverflow.com/q/25124056
tags question: http://stackoverflow.com/q/25189131
tags question: http://stackoverflow.com/q/25210174
tags question: http://stackoverflow.com/q/25215984
tags question: http://stackoverflow.com/q/25221250
tags question: http://stackoverflow.com/q/25141904
tags question: http://stackoverflow.com/q/25098261
tags question: http://stackoverflow.com/q/25079249
tags question: http://stackoverflow.com/q/25117788
tags question: http://stackoverflow.com/q/25083753
tags question: http://stackoverflow.com/q/25084552
tags question: http://stackoverflow.com/q/25158798
tags question: http://stackoverflow.com/q/25197345
tags question: http://stackoverflow.com/q/25172233
tags question: http://stackoverflow.com/q/25149757
tags question: http://stackoverflow.com/q/25180467
tags question: http://stackoverflow.com/q/25172137
tags question: http://stackoverflow.com/q/25087178
tag name: xml
tags question: http://stackoverflow.com/q/25070289
tags question: http://stackoverflow.com/q/25164502
tags question: http://stackoverflow.com/q/25228713
tags question: http://stackoverflow.com/q/25096667
tags question: http://stackoverflow.com/q/25083804
tags question: http://stackoverflow.com/q/25079166
tags question: http://stackoverflow.com/q/25203541
tags question: http://stackoverflow.com/q/25160338
tags question: http://stackoverflow.com/q/25103145
tags question: http://stackoverflow.com/q/25110783
tags question: http://stackoverflow.com/q/25230086
tags question: http://stackoverflow.com/q/25165777
tags question: http://stackoverflow.com/q/25082159
tags question: http://stackoverflow.com/q/25088247
tags question: http://stackoverflow.com/q/25175463
tags question: http://stackoverflow.com/q/25104385
tags question: http://stackoverflow.com/q/25110662
tags question: http://stackoverflow.com/q/25104556
tags question: http://stackoverflow.com/q/25097491
tags question: http://stackoverflow.com/q/25176754

http://stackoverflow.com/a/25132303
has comment: http://stackoverflow.com/comment/39121516
accepted answer of: http://stackoverflow.com/q/25131303
answers question: http://stackoverflow.com/q/25131303
has comment: http://stackoverflow.com/comment/39119444
has body: You are not setting the values in the invoice bean. Once you have added a new Detail by clicking add you are putting the values into this new object. But you are then saving a new Detail in the saveInvoice bean and attempting to get the values from the properties in the bean. (Which are not being set and as such are NULL) This will not work as the properties are not mapped to the table. You are also creating more work in the code than necessary and over complicating it. If you change the bean to get the Details of the new instance from the addRow method or update the properties in the cell editor it should work. You will probably also need to simplify some of the other code. Note: I actually recommend you start from scratch. Use an iterative approach to the problem starting with addRow and then save. Debug is your friend. Update the xhtml outputs to map to the properties. E.g: &lt;f:facet name="input"&gt; &lt;h:inputText value="#{invoiceBean.($ipsDetail)}" size="3" /&gt; &lt;/f:facet&gt; Also: In your footer you make reference to an actionListener. Change this to an 'action' and remove the process. Have the addRow method add an empty row to the details list. Map this detail. &lt;p:commandButton value="Add New Row" oncomplete="clickFirstRow()" action="#{invoiceBean.addRow}" update="invoiceTable" /&gt; Also your save button could deal with the application and saving of the editable row by clicking all the rows to save. &lt;p:commandButton value="Save Invoice" ajax="false" onclick="tickAllRows()" action="#{invoiceBean.saveInvoiceData}" /&gt;
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39118636
has comment: http://stackoverflow.com/comment/39118761
has comment: http://stackoverflow.com/comment/39158522
type: Answer

http://stackoverflow.com/a/25150898
downvote count: 0
has comment: http://stackoverflow.com/comment/39174816
has body: There are many things wrong in your code beside what @Mike pointed out. Getting input from the user within the constructor is bad. You should get the input in the main method, and pass it to the constructor. In addition, you don't initialize the radius. It remains 0.0. The constructor call should look like this (the MyPoint object passed to the constructor should be initialized prior to calling the constructor) : MyCircle circle1 = new MyCircle (center, radius); The constructor should look like this : public MyCircle(MyPoint center, double radius) { this.radius = 0.0; this.center = center; } The toString and calcArea methods don't need a parameter. They should operate on the current object (this) : public String toString() { return "Circle @ " + "(" + this.center.getCoordinateX() + "," + this.center.getCoordinateY() + ")" + ". Its radius is " + this.radius; }
answers question: http://stackoverflow.com/q/25150818
type: Answer
has comment: http://stackoverflow.com/comment/39154411
score: 1
upvote count: 1

http://stackoverflow.com/a/25099550
has body: Since phones have different memeory sizes my suggestion to you is reduce the image size and try Again. Bitmap createScaleBitmap
answers question: http://stackoverflow.com/q/25099530
score: 0
type: Answer

http://stackoverflow.com/a/26431969
has comment: http://stackoverflow.com/comment/44315831
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I'd do something like this: ... } else { Notification.show("", Notification.Type.ERROR_MESSAGE); return new ByteArrayOutputStream(); } ...
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25218419
has comment: http://stackoverflow.com/comment/44314622
has comment: http://stackoverflow.com/comment/41639573
accepted answer of: http://stackoverflow.com/q/25218419

http://stackoverflow.com/q/25173427
has comment: http://stackoverflow.com/comment/39195634
type: Question
answer count: 1
favorite count: 0
tagged with: android
downvote count: 1
upvote count: 0
has comment: http://stackoverflow.com/comment/39195459
has title: Intent.getExtra gives nullPointerException
accepted answer: http://stackoverflow.com/a/25173474
has body: In one class I have this: Double iso1 = 0.0; final Intent start = new Intent(IsoAbun.this, IsoAbunCal.class); start.putExtra("iso1", iso1); startActivity(start); Then in the other class I have this: Bundle b = getIntent().getExtras(); Double iiso1 = 0.0; iiso1 = Double.parseDouble(b.getString("iso1")); All that gives a nullPointerException. The code seems fine to me, so is there anything I am missing, or is more information required?
type: AnsweredQuestion
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/25173474

http://stackoverflow.com/comment/39186384
comment on: http://stackoverflow.com/a/25152489
type: AnswerComment
has text: Thanks!!! The original question to to computer power without build-in or math library. And then output it. I get the comptutation done, but failed in the outputting.
score: 0
type: Comment

http://stackoverflow.com/comment/39123405
type: Comment
comment on: http://stackoverflow.com/q/25134926
type: QuestionComment
score: 0
has text: Did you checked default FPS and refresh rate of each 3rd party library that you have used. Values may be differ from one library to other

http://stackoverflow.com/q/25204423
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39256608
downvote count: 0
tagged with: cookies
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/13847102
tagged with: android-cookiemanager
type: Question
possible better answer: http://stackoverflow.com/a/25206974
answer count: 2
has answer: http://stackoverflow.com/a/25206974
linked to: http://stackoverflow.com/q/11100086
upvote count: 1
has comment: http://stackoverflow.com/comment/39262761
accepted answer: http://stackoverflow.com/a/25204569
tagged with: android
has comment: http://stackoverflow.com/comment/39252573
favorite count: 0
has body: I have a login activity and I have to create a post request for my website to login the user into my mobile app. To create post requests on my website I need the csrf cookie as parameter, it means I have first to get the cookie from my URL and after create my post request with the csrf value. Here is my code: HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost("http://192.168.178.163:8080/login/"); try { List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(1); nameValuePairs.add(new BasicNameValuePair("username", "xxx")); nameValuePairs.add(new BasicNameValuePair("password", "yyy")); //csrfmiddlewaretoken String res = null; post.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = client.execute(post); res = response.toString(); res = res.replaceAll("\\s+",""); BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); String line = ""; while ((line = rd.readLine()) != null) { Log.i("line", line); //System.out.println(line); if (line.startsWith("csrftoken=")) { String key = line.substring(5); Log.i("key", key); } } } catch (IOException e) { txt_Error.setText(e.toString()); } Any idea how to do it? I already read about CookieSyncManager but I didnt understand at all... Any idea or code sample will be aprreciate
has title: Android, how to get a cookie from URL via HttpClient()?
has answer: http://stackoverflow.com/a/25204569

http://stackoverflow.com/q/25178858
answer count: 0
type: Question
has title: creating Default httpsClient leads to error in multipart request
tagged with: java
score: 0
tagged with: multipart
tagged with: httpclient
has comment: http://stackoverflow.com/comment/39204703
has comment: http://stackoverflow.com/comment/39204583
type: UnansweredQuestion
tagged with: android
has body: I am trying to execute a multipart request using the below function, but when I create the httpClient I get this exception: E/AndroidRuntime(8909): Caused by: java.lang.NoSuchFieldError: org.apache.http.message.BasicLineFormatter.INSTANCE I am using httpclient-4.3.4 (imports are below as well) import org.apache.http.HttpEntity; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; public static void uploadFile() throws ClientProtocolException, IOException { String filepath = Environment.getExternalStorageDirectory() + "/Download/img.jpg"; CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost uploadFile = new HttpPost("ip/myRestservice"); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.addTextBody("field1", "yes", ContentType.TEXT_PLAIN); File file = new File(filepath); builder.addBinaryBody("file", file, ContentType.APPLICATION_OCTET_STREAM, "file.ext"); HttpEntity multipart = builder.build(); uploadFile.setEntity(multipart); CloseableHttpResponse response = httpClient.execute(uploadFile); HttpEntity responseEntity = response.getEntity(); } How to solve it?

jtextpane
tags question: http://stackoverflow.com/q/25150646
tags question: http://stackoverflow.com/q/25127492
tag name: jtextpane
type: Tag
tags question: http://stackoverflow.com/q/25163348
tags question: http://stackoverflow.com/q/25190938
tags question: http://stackoverflow.com/q/25181929
tags question: http://stackoverflow.com/q/25198280
tags question: http://stackoverflow.com/q/25170708
tags question: http://stackoverflow.com/q/25199764
tags question: http://stackoverflow.com/q/25099756
tags question: http://stackoverflow.com/q/25204087
tags question: http://stackoverflow.com/q/25093307

http://stackoverflow.com/q/25184900
has answer: http://stackoverflow.com/a/25184969
accepted answer: http://stackoverflow.com/a/25184969
score: 4
has answer: http://stackoverflow.com/a/25185104
has answer: http://stackoverflow.com/a/25185050
tagged with: regex
has comment: http://stackoverflow.com/comment/39215742
favorite count: 0
answer count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2293780
has body: Suppose String str="123 abc 123.4 256"; Matcher m = Pattern.compile("\\d+").matcher(scan); while (m.find()) { System.out.println(m.group(0)); } By Using this code i am getting output as: 123 123 4 256 But in output i want it as 123 ,123.4,256. What pattern should i use to get desirable result or what are the other solution beside using Matcher And pattern.
possible better answer: http://stackoverflow.com/a/25185050
tagged with: java
has title: Extracting Floating Numbers From String Using Matcher and Pattern
has comment: http://stackoverflow.com/comment/39215725
has answer: http://stackoverflow.com/a/25184999
type: Question
upvote count: 4
downvote count: 0
linked to: http://stackoverflow.com/q/6754552

http://stackoverflow.com/comment/39080254
type: AnswerComment
score: 0
type: Comment
has text: Here's using modular maths (`i++%colors.length`) to calculate the actual index, it's a rather clever approach, as you never need to reset `i` back to `0`
comment on: http://stackoverflow.com/a/25111663

http://stackoverflow.com/a/25124890
answers question: http://stackoverflow.com/q/25124850
has body: problem: Thread t1=(Thread)r1; Thread t2=(Thread)r2; r1 and r2 are a Runnable not a Thread upon casting it it will generate ClassCastException. Instead instantiate the Thread and pass the runnable instance to the constructor. sample Thread t1=new Thread(r1); Thread t2=new Thread(r2);
type: Answer
score: 5
upvote count: 5
downvote count: 0

http://stackoverflow.com/q/25106640
linked to: http://stackoverflow.com/q/5233640
has answer: http://stackoverflow.com/a/25106652
type: UnansweredQuestion
has body: I want to see the sources of the libraries in directory: Android Private Libraries. When I try to do so it says "Source not found". Can someone tell me where they are stored?
type: Question
tagged with: android
has title: How to find the sources of Android Private Libraries
answer count: 1
has comment: http://stackoverflow.com/comment/39070588
score: 0
tagged with: java

http://stackoverflow.com/a/25141999
score: 1
upvote count: 1
has body: You could use a simpler pattern with a capturing group .*_(.*)\.nc By default the first .* will be "greedy" and consume as many characters as possible before the _, leaving just the desired string inside the (.*). Demo: http://regex101.com/r/aI2xQ9/1 Java code: String input = "PREVIMER_F2-MARS3D-MENOR1200_20140809T0000Z.nc"; Pattern pattern = Pattern.compile(".*_(.*)\\.nc"); Matcher matcher = pattern.matcher(input); if (matcher.find()) { String group = matcher.group(1); // ... }
downvote count: 0
answers question: http://stackoverflow.com/q/25141475
type: Answer

http://stackoverflow.com/comment/39170399
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25160528
type: Comment
has text: what is passed to the method by this parameter? @iDev

http://stackoverflow.com/a/58790028
answers question: http://stackoverflow.com/q/25223188
has body: I had the same issue, I solved it removing the plugin completely and installing it again, but this time making sure that I skip the License Required plugins. Another factor than can help is to run Eclipse as an administrator because the puglins folder are located in ProgramFiles. objectaid uml explorer without licensed plugins
score: 0
type: Answer

http://stackoverflow.com/comment/39273231
type: QuestionComment
has text: You should have root access & Android 4.4+ to record.
comment on: http://stackoverflow.com/q/25215302
score: 0
type: Comment

http://stackoverflow.com/comment/39110567
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25107849
has text: Timothy walters is correct, make sure you put the loop in the if(e== null) {} area, since that occurs on the main thread and after everything has been retrieved in the background. if you need more help you can message me or simple ask another question here, there's plenty of us here to help you. Also, making sure your foundation is solid with Java is paramount before beginning android. I recommend Tony Gaddis Java book, and then Core Java. It might take about 30+ days to complete, but afterwards your foundation will be SOLID. =)
type: Comment

http://stackoverflow.com/q/25214070
has comment: http://stackoverflow.com/comment/39271307
has comment: http://stackoverflow.com/comment/39271114
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/39271175
has answer: http://stackoverflow.com/a/25214279
type: Question
has body: Basically I have a class called WarriorSkills and I want to update the damage done of a skill based on the Warrior objects Weapon stats. The only way I could figure out to get a reference to the object of the warrior class to alter the stats of the Warriors skill based on the warriors weapon object (damage and strength), was to use an argument of the warrior class for the method getRoughSkillDamageModified() within the class WarriorSkills. First Class public class WarriorSkills extends Skills { private int rageCost; private double damageModified; public void getRoughSkillDamageModified(Warrior plc) //By Armour/Weapon stats { damageModified = plc.getWeapon().getAverageDamage() + plc.getStrength(); } public void updateStats() { this.setStrength(this.getStrength() + this.warriorWeapon.getBonusStrength()); this.skills.getRoughSkillDamageModified(this); } Second Class public class Warrior extends StrengthUser { private String className = "Warrior"; private StrengthWeapon warriorWeapon; private WarriorSkills skills; public Warrior(Warrior originalObject) { super(originalObject); } public Warrior(int stam, int health, int resi, int str, int rage, StrengthWeapon warrWep, WarriorSkills warSkill) { super(stam, health, resi, str); this.skills = warSkill; this.warriorWeapon = warrWep; } public String getClassName() { return className; } public void updateStats() { this.setStrength(this.getStrength() + this.warriorWeapon.getBonusStrength()); this.skills.getRoughSkillDamageModified(this); } public StrengthWeapon getWeapon() { return this.warriorWeapon; } public WarriorSkills warriorSkills() { return this.skills; } } But as you can see in order to invoke this method (within the Warrior class) I have to use 'this' representing the Warrior class both as the calling object and being passed as the argument. Now this use of the 'this' keyword seems kind of odd to me, but does seem to work. Is it avoided by convention or anything, or does it have any potential issues. My book doesnt see…
has comment: http://stackoverflow.com/comment/39271178
has comment: http://stackoverflow.com/comment/39271359
accepted answer: http://stackoverflow.com/a/25214279
tagged with: scope
answer count: 2
has comment: http://stackoverflow.com/comment/39271338
tagged with: this
downvote count: 0
has answer: http://stackoverflow.com/a/25214453
tagged with: variables
favorite count: 0
has comment: http://stackoverflow.com/comment/39271070
has comment: http://stackoverflow.com/comment/39271295
possible better answer: http://stackoverflow.com/a/25214453
has title: Is this Unwise Use of the 'this' Keyword?

http://stackoverflow.com/a/25137956
upvote count: 1
has comment: http://stackoverflow.com/comment/39129053
score: 1
accepted answer of: http://stackoverflow.com/q/25137790
type: AcceptedAnswer
has body: As far as I understand, you want a singleton. Check this answer for implementation. But note that singletons are "evil". A more webapp approach is to not have it as singleton, but initialize it once in a ContextLoaderListener and then put it as a ServletContext attribute. Then each servlet can obtain it by getting it from the servlet context.
downvote count: 0
has comment: http://stackoverflow.com/comment/39339390
type: Answer
has comment: http://stackoverflow.com/comment/39277851
answers question: http://stackoverflow.com/q/25137790

http://stackoverflow.com/a/56036128
score: 0
type: Answer
has body: I am addressing the situation when one wants to find which method does a certain line of code belong to (this is practical for large method blocks, when you have reached a certain line via Search for a keyword within the workspace). Of course, this answers a particular sub-case, as methods are blocks of code, too, but not all blocks of code are methods. One can gradually press Shift+Alt+Up Arrow, as pointed in an above answer, and will eventually have highlighted the entire body of the enclosing method. However, when highlighting a piece of code, in the Outline view, it's enclosing method is already highlighted, and clicking on it will bring the focus on the beginning of the method, in the Editor.
answers question: http://stackoverflow.com/q/25207561

http://stackoverflow.com/comment/83407575
comment on: http://stackoverflow.com/a/25185831
score: 0
type: AnswerComment
type: Comment
has text: @JavaTec Better to add Windows -> Preferences....

mockito
tags question: http://stackoverflow.com/q/25099500
tags question: http://stackoverflow.com/q/25185217
tags question: http://stackoverflow.com/q/25183501
tags question: http://stackoverflow.com/q/25120820
tags question: http://stackoverflow.com/q/25079008
tags question: http://stackoverflow.com/q/25162501
tags question: http://stackoverflow.com/q/25113384
tag name: mockito
tags question: http://stackoverflow.com/q/25205552
tags question: http://stackoverflow.com/q/25098155
tags question: http://stackoverflow.com/q/25088742
tags question: http://stackoverflow.com/q/25105585
tags question: http://stackoverflow.com/q/25149600
tags question: http://stackoverflow.com/q/25208727
tags question: http://stackoverflow.com/q/25097357
type: Tag
tags question: http://stackoverflow.com/q/25140742
tags question: http://stackoverflow.com/q/25120796
tags question: http://stackoverflow.com/q/25139369
tags question: http://stackoverflow.com/q/25201015

transition
tags question: http://stackoverflow.com/q/25090520
tag name: transition
type: Tag

http://stackoverflow.com/q/25115104
favorite count: 0
accepted answer: http://stackoverflow.com/a/25115380
has title: How to add more than one widget to TabPanel GWT?
has body: With these lines I have added only one widget for Tab Panel: DialogBox popupProperties = new DialogBox(); TabPanel tabPanel = new TabPanel(); HTML label1 = new HTML(" This is contents of TAB1</li "); label1.setHeight("200"); Label label2 = new Label("This is contents of TAB 2"); label2.setHeight("200"); Label label3 = new Label("This is contents of TAB 3"); label3.setHeight("200"); String tab1Title = "One"; String tab2Title = "Two"; String tab3Title = "Three"; tabPanel.add(label1,tab1Title); tabPanel.add(label2,tab2Title); tabPanel.add(label3,tab3Title); tabPanel.selectTab(0); tabPanel.setPixelSize(400, 400); popupProperties.add(tabPanel); popupProperties.setAutoHideEnabled(true); RootPanel.get().add(popupProperties); popupProperties.center(); popupProperties.show(); I'd like to add label, grid, chart for each Tab. How can I do this? Thanks a lot.
tagged with: tabpanel
tagged with: gwt
type: AnsweredQuestion
tagged with: widget
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25115380
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/39274347
comment on: http://stackoverflow.com/q/25215274
has text: I haven't used shiro for a long time, but I see you use a custom hash service to encode the password, and not for authenticating.My advice : confirm it works with a standard hash service, then search the doc to see where and how you can use the custom hash service in `login`
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25157463
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/39164999
has title: Using buttons on android - newbie
has answer: http://stackoverflow.com/a/25158838
has comment: http://stackoverflow.com/comment/60095577
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39165055
has answer: http://stackoverflow.com/a/25157584
answer count: 4
has body: I am a newbie to android development, trying to get buttons working. every time i use this code below, the error message "unfortunately the app has stopped". but when i remove the code the app runs but obviously the buttons do nothing. here is the code ive tried public class MyActivity extends Activity { /** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button button1 = (Button) findViewById(R.id.ExerciseButton); button1.setOnClickListener (new View.OnClickListener(){ public void onClick(View v) { setContentView(R.layout.exercises); } }); } } anybody able to help me out there? thanks
linked to: http://stackoverflow.com/q/4018772
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25157592
tagged with: button
has answer: http://stackoverflow.com/a/25157636

http://stackoverflow.com/comment/39188846
has text: What is the full message?
comment on: http://stackoverflow.com/q/25169946
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25112078
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
has body: I know there are tons of Eclipse/Subclipse questions out there regarding issues with javahl. I've been using Eclipse/Subclipse together for a long time without the javahl issues. I'm now running into the same issue though. I just recently upgraded to Java 7: $ java -version java version "1.7.0_65" Java(TM) SE Runtime Environment (build 1.7.0_65-b17) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode) I also upgraded to Eclipse Luna 4.4.0 and installed Subclipse. But after creating a remote repository and trying to browse it in the SVN Repository Exploring perspective I see this in the Eclipse .log error log file: java.lang.NoClassDefFoundError: Could not initialize class org.apache.subversion.javahl.SVNClient at org.tigris.subversion.svnclientadapter.javahl.JhlClientAdapter.&lt;init&gt;(JhlClientAdapter.java:57) at org.tigris.subversion.clientadapter.javahl.Activator.getAdapter(Activator.java:64) at org.tigris.subversion.clientadapter.Activator.getClientAdapter(Activator.java:70) at org.tigris.subversion.subclipse.core.SVNClientManager.getAdapter(SVNClientManager.java:127) at org.tigris.subversion.subclipse.core.SVNClientManager.getSVNClient(SVNClientManager.java:94) at org.tigris.subversion.subclipse.core.SVNProviderPlugin.getSVNClient(SVNProviderPlugin.java:462) at org.tigris.subversion.subclipse.core.repo.SVNRepositoryLocation.getSVNClient(SVNRepositoryLocation.java:257) at org.tigris.subversion.subclipse.core.resources.RemoteFolder.getMembers(RemoteFolder.java:164) at org.tigris.subversion.subclipse.core.resources.RemoteFolder.members(RemoteFolder.java:260) at org.tigris.subversion.subclipse.ui.operations.FetchMembersOperation.execute(FetchMembersOperation.java:41) at org.tigris.subversion.subclipse.ui.operations.SVNOperation.run(SVNOperation.java:90) at org.tigris.subversion.subclipse.ui.repository.model.SVNRepositoryRootElement.fetchDeferredChildren(SVNRepositoryRootElement.java:73) at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(Deferr…
upvote count: 8
has answer: http://stackoverflow.com/a/25112172
has comment: http://stackoverflow.com/comment/43846752
has answer: http://stackoverflow.com/a/32889792
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27717442
has answer: http://stackoverflow.com/a/25970759
type: Question
score: 8
has answer: http://stackoverflow.com/a/26213303
tagged with: svn
tagged with: subclipse
answer count: 6
has answer: http://stackoverflow.com/a/25120103
tagged with: eclipse
has title: Eclipse Luna (4.4.0) and Subclipse not working

http://stackoverflow.com/a/25210130
answers question: http://stackoverflow.com/q/25208239
accepted answer of: http://stackoverflow.com/q/25208239
type: Answer
has comment: http://stackoverflow.com/comment/47595187
score: 15
has comment: http://stackoverflow.com/comment/51428464
upvote count: 15
downvote count: 0
has comment: http://stackoverflow.com/comment/47540979
type: AcceptedAnswer
has body: Issue fixed by adding the required jars Needed the following three jars in the classpath, [I had these jars still, I was getting error due to wrong versions of the jar] ojdbc6.jar, xdb6.jar, xmlparserv2-11.1.1.jar Even if you have these jars, you might get error like I was getting when I was including a wrong version of xmlparserv2.jar. So Important thing to take care is the version and compatibility of these jars. The ones that worked for me [My Oracle DB version : 11.2.0.4.0] ojdbc6.jar; xdb6.jar: http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html xmlparserv2-11.1.1.jar available here: ( SQL Developer ) (in sqldeveloper\modules\oracle.xdk_12.1.2) [removed third party reference link as advised by @Lukas Eder, Thanks for that]

http://stackoverflow.com/q/25149934
type: AnsweredQuestion
tagged with: android-drawable
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25150414
has title: Andorid DrawPath doesn't fill-up the enclosed area
type: Question
downvote count: 0
tagged with: android-canvas
has body: Following list shows the x,y coordinates and particular method used to create a Path. 0 0 moveTO 180 0 lineTo 180 0 moveTO 246 227, 127 24, 115 150 cubicTo 127 276, 246 71, 180 300 cubicTo 180 300 moveTO 44 261, 166 332, 90 339 cubicTo 14 332, 136 261, 0 300 cubicTo 0 300 moveTO 0 0 lineTo Raw data points x = [0, 180, 180, 246, 127, 115, 127, 246, 180, 180, 44, 166, 90, 14, 136, 0, 0, 0] y = [0, 0, 0, 227, 24, 150, 276, 71, 300, 300, 261, 332, 339, 332, 261, 300, 300, 0] Idea of this algo is to draw four sides. Two sides are straight lines. Other two sides are composed of bezier curves having seven points in each curve. This is drawn using 1 moveTo and 2 cubicTo methods. Currently it creates a closed irregular shape if I use Paint.Style.STROKE. When it is drawn on the canvas using Paint.Style.FILL, it fills up only a part of the shape leaving a large square part empty in the middle. Some parts that is been filled are out of the shape closed area. paint.setColor(Color.RED); paint.setStyle(Paint.Style.FILL); canvas.drawPath(path, paint); My objective is to draw a bitmap covering this closed area. However, because the fill path does not fill the area correctly my objective cannot be achieved. Is there a way to realize this. Thanks
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/25150414
favorite count: 0
upvote count: 1

http://stackoverflow.com/q/25105375
upvote count: 1
tagged with: swing
tagged with: jspinner
tagged with: java
has title: How to set value of JSpinner from string?
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/25105699
possible better answer: http://stackoverflow.com/a/39903654
has answer: http://stackoverflow.com/a/39903654
type: Question
has body: I currently am using a JSpinner to set a time value which is then updated to my database as a varchar e.g. 12:00:00 AM. However in another form I would like to retrieve this time that was added into my database into the JSpinner in my update form. The update form is for the user to update the time that they have selected before (e.g. 12:00:00 AM like stated above). Right now the default time value is the current time. I tried to use the .setValue() method but it is an illegal value as my retrieved time is a String. Here is my code to make things clearer: shiftTime = new JSpinner(new SpinnerDateModel()); JSpinner.DateEditor de_shiftTime = new JSpinner.DateEditor(shiftTime, "hh:mm:ss a"); shiftTime.setEditor(de_shiftTime); shiftTime.setSize(108, 22); shiftTime.setLocation(436, 478); add(shiftTime); shiftTime.setValue(a.getVolDutyShift()); The .getVolDutyShift() method returns a string (12:00:00 AM in string format) a is my object which calls the .getVolDutyShift() method. How should I parse this a.getVolDutyShift() so the JSpinner will load the time as the time in my database (12:00:00 AM)?
favorite count: 0
has comment: http://stackoverflow.com/comment/39068576
answer count: 2
accepted answer: http://stackoverflow.com/a/25105699

http://stackoverflow.com/comment/39226609
type: QuestionComment
comment on: http://stackoverflow.com/q/25190140
score: 0
has text: http://localhost:9000/MVC_Hello_Annotation/welcome
type: Comment

http://stackoverflow.com/q/25131922
has comment: http://stackoverflow.com/comment/39125810
has comment: http://stackoverflow.com/comment/39117902
accepted answer: http://stackoverflow.com/a/25133662
tagged with: java
possible better answer: http://stackoverflow.com/a/25132064
has answer: http://stackoverflow.com/a/25132064
score: 2
type: AnsweredQuestion
has title: Binary to String Conversion in Java?
downvote count: 0
tagged with: string
favorite count: 0
tagged with: binary
has body: I convert String to binary using following code. Now i want to convert it back to string then how can i do it. String s = "Milind"; byte[] bytes = s.getBytes(); StringBuilder binary = new StringBuilder(); for (byte b : bytes) { int val = b; for (int i = 0; i &lt; 8; i++) { binary.append((val &amp; 128) == 0 ? 0 : 1); val &lt;&lt;= 1; } binary.append(' '); } System.out.println("'" + s + "' to binary: " + binary);
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/25133662

http://stackoverflow.com/q/25204887
favorite count: 0
upvote count: 5
has title: How to send a asynchronous response in an Undertow HttpHandler
downvote count: 0
tagged with: scala
type: UnansweredQuestion
type: Question
tagged with: nonblocking
tagged with: java
tagged with: jboss
has answer: http://stackoverflow.com/a/25223070
has body: I am looking for an example that shows how you write the Response in an undertow HttpHandler asynchronously? The problem is that when HttpServerExchange.endExchange is called the Response is flushed. My sample HttpHandler uses the rx-java library from Scala. class MyHandler() extends HttpHandler { override def handleRequest(exchange: HttpServerExchange) = { val observable = Observable.items(List(1, 2, 3)) // simplistic not long running observable.map { // this is run async myList =&gt; exchange.getResponseSender.send(myList.toString) } } }
score: 5
answer count: 1
tagged with: undertow

http://stackoverflow.com/comment/39008613
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25073413
has text: what devices are these?

http://stackoverflow.com/comment/39259333
has text: This looks better, but it won't run even with this change.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25198804

http://stackoverflow.com/q/25087878
score: 2
has answer: http://stackoverflow.com/a/25087935
upvote count: 2
accepted answer: http://stackoverflow.com/a/25087987
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25087987
tagged with: java
has answer: http://stackoverflow.com/a/25088026
possible better answer: http://stackoverflow.com/a/25087935
has body: I have seen other threads on this, but I still don't understand the best approach. Issue is as started: One can't compare user input that is a String to an arrayList item (object). My List will be over 40 items. So when I try to compare classesList.get(0) to the user input mage. It won't work. List&lt;String&gt; classesList = new ArrayList&lt;String&gt;(); classesList.add("mage"); classesList.add("warrior"); classesList.add("thief"); Scanner input = new Scanner(System.in); String input = input.next(); for (int counter = 0; counter &lt; classesList.size(); counter++) { if (input == classesList.get(counter)) { //won't run body since can't compare } } I found some who converted the arrayList to be a String. But I am unsure how I could then easily search through my list. I'd much rather leave it as a List instead. Is the best method to this approach? String[] classesArray = classesList.toArray(new String[classesList.size()]);
downvote count: 0
tagged with: string
linked to: http://stackoverflow.com/q/767372
favorite count: 0
tagged with: arraylist
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/25088027
answer count: 4
has title: Java: Comparing ArrayList item to User Input String

http://stackoverflow.com/a/25164989
upvote count: 1
type: Answer
has body: As Bruyere kindly pointed, related threads killing in result of timeout exception is detailed here: If concurrent requests are enabled through the "threadsafe" flag, every other running concurrent request is killed with error code 104:
answers question: http://stackoverflow.com/q/25159201
downvote count: 0
score: 1

http://stackoverflow.com/q/25198224
answer count: 1
has answer: http://stackoverflow.com/a/25198340
has body: The following is my script : This the the form : Enter the ID of the Shop which is to be deleted : The problem is that without performing form validation it is going onto the next page that is AdminDeleteShop2.jsp. And there it is giving me the following error : org.apache.jasper.JasperException: An exception occurred processing JSP page /AdminDeleteShop2.jsp at line 26 : int s_id = Integer.parseInt(s_id_string); root cause : java.lang.NumberFormatException: For input string: "" Connection con = DriverManager.getConnection( host, uName, uPass ); Scanner sc = new Scanner(System.in); String s_id_string = (String)request.getParameter("s_id"); int s_id = Integer.parseInt(s_id_string); Statement stmt2 = con.createStatement(); int check = stmt2.executeUpdate("delete from ShopSystem.Shop where s_id="+s_id+""); if(check>0) %> S_ID = <%= s_id %> has been deleted successfully. <% } else { %> Sorry the action cannot be completed. Please check if valid S_ID was entered <% } sc.close(); %>
accepted answer: http://stackoverflow.com/a/25198340
type: AnsweredQuestion
tagged with: java
tagged with: forms
type: Question
has title: Form validation error validation not processing
tagged with: jsp
score: 0

http://stackoverflow.com/comment/39294701
comment on: http://stackoverflow.com/q/25203415
type: Comment
score: 0
has text: possible duplicate of [Google Play Services version 5.2.08 too recent for my device](http://stackoverflow.com/questions/25198291/google-play-services-version-5-2-08-too-recent-for-my-device)
type: QuestionComment

http://stackoverflow.com/q/25202926
has answer: http://stackoverflow.com/a/25202961
tagged with: specifications
tagged with: anonymous-class
upvote count: 1
duplicate of: http://stackoverflow.com/q/44817768
answer count: 1
has title: Why this code yields false for final modifier?
favorite count: 0
type: UnansweredQuestion
tagged with: final
linked to: http://stackoverflow.com/q/54019203
linked to: http://stackoverflow.com/q/44817768
downvote count: 0
tagged with: reflection
score: 1
tagged with: java
has body: this is rather a theoretical question but maybe you know the specification that deep that will let you answer... Why this code yields false in terms of if the anonymous class is final? In practice the class can be considered final (there is no way to extend it without bytecode manipulation): public class Modifiers { public static void main(final String[] args) throws ClassNotFoundException { new Modifiers().go(); } public void go() throws ClassNotFoundException { final Runnable r = new Runnable() { @Override public void run() { System.out.println("Inside runnable"); } }; r.run(); System.out.println(Modifier.isFinal(getClass().getClassLoader().loadClass(Modifiers.class.getName() + "$1").getModifiers())); } }
type: Question

http://stackoverflow.com/a/25196039
has comment: http://stackoverflow.com/comment/39237207
type: Answer
answers question: http://stackoverflow.com/q/25195954
has body: Assuming the code you have works (you didn't say it doesn't work), you can edit the if body as if (isErase) { String mileageStr = (Integer.parseInt(mileageInput.getText().toString()) + 3500) + ""; nextMileage.setText(mileageStr); } Integer.parseInt() allows you to convert a string to an integer quickly.
score: 0

http://stackoverflow.com/comment/39235459
comment on: http://stackoverflow.com/q/25195214
type: QuestionComment
type: Comment
score: 1
has text: Posting the pom for completeness would be helpful. Also, does this only happen when running in Jenkins or from the command line as well?

http://stackoverflow.com/comment/39081368
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25074623
has text: Yes, jar is signed by a Certificate Authority. PC has accepted the certificate
score: 0

http://stackoverflow.com/a/25103832
has body: You seem to have a lot of code. So much, you can't tell what's going on. These few lines are enough to get the job done: String input = in.readLine(); List&lt;String&gt; words = new ArrayList&lt;String&gt;(Arrays.asList(input.split("\\s+|(?=\\.)"))); Collections.sort(words); String ordered = words.toString().replaceAll("\\[|\\]|,", "").replacrAll("^\\.( .*)", "$0."); The full stop is handled but expressly splitting it out, and because it will sort first, custom code to "move" it to the end if it exists.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25103434

http://stackoverflow.com/a/39234675
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25180902
has body: import java.util.Scanner; public class Test { public static void main(String args[] ) throws Exception { Scanner sc=new Scanner(System.in); if(sc.hasNextInt()) System.out.println("Input is of int type"); else System.out.println("This is something else"); } }
downvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/65806523

http://stackoverflow.com/q/25137076
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25154766
upvote count: 1
type: Question
tagged with: java
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25154766
score: 1
tagged with: wicket-1.5
favorite count: 0
has title: How to serve an AbstractResource with an IRequestHandler
has body: I have a form and I want to serve an AbstractResource by calling getRequestCycle().scheduleRequestHandlerAfterCurrent(target); Where target has to be an implementation of IRequestHandler. I want to pass the following AbstractResource object. public class ExcelResponseResource extends AbstractResource { @Override protected ResourceResponse newResourceResponse(Attributes attributes) { ResourceResponse resourceResponse = new ResourceResponse(); resourceResponse.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); resourceResponse.setTextEncoding("utf-8"); resourceResponse.setFileName("SomeExport.xlsx"); resourceResponse.setWriteCallback(new WriteCallback() { @Override public void writeData(Attributes attributes) { try { SomeExport export = new SomeExport(arguments); byte[] byteArray = ((ByteArrayOutputStream)export.getOutputStream()).toByteArray(); attributes.getResponse().write(byteArray); } catch (Exception e) { log.error("Something went wrong during Excel generation!", e); } } }); resourceResponse.disableCaching(); return resourceResponse; } } I want to know how i can put this beast into a ResourceStreamRequestHandler or something similar. Thanks in advance!

http://stackoverflow.com/q/25226764
tagged with: java
has answer: http://stackoverflow.com/a/25227789
accepted answer: http://stackoverflow.com/a/25227789
answer count: 2
possible better answer: http://stackoverflow.com/a/25227117
tagged with: random
has comment: http://stackoverflow.com/comment/39296223
has comment: http://stackoverflow.com/comment/39297935
has comment: http://stackoverflow.com/comment/39296282
score: 0
has comment: http://stackoverflow.com/comment/39294235
has comment: http://stackoverflow.com/comment/39294793
tagged with: service
has comment: http://stackoverflow.com/comment/39296255
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/25227117
has comment: http://stackoverflow.com/comment/39294864
has title: How to format code containing random numbers into a service and support methods?
has comment: http://stackoverflow.com/comment/39296546
type: Question
has body: I'm just having trouble with a specific question. My task is to write a program (Rearrange this code) which displays a random integer within a specific range. The app class should read the high and low integer values required from the user. create an instance of the support class, and display the result of a call to the random range method. The support class should contain no date fields and just one method. I'm a real newbie and when I arrange it keep getting errors to do with the the randomRange not being resolved to a type. If anyone could rearrange this in a way that works and tell me what you did along the way, it'd be great. Thanks :) My code: import java.util.Scanner; import java.util.Random; public class RandomApp{ public static void main(String[]args){ int lo = readInt("Enter lowest value"); int hi = readInt("Enter highest value"); RandomRange r = new RandomRange(); System.out.println("Random integer between " + lo + " and " + hi + " : " + r.randomRange(lo, hi)); } public static int readInt(String message){ Scanner sc = new Scanner(System.in); System.out.println(message); return sc.nextInt(); } /** Returns an integer entered by the user*/ } Another class: import java.util.Scanner; import java.util.Random; public class RandomRange{ /** Returns random integer between high and low parameters.*/ public int randomRange(int low, int high){ Random generator = new Random(); return generator.nextInt(high-low+1) + low; } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39296549

http://stackoverflow.com/comment/39151404
comment on: http://stackoverflow.com/a/25149764
type: AnswerComment
has text: You can try Kotlin then :) Regarding your question, I think I am wrong and the problem is not in (only?) in Java 8, but it might be IDE bug. I am not sure I get you correctly, but when do you get error? When you try to load layout xml in UI designer, or when you build project? If second, it should be Java 8, if 1st — it should be IDE bug.
score: 0
type: Comment

http://stackoverflow.com/comment/39003539
type: AnswerComment
score: 0
has text: @ElliottFrisch, you're absolutely right. I'll fix my answer.
type: Comment
comment on: http://stackoverflow.com/a/25070488

http://stackoverflow.com/a/25152356
answers question: http://stackoverflow.com/q/25152292
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/46757411
upvote count: 2
has body: DOM is a poor choice for large datasets, as it must load the document and maintain the structure in memory. DOM is great choice if you need to process the document multiple times in different ways or perform queries across it, but doesn't handle large files very well If you only need to do a single pass of the document (and don't need to do forward or reverse searching), then you could use a SAX Parser This basically uses the visitor pattern to provide feedback about the parsing process, but only maintains a small amount of information in memory. If you need to be able to search the document backwards or forwards or process the document multiple times, you could consider splitting the document into different, logical sections and processing the sections separatly, maybe storing the results in some kind of database for later coalation

http://stackoverflow.com/comment/39283432
type: Comment
comment on: http://stackoverflow.com/a/25214819
has text: Excelent solution. Thank you very much.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/39292806
has text: there are loads example of this, here are http://stackoverflow.com/questions/16103058/how-to-pass-a-list-of-string-in-mysql-stored-procedure http://stackoverflow.com/questions/6369/how-to-pass-a-comma-separated-list-to-a-stored-procedure http://www.codeproject.com/Tips/586395/Split-comma-separated-IDs-to-ge
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25223616
type: AnswerComment

http://stackoverflow.com/comment/39210002
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25180298
has text: http://stackoverflow.com/questions/19219255/supportmapfragment-getmap-returns-null as Xenione said sometimes getMap() method can return null

http://stackoverflow.com/comment/39244409
comment on: http://stackoverflow.com/a/25199822
score: 0
type: AnswerComment
has text: @AlexGreg : Any comments ?
type: Comment

http://stackoverflow.com/comment/39270321
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25213633
has text: Have you looked at following: [1. How to add new sheets to existing excel workbook using apache POI?](http://stackoverflow.com/questions/12459181/how-to-add-new-sheets-to-existing-excel-workbook-using-apache-poi) `AND` [2. Add a sheet into existing excel file](http://stackoverflow.com/questions/17383955/add-a-sheet-into-existing-excel-file)

http://stackoverflow.com/a/25119710
has body: String selectedGender = volunteer.getGender().toString(); if (selectedGender.equals("Female")) radioButtonFemale.setSelected(true); else radioButtonMale.setSelected(true); selectedGender retrieves the gender from the database, then and if else statement is used to check the value of the gender. If "Female" was selected, female is the default selected radiobutton.
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25118785
answers question: http://stackoverflow.com/q/25118785
has comment: http://stackoverflow.com/comment/39095145
has comment: http://stackoverflow.com/comment/39095242
type: AcceptedAnswer

http://stackoverflow.com/comment/87468309
score: 1
has text: @AaronM I edited my answer to get rid of what I think gave you the impression I was confused. Your answer is good, but I felt it was a bit too detailed in the technicalities. I also disagree somewhat to some of your semantics, but only mildly. My examples are Java based, no JavaScript anywhere in my answer. I feel it applies generically to all languages and OS. Do you still see anything confusing or that you disagree with it now?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/50205346

http://stackoverflow.com/comment/39489004
score: 0
type: Comment
type: QuestionComment
has text: Having similar issues - any solution found?
comment on: http://stackoverflow.com/q/25193631

http://stackoverflow.com/comment/39254454
type: AnswerComment
type: Comment
has text: I am not getting part inside while loop. It is working fine but how is it working as we are concerned about min factors of 2 and 5 for eg fact of 5 is 120 it contains 1 factor of "5" and 3 of "2". so the ans would be 1. I got this part but i didn't get how you make it work in code.
comment on: http://stackoverflow.com/a/25205104
score: 0

http://stackoverflow.com/comment/39197730
comment on: http://stackoverflow.com/q/25174921
type: Comment
type: QuestionComment
score: 2
has text: This question appears to be off-topic because of OP's lack of contribution to solve the issue.

http://stackoverflow.com/q/25090976
has title: Error while getting integer from file(Convert String to Int)
score: 0
possible better answer: http://stackoverflow.com/a/25091013
upvote count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39042084
has comment: http://stackoverflow.com/comment/39041749
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25091013
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/25090991
type: Question
accepted answer: http://stackoverflow.com/a/25090991
answer count: 2
has body: I have a file: student.txt 1 Adam 50 50 50 2 Eric 34 28 38 3 Joash 44 48 49 4 Bill 34 30 45 I have 2 classes: 1 is main and another one does all the work. // Class 1 ****************** public class Main { public static void main(String[] args) { readfile a = new readfile(); a.openFile(); a.readFile(); a.closeFile(); } } // ********* Class 2 import java.util.*; import java.io.*; import java.lang.*; public class readfile { private Scanner x; public void openFile(){ try{ x = new Scanner(new File("student.txt")); } catch(Exception e){ System.out.println("Error"); } } public void readFile(){ int a=0; String b; int c=0; int d = 0; int e = 0; int total; while(x.hasNext()){ a = x.next(); b = x.next(); c = x.next(); d = x.next(); e = x.next(); int total = c+d+e; total = x.nextInt(); System.out.printf("%s %s %s %s %s %s/n",a,b,c,d,e,total); } } public void closeFile(){ x.close(); } } I have 2 errors: 1) This is at a = x.next(); where it says Can't convert from String to int. Can you tell me how to fix that? 2) This is at: Exception in thread "main" Error java.lang.NullPointerException How do I fix this?

http://stackoverflow.com/comment/39135214
has text: why do you use onQueryLoadListener with empty methods in it? Then you have two onLoaded() methods in it - remove one that not overrides abstract method Also in onLoaded() method check the length of received list. Maybe you need to cast received list of ParseObject to your custom class Then try not to use QueryFactory, simply create ParseQueryAdapter<ParseUser> and see what's happened
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25122520

http://stackoverflow.com/comment/88979634
comment on: http://stackoverflow.com/a/48532528
score: 0
type: Comment
has text: Thanks Jeff for this edit. My original post was written in Groovy, not Java.
type: AnswerComment

http://stackoverflow.com/comment/39293637
comment on: http://stackoverflow.com/q/25226308
type: Comment
has text: I have HelloWorld.jsp
score: 0
type: QuestionComment

http://stackoverflow.com/a/25097075
answers question: http://stackoverflow.com/q/25095667
has body: Resolved. package com.simpleprogrammer; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistryBuilder; public class HibernateUtilities { private static SessionFactory sessionFactory; private static ServiceRegistry serviceRegistry; static { try { Configuration configuration = new Configuration().configure(); serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry(); sessionFactory = configuration.buildSessionFactory(serviceRegistry); } catch (Throwable ex) { System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } } I used the incorrect method to get the SessionFactory
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25095667
type: Answer

http://stackoverflow.com/q/25100366
tagged with: api
upvote count: 1
tagged with: user-interface
has body: Before you read, this will be informative: Java JFrame won&#39;t show up after using .setVisible(true) after being invisible Hello I am working on a library API that let's you capture an area of the screen, and it returns you a class that contains the ByteArrayInputStream and utility methods like createBufferedImage, createFile, etc. Basically you create a Bootstrap instance, and pass the capturer type you want as a dependency (ScreenshotCapturer or GifCapturer): Bootstrap b = new Bootstrap(new ScreenshotCapturer()); And the beginCapture method receives an object that implements ScreenCaptureCallback which is the callback event that the captured result will be passed to. This is a short background. Now when you use the beginCapture method, basically what it does is creates new instance of SelectionCamera, this is basically the component that paints the selection area you're selecting when dragging the mouse, and updates the listeners. once created instance, it calls super.setVisible(true); After that method gets called, the frame will show up, and also show the old painted screen for like 600-500miliseconds, I am not exactly sure, but it disappears so quickly. Take a look at this live example: Note use the video option, otherwise you will not see what I'm seeing as gif is too slow to show it! http://gyazo.com/d2f0432ada37842966b42dfd87be4240 You can see after I click Screenshot again, it shows the old selected area and disappears quickly. (by the way the frame you see in the gif is not part of the app, just dummy hello world example usage). The process of image capture. Step 1 beginCapture gets called: public void beginCapture(final ScreenCaptureCallback c) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { capturer.setCallback(c); capturer.beginSelection(); } }); } Step 2 beginSelection gets called in the Capturer class (ScreenshotCapturer extends Capturer (abstract) @Override public void beginSelection() { super.init(); this.setHotkeys(); …
favorite count: 0
has comment: http://stackoverflow.com/comment/39061353
has comment: http://stackoverflow.com/comment/39067773
has answer: http://stackoverflow.com/a/25106308
has comment: http://stackoverflow.com/comment/39067962
downvote count: 0
linked to: http://stackoverflow.com/q/25067871
has title: Java screenshot capture - JFrame paints old component for a second & disappears even though all components were removed & repainted
has answer: http://stackoverflow.com/a/25112779
accepted answer: http://stackoverflow.com/a/25112779
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39069479
type: Question
has comment: http://stackoverflow.com/comment/39069845
possible better answer: http://stackoverflow.com/a/25106308
answer count: 2

http://stackoverflow.com/a/25161551
type: AcceptedAnswer
has body: Correct me if I'm wrong in any of the answers and I'll edit: 1.- Android has been JIT for years but there's a new runtime that enforces AOT to improve performance now that most devices can handle it: Dalvik ART 2.- ?? 3-5.- The android jar is provided by the IDE for compiling purposes but the actual implementation is loaded by the operative system, that's how they achieve backwards compatibility (and fragmentation) and the same APKs working on cooked roms like Samsung's or Amazon's. 6.- Yes, everything is packed in classes.dex and there's a hardcap of 65k methods between all dependencies. There are some compiler-time substitutions for dependencies that may be already included in the OS. 7.- I am not sure about the new AARs but modules or other projects are compiled and bundled together, yes. 8.- There is a shared memory space for those things, along with system assets: Commonsware - What is Dalvik section Memory Consumption.
type: Answer
accepted answer of: http://stackoverflow.com/q/25161093
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25161093
upvote count: 2

http://stackoverflow.com/comment/39058466
comment on: http://stackoverflow.com/q/25099982
has text: You can add some stacktrace, what framework are you using?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39292209
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25224323
has text: This question seems pretty similar to: [Platform.Runlater and Task Javafx](http://stackoverflow.com/questions/13784333/platform-runlater-and-task-javafx) and [Javafx: Difference between javafx.concurent and Platform.runLater?](http://stackoverflow.com/questions/18710039/javafx-difference-between-javafx-concurent-and-platform-runlater)
score: 0

http://stackoverflow.com/comment/39256253
comment on: http://stackoverflow.com/q/25206097
type: Comment
type: QuestionComment
has text: @Bathsheba: The downvotes are probably because this question is **much too broad**: Different explanations for the ***four different languages***. Still, close-voting would be better.
score: 2

http://stackoverflow.com/comment/82134344
type: AnswerComment
type: Comment
has text: Can you show me how to use these arguments in Application.class or in Bootstrap.class? (I am using grails 3.x.x)
comment on: http://stackoverflow.com/a/38792860
score: 0

http://stackoverflow.com/comment/39246761
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25184358
score: 0
has text: This happened to me as well, after installing the most recent scala plugin update (version 0.41) for IntelliJ IDEA.

http://stackoverflow.com/a/25119909
has comment: http://stackoverflow.com/comment/39095444
score: 0
has comment: http://stackoverflow.com/comment/39095627
type: Answer
has body: No, I believe you don't have any control over how GAE starts the virtual machines. I think your best option if you want to control this would be the managed VMs: https://developers.google.com/appengine/docs/managed-vms/ Quoting: Note: Managed VMs will also support custom user-configurable custom runtimes very soon.
answers question: http://stackoverflow.com/q/25117276

http://stackoverflow.com/a/25119738
answers question: http://stackoverflow.com/q/25119673
type: AcceptedAnswer
downvote count: 0
has body: Using regex: String num = input.replaceAll(".*_(\\d+)(_[^_]*){2}$", "$1");
score: 1
has comment: http://stackoverflow.com/comment/39095117
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25119673

http://stackoverflow.com/comment/39203905
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25178488
has text: Also, please pick a summary for your question that explains the problem, not your feelings.
type: Comment

http://stackoverflow.com/comment/39228509
type: Comment
has text: I did it but I get the same error message: Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named todos at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:85) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54) at Main.main(Main.java:15)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25190884

http://stackoverflow.com/a/25116699
answers question: http://stackoverflow.com/q/25115313
has comment: http://stackoverflow.com/comment/39089537
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25115313
has comment: http://stackoverflow.com/comment/39090203
has body: The anchor property is working correctly, the issue you are having is with... conOptGBC.weightx = 1.0; conOptGBC.weighty = 1.0; The problem is, you've asked GridBagLayout to allocate equal amount of space for each column, so they will take up, in this case, are third each, this is what would be consider. By removing the conOptGBC.weightx = 1.0; you get... It's a little difficult to see, but if we add some guides in... You can see that the fields begin to align to the north-west...

http://stackoverflow.com/comment/39017777
has text: so, you think there is no need to have double Array for lon and lat?-Somayeh
score: 0
comment on: http://stackoverflow.com/q/25078119
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25139508
favorite count: 0
has body: today we talked about advantages of Java 7 in our company. Since Java 7 there is the possibility to define following line Map&lt;String, List&lt;String&gt;&gt; myMap = new HashMap&lt;String, List&lt;String&gt;&gt;(); as Map&lt;String, List&lt;String&gt;&gt; myMap = new HashMap&lt;&gt;(); We had a long discussion about the topic described above. Some of us had the opinion that this is type inference (like var keyword in C#) and the type will be computed at runtime, others thought it's only a simpler way to declare some variable and there is no inference, because the type of is known by the context at compile time. Please provide clarification. How dows the technique work? EDIT: Official Oracle Documentation provides no precise documentation about that. http://docs.oracle.com/javase/tutorial/java/generics/genTypeInference.html
has answer: http://stackoverflow.com/a/25154789
has answer: http://stackoverflow.com/a/25139575
type: AnsweredQuestion
tagged with: java
downvote count: 2
upvote count: 1
tagged with: type-inference
has comment: http://stackoverflow.com/comment/39131740
type: Question
tagged with: variable-declaration
has comment: http://stackoverflow.com/comment/39132981
score: -1
accepted answer: http://stackoverflow.com/a/25139575
has answer: http://stackoverflow.com/a/25139730
answer count: 3
has comment: http://stackoverflow.com/comment/39132841
tagged with: java-7
has title: Type Inference: Java 7 Type Parameters
possible better answer: http://stackoverflow.com/a/25139730
tagged with: generics

http://stackoverflow.com/q/25113958
answer count: 1
tagged with: amazon-ec2
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/25141395
tagged with: performance-testing
has title: Mongodb: write results unavailable from shard01... caused by.. sharded connection pool: connect failed
has answer: http://stackoverflow.com/a/25141395
has body: Environment mongo db 2.6.3 CentOS release 6.5 (Final) Java 1.7 Tomcat 7 Jmeter 2.11 Amazon ec2 Our mongo dbs are hosted in amazon ec2. We have set up our servers based on the recommended production architecture and is as follows: 3 config servers 2 mongos running along with tomcats 2 mongod, which is a replica set with a primary and a secondary (shard 1) We are currently load testing our application with 3500 concurrent users. Our application is messaging(write) heavy so we are currently experimenting with 2 dbs one for users and other for messages. When we had single db(users, messages as collections) the avg response time was 2.3 seconds but the error rate is almost 0.00%. When we had 2 dbs one with users and other with messages the avg response time was 1.1 secs, but the error rate has gone higher (0.16%) When we checked the tomcat(app server logs) we found lots errors like the following: ~ 88% of errors: { "serverUsed" : "localhost:27017" , "ok" : 1 , "n" : 0 , "err" : "write results unavailable from shard01-primary.mycompanys.com:27018 :: caused by :: Location13328 sharded connection pool: connect failed shard01-primary.mycompanys.com:27018 : couldn't connect to server shard01-primary.mycompanys.com:27018 (10.0.1.111), connection attempt failed" , "code" : 83} ~5.5% of errors: ReplicaSetMonitor no master found for set: shard01 ~2.2% of errors: { "serverUsed" : "localhost:27017" , "ok" : 1 , "n" : 0 , "err" : "could not contact primary for replica set shard01" , "code" : 7} But the primary of the replicas (shard01-primary.mycompanys.com) was running while the errors were thrown. shard01:PRIMARY&gt; rs.status() { "set" : "shard01", "date" : ISODate("2014-08-04T08:57:59Z"), "myState" : 1, "members" : [ { "_id" : 0, "name" : "shard01-primary.mycompanys.com:27018", "health" : 1, "state" : 1, "stateStr" : "PRIMARY", "uptime" : 1032189, "optime" : Timestamp(1406913104, 6), "optimeDate" : ISODate("2014-08-01T17:11:44Z"), "electionTime" : Timestamp(1406110686, 1), "elec…
has comment: http://stackoverflow.com/comment/39114945
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
tagged with: mongodb
has comment: http://stackoverflow.com/comment/39121961
has comment: http://stackoverflow.com/comment/39132805

http://stackoverflow.com/comment/39181911
comment on: http://stackoverflow.com/q/25166233
score: 0
type: Comment
type: QuestionComment
has text: String != int even if a String contains an integer. If you want a dynamic version of Java try Groovy

http://stackoverflow.com/q/25183596
upvote count: 0
has answer: http://stackoverflow.com/a/25183649
favorite count: 0
has answer: http://stackoverflow.com/a/25184014
tagged with: jdbc
possible better answer: http://stackoverflow.com/a/25184014
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25183649
tagged with: java
has body: I am retrieving data from a database and the customer id is a big decimal: public List&lt;Data&gt; getData() { log.info("get getData"); List&lt;Map&lt;String, Object&gt;&gt; rows = jdbcTemplate.queryForList(SQL_SELECT_DATA); for(Map row : rows) { Data data = new Data(); data.setCustId((String)row.get("CUST_ID")); data.setProjectId((String)row.get("PROJECT_ID")); data.setProjectName((String)row.get("PROJECT_NAME")); //add the data object to the list dataList.add(data); } return dataList; } Any suggestions what would be a quick and easy way to convert the "CUST_ID" to a String?
downvote count: 1
type: Question
tagged with: bigdecimal
score: -1
has title: Convert bigDecimal to String from db
answer count: 2

http://stackoverflow.com/q/25118727
score: 38
upvote count: 38
has comment: http://stackoverflow.com/comment/39093078
type: AnsweredQuestion
has title: How to generate fields of type String instead of CharSequence using Avro?
type: Question
has answer: http://stackoverflow.com/a/25315412
has answer: http://stackoverflow.com/a/35727432
tagged with: java
has body: I wrote one Avro schema in which some of the fields ** need to be ** of type String but Avro has generated those fields of type CharSequence. I am not able to find any way to tell Avro to make those fields of type String. I tried to use "fields": [ { "name":"startTime", "type":"string", "avro.java.stringImpl":"String" }, { "name":"endTime", "type":"string", "avro.java.string":"String" } ] but for both the fields Avro is generating fields of type CharSequence. Is there any other way to make those fields of type String?
tagged with: avro
answer count: 2
possible better answer: http://stackoverflow.com/a/35727432
tagged with: apache
downvote count: 0
accepted answer: http://stackoverflow.com/a/25315412
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/39460330

http://stackoverflow.com/comment/39077564
comment on: http://stackoverflow.com/a/25110004
type: AnswerComment
score: 0
has text: @SuzanCioc `cancel(boolean)` does exactly what it says, `Attempts to cancel execution of this task`, by calling `interrupt` on the underlying `Thread`. Again, unless the implementation is checking the `interrupted` state of the `Thread`, it will do nothing
type: Comment

opencv
type: Tag
tags question: http://stackoverflow.com/q/25099511
tags question: http://stackoverflow.com/q/25213870
tags question: http://stackoverflow.com/q/25085417
tags question: http://stackoverflow.com/q/25228610
tags question: http://stackoverflow.com/q/25186124
tag name: opencv
tags question: http://stackoverflow.com/q/25195522
tags question: http://stackoverflow.com/q/25192119

http://stackoverflow.com/comment/87580472
has text: As to the JavaScript comment, what I should have said was that it felt tilted towards an evented/functional programming environment, which I still feel that it is. That isn't as common in Java, and is very common in JavaScript, hence the comment I did make. But all of these types of IO are also used in non-event driven code, traditional procedural code as well. The async becomes a lot more complicated in that case, but it is very possible to do non-blocking async io without using a callback (or promise or future). The callback and other alternatives do make the code easier to follow.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/50205346
type: AnswerComment

http://stackoverflow.com/a/25200987
has body: If it is just a variable value you want to change you can do this. When you are debugging in the debug view of eclipse there is a variables window. If you right click on the variable you wish to change and press 'Change Value' a window will pop up and you can change the value of that variable in there.
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39248704
type: Answer
has comment: http://stackoverflow.com/comment/39250256
accepted answer of: http://stackoverflow.com/q/25200734
score: 1
answers question: http://stackoverflow.com/q/25200734

http://stackoverflow.com/comment/39270550
type: Comment
has text: `You can do everything in Java without requiring static` if that's the case, then why does the JRE provide classes with static methods almost everywhere you look? Again, a blanket statement backed up by an **opinion** - not rationale.
type: AnswerComment
comment on: http://stackoverflow.com/a/25213817
score: 0

http://stackoverflow.com/q/25163994
tagged with: http://stackoverflow.com/tag/xml
has body: I'm trying to program a button to first create a file them send it using an email provider but i keep getting this error in the logcat: Caused by: java.lang.NoSuchMethodException: clickedUpdate [class android.view.View] I'm sure that im getting something truly trivial wrong but i can't seem to find what it is, i've browsed other questions but they don't apply to my case. By the way this code is place above the onCreate method and inside a regular activity. java: public void clickedUpdate(Context cn, View view) { TextView dLong = (TextView) findViewById (R.id.textLong); TextView dLat = (TextView) findViewById (R.id.textLat); String dataLat = dLat.getText().toString(); String dataLong = dLong.getText().toString(); boolean UpdateResume; if(!(dataLat.equals("") &amp;&amp; !(dataLong.equals("")))) { UpdateResume = true; } else { UpdateResume = false; } TelephonyManager telephonemanager =(TelephonyManager)cn.getSystemService(Context.TELEPHONY_SERVICE); String PhoneNumber = telephonemanager.getLine1Number(); File DataDir = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+File.separator+"Android/LocationData"); if(!DataDir.exists()) { try { DataDir.mkdir(); } catch (Exception e) { e.printStackTrace(); } } File Data = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+File.separator+"BlogData" + File.separator+"Locationer.txt"); if(!Data.exists()) { try { Data.createNewFile(); } catch (IOException e) { e.printStackTrace(); } while (UpdateResume = true) { if (Data.exists()) { try { FileWriter fileWriter = new FileWriter(Data); BufferedWriter bfWriter = new BufferedWriter(fileWriter); bfWriter.write(PhoneNumber + "," + dataLat + "," + dataLong); bfWriter.close(); } catch (IOException e) { e.printStackTrace(); } } break; } } Intent emailintent = new Intent(Intent.ACTION_SEND); emailintent.setType("text/plain"); emailintent.putExtra(Intent.EXTRA_EMAIL, new String[]{"xxxxxxxxx@xxxxxxxx.com"}); emailintent.putExtra(Intent.EXTRA_SUBJECT, "Data"…
has title: No Such Method Exception button error (XML onClick)
tagged with: java
has answer: http://stackoverflow.com/a/25164089
type: Question
tagged with: logcat
linked to: http://stackoverflow.com/q/18319711
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25164057
type: UnansweredQuestion
tagged with: android
duplicate of: http://stackoverflow.com/q/18319711

twirl
type: Tag
tags question: http://stackoverflow.com/q/25182948
tag name: twirl
tags question: http://stackoverflow.com/q/25149833

http://stackoverflow.com/a/42785845
type: Answer
has body: Hope you are using java version compatible with generics(1.5 or more).You should give the type parameter as String like Steve said. You can also create a user class public class User{ String uname; String pwd; public User(u,p){ uname=u; pwd=p; } } and create an ArrayList of those user objects in the main class ArrayList&lt;User&gt; list=new ArrayList&lt;&gt;(); and add those user objects with values retrieved from the fields to the list list.add(new User(uname,pword))
score: 0
answers question: http://stackoverflow.com/q/25215386

http://stackoverflow.com/comment/39024205
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25081253
type: AnswerComment
has text: Request processing failed; nested exception is org.hibernate.QueryException: could not resolve property: projectId of: com.dcm.search.bean.Issue

http://stackoverflow.com/comment/39221446
comment on: http://stackoverflow.com/a/25187503
type: AnswerComment
score: 0
has text: i put the break; in the If(condition) it only let me loop once, It need to stop when the record is 0
type: Comment

http://stackoverflow.com/q/25177177
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/47523870
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/47523870
tagged with: spring-data-mongodb
has title: Spring data mongodb aggregate function not working using 1.3.5-RELEASE of spring-data-mongodb
has answer: http://stackoverflow.com/a/25183293
tagged with: spring-data
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/39211377
type: AnsweredQuestion
tagged with: java
has body: I have requirement to filter document in mongodb using spring data which contains nexted arrays of arrays. I am using following aggregation query on mongo shell and it is working fine. But when I am firing that through springdata aggregation operation, I am gettin empty response. Working mongo query is: db.searchResource.aggregate({$match:{"_id" : ObjectId("53cf4e3dae92ac6561807f6d")}},{$project:{"rssSearchResponse.journeys":1}},{$unwind : "$rssSearchResponse.journeys"},{$match:{"rssSearchResponse.journeys.stops":0}}); Spring data code which I am using and s not working: TypedAggregation&lt;SearchResource&gt; aggregation = Aggregation.newAggregation(SearchResource.class, Aggregation.match(new Criteria("_id").is(new ObjectId(searchId))), Aggregation.project("rssSearchResponse.journeys"), Aggregation.unwind("rssSearchResponse.journeys"), Aggregation.match(new Criteria("rssSearchResponse.journeys.stops").is(0)) ); AggregationResults&lt;SearchResource&gt; result = mongoOperations.aggregate(aggregation, JourneyInformation.class); I have tried breaking this aggregate function and it is able to project rssSearchResponse.journeys but after $unwind it returns empty result. Any help is highly appreciated.
has comment: http://stackoverflow.com/comment/39238298
accepted answer: http://stackoverflow.com/a/25183293
type: Question
tagged with: mongodb

http://stackoverflow.com/comment/39351678
type: Comment
score: 0
type: AnswerComment
has text: then you can accept the answer if you found our discussion helpful to you :)
comment on: http://stackoverflow.com/a/25133503

http://stackoverflow.com/comment/39329104
has text: Look at tmarwen's answer. A library must use packaging jar to be used as a dependency. I had not noticed that packaging was war.
comment on: http://stackoverflow.com/a/25223819
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39263767
score: 5
comment on: http://stackoverflow.com/q/25210374
type: Comment
type: QuestionComment
has text: What is your question?

http://stackoverflow.com/comment/39053992
comment on: http://stackoverflow.com/a/25096332
type: AnswerComment
type: Comment
has text: It works even in my code (if i copy it), but it disconnects after it. Also, the images i receive are only a part of the real screenshot.
score: 1

http://stackoverflow.com/comment/90090441
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25135451
has text: I had to use StyledText, I tried using simple Text but couldn't get rid of the border which made it look more like a button than a label. And the caret was an eye-sore too. But StyledText works nicely.
type: AnswerComment

http://stackoverflow.com/a/25223568
score: 0
answers question: http://stackoverflow.com/q/25223353
type: Answer
has body: Try these: 1. Sort the proposals by relevance and not alphabetically. 2. Hide proposals not visible in the invocation context (you have this one) and 3. Hide deprecated references
has comment: http://stackoverflow.com/comment/39288592

http://stackoverflow.com/a/62344252
upvote count: 3
downvote count: 0
type: Answer
has body: @AnandMohan is correct. You just have to make copy on "tmp" folder because all the locations are read only, just "tmp" is writable. Check below: Storage storage = StorageOptions.newBuilder().setProjectId(PROJECT_ID).build().getService(); Blob blob = storage.get(BUCKET_NAME, fileName); ReadChannel readChannel = blob.reader(); File file = new File("/tmp/" + FILE_NAME); FileOutputStream fileOuputStream = new FileOutputStream(file); fileOuputStream.getChannel().transferFrom(readChannel, 0, Long.MAX_VALUE); fileOuputStream.close(); // Now file is ready to send whereever you want
score: 3
answers question: http://stackoverflow.com/q/25141998

http://stackoverflow.com/q/25210374
has comment: http://stackoverflow.com/comment/39263767
upvote count: 0
score: -2
answer count: 1
has title: DecimalFormat Spaghetti
favorite count: 0
has body: First time using the DecimalFormat classes... I need to store 4 decimals precision for my value. Let me show you what I have done so far. public class Paper { public String name, color, type,finish,grain; public double width,height,gsm, lbs,ppi; public DecimalFormat df; public Paper() { String pattern = "#0.0000"; df = new DecimalFormat(pattern); } public void setWidthAndHeight(String width, String height) { //I've censured what I tried so far. ///I need to ensure that the passed width has 4 decimals and that it is stored that way. this.width = //ENTER answer here! :) } Thank you for your time, and patience.
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/25210423
tagged with: decimalformat
tagged with: java
type: Question

http://stackoverflow.com/q/25096050
linked to: http://stackoverflow.com/q/24715492
has title: Can't set text on label or text class because of NullPointerException
tagged with: text
upvote count: 0
has body: public void setBtnAction(ActionEvent event) { String leagueNameString = nameFld.getText(); if ((leagueNameString == null) || (leagueNameString == "")) { nameFld.setPromptText("Enter value league name"); } else { CoreAppFXMLController cp = new CoreAppFXMLController(); cp.nameOfTheLeague.setText(leagueNameString); } } } I tried with both, text and label, but none of them works. nameOfTheLeague is protected in CoreAppFXMLController class. It returns me NullPointerException. id's are ok in fxml.
tagged with: java
has comment: http://stackoverflow.com/comment/39051063
type: Question
score: -2
has comment: http://stackoverflow.com/comment/39051600
tagged with: label
has answer: http://stackoverflow.com/a/25096293
downvote count: 2
has comment: http://stackoverflow.com/comment/39051263
linked to: http://stackoverflow.com/q/513832
answer count: 1
has comment: http://stackoverflow.com/comment/39053887
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39051298

http://stackoverflow.com/q/25151627
tagged with: android-activity
has body: With support, I have created a list of arrays populated through JSON data, and where when a user clicks on an item, it takes them to an activity page that provides them with more information about it. I have tried to accomplish this but the result so far have been unsatisfactory. In the sense that the list of arrays do display successfully, but when an item is click a blank activity page is unexpectedly shown. Below is list of arrays activity code: public class EventsActivity extends Activity{ private static final String URL_WEB_SERVICE = "http://dooba.ca/analytics/ed.php"; private GridView gv; private ArrayList&lt;Events_List&gt; container; private ArrayList&lt;Events_List&gt; items; public Uri list_item_bac; public String list_item_name; public String list_item_description; public String list_item_price; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.events_list_layout); gv = (GridView) findViewById(R.id.gridview); container = new ArrayList&lt;Events_List&gt;(); //download JSON listDownload(); GridView s = (GridView) findViewById(R.id.gridview); s.setOnItemClickListener(new OnItemClickListener(){ @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Intent intent = new Intent(EventsActivity.this,EventSingleItemActivity.class); intent.putExtra("list_item_name", list_item_name); intent.putExtra("list_item_description", list_item_description); intent.putExtra("list_item_price",list_item_price); startActivity(intent); //start Activity } }); } public void listDownload(){ RequestQueue volley = Volley.newRequestQueue(this); JsonObjectRequest json = new JsonObjectRequest(Method.GET, URL_WEB_SERVICE, null, ResponseListener(), ErrorListener()); volley.add(json); } private Response.Listener&lt;JSONObject&gt; ResponseListener() { return new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { try { //your JSON Arra…
type: AnsweredQuestion
tagged with: android-layout
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25151744
type: Question
has comment: http://stackoverflow.com/comment/39154704
has title: Single Item Click in a list
answer count: 1
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/25151744

http://stackoverflow.com/comment/39161165
has text: `try(ResultSet output = ...´ too. http://db.apache.org/derby/docs/10.6/ref/ - search "derby.storage"
type: Comment
comment on: http://stackoverflow.com/q/25155060
type: QuestionComment
score: 0

http://stackoverflow.com/a/25120515
score: 2
has comment: http://stackoverflow.com/comment/39118097
accepted answer of: http://stackoverflow.com/q/25120357
upvote count: 2
answers question: http://stackoverflow.com/q/25120357
type: AcceptedAnswer
has body: Most elements in JavaFX own an observable property, which represents the value. In the case of a label, its a textProperty(), which you can fetch and edit. All edits to that StringProperty (which is the type, returned by the textProperty() method), will be displayed in the related label. See http://docs.oracle.com/javafx/2/api/javafx/scene/control/Labeled.html#textProperty%28%29 I suggest the approach to fetch the StringProperty, handle it as a model in a MVC structure and store it in a globally reachable model repository. In your logic thread, fetch the device name and write the result into the model aka StringProperty, and your label will be notified by the change and display the fetched value.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39199373
score: 0
comment on: http://stackoverflow.com/q/25175488
has text: i am new member,i have a problem with post code,do u mind give me your email,i can easily email u my code
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25215832
has title: Why isn't the threadpooltest running correctly?
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/25215915
has comment: http://stackoverflow.com/comment/39274291
type: Question
has comment: http://stackoverflow.com/comment/39274251
score: 0
has comment: http://stackoverflow.com/comment/39274172
tagged with: java-7
answer count: 1
has comment: http://stackoverflow.com/comment/39274222
has answer: http://stackoverflow.com/a/25215915
has body: http://www.java2s.com/Code/Java/Threads/ThreadPoolTest.htm I downloaded the source code from the official website, but can't get the code running for some reason. I have JCreator 5.0 and the latest java. --------------------Configuration: -------------------- Tests the ThreadPool task. Usage: java ThreadPoolTest numTasks numThreads numTasks - integer: number of task to run. numThreads - integer: number of threads in the thread pool. Process completed. Is it because the code is not compatible with Java 7? How come? Is there a way to use Java 6 without uninstalling Java 7?

http://stackoverflow.com/comment/39238504
has text: @game That is still a constant expression where the result is guaranteed to fit in a char.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25196844
type: Comment

http://stackoverflow.com/comment/39080803
type: AnswerComment
has text: `ImportResources` usually red upto `src/main/resources` putting /makes it a directory to search its content
type: Comment
comment on: http://stackoverflow.com/a/25111825
score: 0

http://stackoverflow.com/q/25089264
tagged with: nightly-build
accepted answer: http://stackoverflow.com/a/25089353
answer count: 1
has body: I have a Java application hosted in SourceForge (SVN) Basically I'm looking for a tool that generate nightly builds based on this: When a new commit was applied, the tool will auto generate a new build I did search for few tools but I didn't find what I'm looking for
score: 0
has answer: http://stackoverflow.com/a/25089353
has comment: http://stackoverflow.com/comment/39038794
type: Question
type: AnsweredQuestion
tagged with: svn
tagged with: java
has title: Nightly build generator for Java project

http://stackoverflow.com/q/25218780
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39282906
tagged with: terminal
accepted answer: http://stackoverflow.com/a/25222421
type: AnsweredQuestion
has body: I am trying to use deck2pdf which is a java program to make pdf out of javascript slides presentation. I followed the installation process from github: cloned the repo made ./gradlew distZip which generated a .zip file in build/distributions/ unizpped this file deck2pdf-0.2-SNAPSHOT.zip in my JS project folder this folder has the following content: - deck2pdf-0.2-SNAPSHOT - bin - deck2pdf - deck2pdf.bat - lib - deck2pdf-0.2-SNAPSHOT.jar - groovy-2.3.2.jar - itextpdf-5.5.1.jar - jfxrt.jar then, I call deck2pdf in the terminal from my project folder, but it says : command not found what am I doing wrong?
has title: java command not found in terminal
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/39282758
downvote count: 1
has comment: http://stackoverflow.com/comment/39289124
type: Question
has answer: http://stackoverflow.com/a/25222421
score: 0

http://stackoverflow.com/q/25099500
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39060462
answer count: 2
linked to: http://stackoverflow.com/q/631598
has answer: http://stackoverflow.com/a/33006126
tagged with: mockito
has comment: http://stackoverflow.com/comment/39064097
downvote count: 0
has comment: http://stackoverflow.com/comment/67579013
tagged with: callback
has title: Java unit testing - how to unit test an async method (uses callback) with mockito answer
has answer: http://stackoverflow.com/a/25101920
upvote count: 6
favorite count: 0
type: UnansweredQuestion
score: 6
has body: I have the following method in the class Logic public class Logic implements ILogic { @Override public void doSomethingInterestingAsync(final int number, final ICallback callback){ new Thread(new Runnable() { @Override public void run() { callback.response(number+1); } }).start(); } } and I usually call it using ILogic.doSomethingInterestingAsync(1, new ICallback() { @Override public void response(int number) { System.out.println(String.format("response - %s", number)); } }); Now I want to unit test it. So I figured one solution is with CountDownLatch (found in other SO thread) As Follows: @Test public void testDoSomethingInterestingAsync_CountDownLatch() throws Exception { final CountDownLatch lock = new CountDownLatch(1); ILogic ILogic = new Logic(); final int testNumber = 1; ILogic.doSomethingInterestingAsync(testNumber, new ICallback() { @Override public void response(int number) { assertEquals(testNumber + 1, number); lock.countDown(); } }); assertEquals(true, lock.await(10000, TimeUnit.MILLISECONDS)); } And it works great. But I have also read that about Answer in Mockito might be a better practice for that, But I couldn't quite follow the examples. How do I write unit tests for methods using call backs using Mockito tools? Thanks.
tagged with: unit-testing
linked to: http://stackoverflow.com/q/13616547

http://stackoverflow.com/a/25121350
has body: Since you are using Spring, thymeleaf has access to the EL provided by Spring. You should therefore be able to use &lt;input type="text" th:maxlength="${T(com.example.MyType).PROJECT_NAME_MAX_LENGTH}" /&gt;
answers question: http://stackoverflow.com/q/25120799
upvote count: 54
accepted answer of: http://stackoverflow.com/q/25120799
type: AcceptedAnswer
downvote count: 0
score: 54
type: Answer

http://stackoverflow.com/q/25214433
has answer: http://stackoverflow.com/a/25214560
has title: Java XML Transformer
accepted answer: http://stackoverflow.com/a/25214560
type: AnsweredQuestion
tagged with: java
downvote count: 2
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/39271669
has comment: http://stackoverflow.com/comment/39271734
has comment: http://stackoverflow.com/comment/39271667
score: -1
tagged with: transformer-model
answer count: 2
has body: I have been trying to create an XML document, but keep getting a Null Pointer Exception error, and I have spent several hours trying to figure out why. The path is correct because it works when reading the file. Main: public static final String PATH = "res/config.xml"; public Main() { } public static void main(String args[]) throws FileNotFoundException { new WriteConfig(PATH); } WriteConfig: import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Document; import org.w3c.dom.Element; public class WriteConfig { Document dom; Element e = null; String name; String gender; String race; String cclass; public WriteConfig(String xml) { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); try { DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); dom = docBuilder.newDocument(); Element mainRootElement = dom.createElement("character"); e = dom.createElement("name"); e.appendChild(dom.createTextNode(name)); mainRootElement.appendChild(e); e = dom.createElement("gender"); e.appendChild(dom.createTextNode(gender)); mainRootElement.appendChild(e); e = dom.createElement("race"); e.appendChild(dom.createTextNode(race)); mainRootElement.appendChild(e); dom.appendChild(mainRootElement); try { Transformer tr = TransformerFactory.newInstance().newTransformer(); tr.setOutputProperty(OutputKeys.INDENT, "yes"); tr.setOutputProperty(OutputKeys.METHOD, "xml"); tr.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); tr.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "res/config.dtd"); tr.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); DOMSource dSource = new DOMSource(dom); Strea…
has comment: http://stackoverflow.com/comment/39271646
possible better answer: http://stackoverflow.com/a/25865628
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/25865628

http://stackoverflow.com/comment/39080618
has text: Also, you can vote to re-open the question. As I've just done.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25100852
score: 0

http://stackoverflow.com/q/25189769
type: UnansweredQuestion
has body: I am facing an outOfMemory exception in below method. Could anyone please help? This graph as 7073455 Nodes and 36549084 relations I am running this program with these parameters: -Xmx3072M -XX:+UseConcMarkSweepGC Code: public Iterable&lt;Node&gt; calculatePa(GraphDatabaseService graphDb) throws Exception { float pa = 0.0f; Transaction tx = graphDb.beginTx(); Iterable&lt;Node&gt; allNodes = getAllTypeNodes(graphDb, TERM_NODE); int counter =0; HashMap&lt;String, String&gt; starNodemap = new HashMap&lt;String, String&gt;(); PrintWriter pw = new PrintWriter(TERM_STAR_NODE_FILE_PATH); Iterable&lt;Relationship&gt; pVRels; Iterable&lt;Relationship&gt; removeRels; Iterable&lt;Relationship&gt; pVRels2; Node termNode; Iterator&lt;Node&gt; termItr = allNodes.iterator(); while(termItr.hasNext()){ termNode = termItr.next(); int sumPV = 0,starNodeCounter = 0; pVRels = termNode.getRelationships( Direction.OUTGOING, RelTypes.PV); counter++; for (Relationship pvRel : pVRels){ sumPV +=Integer.parseInt(pvRel.getProperty(PV).toString()); starNodeCounter++; } // to stop executing the rest of the code for this node if(starNodeCounter &gt; STAR_NODE_TERM_THRESHOLD){ if(isDebug){ pw.println(termNode.getProperty(TERM).toString()+ PIPE +String.valueOf(starNodeCounter)); pw.flush(); } removeRels = termNode.getRelationships(RelTypes.PV, Direction.OUTGOING ); for (Relationship r : removeRels){ r.delete(); } termNode.delete(); continue; } termNode.setProperty(SUM, sumPV); pVRels2 = termNode.getRelationships( Direction.OUTGOING, RelTypes.PV); for (Relationship pvRel : pVRels2 ){ pa = Integer.parseInt(pvRel.getProperty(PV).toString())/(float)sumPV; pvRel.setProperty(Pa, pa); } if(counter == COMMIT_SIZE){ LOGGER.info("Calculated Pa for :::"+counter+"::: at ::"+(new Date())); LOGGER.info(Runtime.getRuntime().freeMemory()/(1024*1024)+"::: is the free memory before"); tx.success(); tx.close(); tx = graphDb.beginTx(); LOGGER.info(Runtime.getRuntime().freeMemory()/(1024*1024)+"::: is the free memory af…
tagged with: java
has title: memory issue while using neo4j embedded
type: Question
tagged with: graph
has comment: http://stackoverflow.com/comment/39229031
score: 0
answer count: 1
tagged with: neo4j
has answer: http://stackoverflow.com/a/25191714

http://stackoverflow.com/a/34211611
answers question: http://stackoverflow.com/q/25198726
type: Answer
has body: I share my 100% solution using Java 8. public class TapeEquilibrium { public int tapeEquilibrium(int[] A) { final int N = A.length; long minimalSum = (int) A[0]; int[] rightSide = Arrays.copyOfRange(A, 1, N); long maximalSum = IntStream.of(rightSide).sum(); int minimalDifference = (int) Math.abs(maximalSum - minimalSum); for (int i = 1; i &lt; N; i++) { int difference = (int) Math.abs(maximalSum - minimalSum); minimalDifference = difference &lt; minimalDifference ? difference : minimalDifference; minimalSum += A[i]; maximalSum -= A[i]; } return minimalDifference; } }
score: 0

executable-jar
tags question: http://stackoverflow.com/q/25190921
tags question: http://stackoverflow.com/q/25209013
tags question: http://stackoverflow.com/q/25104913
tag name: executable-jar
type: Tag
tags question: http://stackoverflow.com/q/25214669
tags question: http://stackoverflow.com/q/25078174
tags question: http://stackoverflow.com/q/25216780
tags question: http://stackoverflow.com/q/25081479

eclipselink
tags question: http://stackoverflow.com/q/25086115
tags question: http://stackoverflow.com/q/25206325
type: Tag
tags question: http://stackoverflow.com/q/25178080
tags question: http://stackoverflow.com/q/25142607
tags question: http://stackoverflow.com/q/25119957
tags question: http://stackoverflow.com/q/25070055
tag name: eclipselink

http://stackoverflow.com/a/25177180
has body: It sounds like a test for palindrome, which is "is the reverse the same as the original?". For that you do not need to reverse the string, so you only have one argument: public static boolean isPalindrome(String str) { int len = str.length(); int max = len/2; for(int i=0; i &lt; max; i++) if(str.charAt(i) != str.charAt(len - i - 1)) return false; return true; } The key bit to note is you do not need to compare anymore than half of the string (rounded down).
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25176880

http://stackoverflow.com/comment/39093159
type: AnswerComment
has text: @mKorbel OP is not interested in the actual value of the Field. As per the code OP just want to know about the Field Type.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25117492

http://stackoverflow.com/a/25092553
has comment: http://stackoverflow.com/comment/39044699
has body: Extract the files from poi-bin-3.10-FINAL-20140208.tar.gz. Then you will will have two directories lib and ooxml-lib containing jar files. Add the jar files you need to eclipse... There are also jar files above the lib directory. You will need some of these as well.
type: Answer
has comment: http://stackoverflow.com/comment/39045038
answers question: http://stackoverflow.com/q/25092460
has comment: http://stackoverflow.com/comment/39044913
score: 0
has comment: http://stackoverflow.com/comment/39044941

http://stackoverflow.com/comment/39056201
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25098788
has text: "The year 3"? Who are your VIPs?
score: 0

http://stackoverflow.com/comment/39072135
comment on: http://stackoverflow.com/a/25107394
score: 2
has text: Just a reminder that when you close the textReader you probably want to do that in either a finally block or using try-with resources in Java 7 to clean up the resource properly in the case of an exception.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25073242
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/25073124
type: Answer
has body: Another reason could be the cache missing. Cache misses bring a ~250% penalty , when CPU needs to refresh it's cache (that means the variable you are trying to access isn't in the CPU cache is in RAM). Looking at the results of your test, it seems to be a cache miss problem : Your local variables (mLocal and i ) are accessed in every cycle, but they are close to one another in memory since they were added to the stack recently. mPublic and mStatic aren't within the same page of memory as "i". So your for loop should switch memory pages between the page where "i" with the page where mPublic / mStatic is . Ofc you cannot know how memory actually gets mapped, so this is just a guess. If you are at it, could you do another experiment ? Declare a static integer next to the static mStatic variable and use that integer in the loop. Is performance improving ?
score: 2

http://stackoverflow.com/q/25112761
linked to: http://stackoverflow.com/q/12518618
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25113992
tagged with: jackson
has comment: http://stackoverflow.com/comment/39082425
score: 0
has title: Read JsonNode into a pre-existed POJO
has body: currently I'm doing this to convert JsonNode to a POJO: try { MyClass obj = mapper.treeToValue(jsonData, MyClass.class))); /* consume obj */ } catch (JsonProcessingException ex) { return false; } But sometimes I don't want to get a new instance of MyClass. I have have populated it before and now I just want to set new values for some fields and keep old values for unchanged fields. What I want is something like this: mapper.readJsonNodeToPOJO(jsonData, obj))); Is it possible to do this?
has answer: http://stackoverflow.com/a/25113036
has comment: http://stackoverflow.com/comment/39082365
possible better answer: http://stackoverflow.com/a/25113036
has answer: http://stackoverflow.com/a/25113992
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/39198457
has text: thank you very much! it just worked, yes, as you said I was closing the sc inside the method, I tought id would close the system.in just inside it, but it closes all the program input stream, got it! :)
comment on: http://stackoverflow.com/q/25175249
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25194789
has comment: http://stackoverflow.com/comment/39234651
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39234681
type: Answer
answers question: http://stackoverflow.com/q/25194609
accepted answer of: http://stackoverflow.com/q/25194609
has body: Start by taking a look at How to Make Dialogs... What you basically want is to use JOptionPane.showInputDialog, which can be used to prompt the use for input... Yes, there are a few flavours, but lets keep it simply and look at JOptionPane.showInputDialog(Object) The JavaDocs tells us that... message - the Object to display Returns: user's input, or null meaning the user canceled the input So, from that we could use something like... String value = JOptionPane.showInputDialog("What is your name?"); if (value != null) { System.out.println("Hello " + value); } else { System.out.println("Hello no name"); } Which displays... Now, if we take a look at your code, you could replace the use of scan with... public static String getInput(String inputType) { String input = JOptionPane.showInputDialog("Enter the " + inputType + ": "); return input; } As an example... Now, what I might recommend is creating a simple helper method which can be used to prompt the user in a single line of code, for example... public class InputHelper { public static String promptUser(String prompt) { String input = JOptionPane.showInputDialog(prompt); return input; } } which might be used something like... String value = InputHelper.promptUser("Please enter the hours worked"); hours_ = Double.parse(value); And this is where it get's messy, as you will now need to valid the input of the user. You could extend the idea of the InputHelper to do automatic conversions and re-prompt the user if the value was invalid...as an idea
has comment: http://stackoverflow.com/comment/39234674
score: 2
has comment: http://stackoverflow.com/comment/39234587
upvote count: 2
has comment: http://stackoverflow.com/comment/39234664

http://stackoverflow.com/comment/39185086
comment on: http://stackoverflow.com/q/25168024
type: Comment
has text: Does your `item.getItemId()` value match any of those cases?
type: QuestionComment
score: 0

http://stackoverflow.com/a/25187298
downvote count: 0
type: Answer
score: 25
upvote count: 25
has body: The diets object in your json is not a List. Its a List of key-value pair with key "diet" and value a diet object. So you have three options here. One is to create a wrapper object say DietWrapper and use List of diet wrapper in User like @JsonRootName(value = "user") class User { @JsonProperty(value = "id") private long id; @JsonProperty(value = "diets") private List&lt;DietWrapper&gt; diets; //Getter &amp; Setters } class DietWrapper { @JsonProperty(value = "diet") Diet diet; } Second option is to keep diest as simple list of maps like List> @JsonRootName(value = "user") class User { @JsonProperty(value = "id") private long id; @JsonProperty(value = "diets") private List&lt;Map&lt;String, Diet&gt;&gt; diets; //Getter &amp; Setters } Third option is to use a custom deserializer which would ignore your diet class. @JsonRootName(value = "user") class User { @JsonProperty(value = "id") private long id; @JsonProperty(value = "diets") @JsonDeserialize(using = DietDeserializer.class) private List&lt;Diet&gt; diets; //Getter &amp; Setters } class DietDeserializer extends JsonDeserializer&lt;List&lt;Diet&gt;&gt; { @Override public List&lt;Diet&gt; deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readTree(jsonParser); List&lt;Diet&gt; diets = mapper.convertValue(node.findValues("diet"), new TypeReference&lt;List&lt;Diet&gt;&gt;() {}); return diets; } }
accepted answer of: http://stackoverflow.com/q/25185545
answers question: http://stackoverflow.com/q/25185545
type: AcceptedAnswer

web-services
type: Tag
tags question: http://stackoverflow.com/q/25106332
tags question: http://stackoverflow.com/q/25083045
tags question: http://stackoverflow.com/q/25123900
tags question: http://stackoverflow.com/q/25166259
tags question: http://stackoverflow.com/q/25140012
tags question: http://stackoverflow.com/q/25209260
tags question: http://stackoverflow.com/q/25188925
tags question: http://stackoverflow.com/q/25187052
tags question: http://stackoverflow.com/q/25118165
tags question: http://stackoverflow.com/q/25180650
tags question: http://stackoverflow.com/q/25168078
tags question: http://stackoverflow.com/q/25073019
tags question: http://stackoverflow.com/q/25178347
tags question: http://stackoverflow.com/q/25140561
tags question: http://stackoverflow.com/q/25073503
tags question: http://stackoverflow.com/q/25177491
tags question: http://stackoverflow.com/q/25111154
tags question: http://stackoverflow.com/q/25152571
tags question: http://stackoverflow.com/q/25081172
tags question: http://stackoverflow.com/q/25126256
tags question: http://stackoverflow.com/q/25087071
tags question: http://stackoverflow.com/q/25113978
tags question: http://stackoverflow.com/q/25120337
tags question: http://stackoverflow.com/q/25138394
tags question: http://stackoverflow.com/q/25190801
tags question: http://stackoverflow.com/q/25127339
tags question: http://stackoverflow.com/q/25184977
tags question: http://stackoverflow.com/q/25180615
tags question: http://stackoverflow.com/q/25126593
tags question: http://stackoverflow.com/q/25204794
tags question: http://stackoverflow.com/q/25202211
tags question: http://stackoverflow.com/q/25199485
tags question: http://stackoverflow.com/q/25170036
tags question: http://stackoverflow.com/q/25196179
tags question: http://stackoverflow.com/q/25096744
tags question: http://stackoverflow.com/q/25144284
tags question: http://stackoverflow.com/q/25161813
tags question: http://stackoverflow.com/q/25083812
tags question: http://stackoverflow.com/q/25211552
tag name: web-services
tags question: http://stackoverflow.com/q/25164515
tags question: http://stackoverflow.com/q/25214921
tags question: http://stackoverflow.com/q/25165062
tags question: http://stackoverflow.com/q/25201664
tags question: http://stackoverflow.com/q/25155031
tags question: http://stackoverflow.com/q/25196427
tags question: http://stackoverflow.com/q/25185115
tags question: http://stackoverflow.com/q/25229988
tags question: http://stackoverflow.com/q/25075134
tags question: http://stackoverflow.com/q/25143592
tags question: http://stackoverflow.com/q/25189131

http://stackoverflow.com/a/25120369
type: Answer
answers question: http://stackoverflow.com/q/25120061
has body: Sixty button in single layout is not a good design pattern, you must use either grid or List view. Using List View http://developer.android.com/design/building-blocks/lists.html Using Grid View http://developer.android.com/guide/topics/ui/layout/gridview.html As far as the current problem is concerned You can create a generalized Function as given below public boolean startActivityFoo(String value1,String value2,String value3) { Intent myIntent = new Intent(this, NewActivityClassName.class); myIntent.putExtra("soundfile",value1); myIntent.putExtra("image",value2); myIntent.putExtra("text",value3); startActivity(myIntent); }
score: 0

http://stackoverflow.com/q/25229597
answer count: 1
tagged with: insert
type: UnansweredQuestion
tagged with: auto-increment
has title: How to Insert auto increment primary key into database table
tagged with: primary-key
has answer: http://stackoverflow.com/a/25248165
has comment: http://stackoverflow.com/comment/39301332
type: Question
has comment: http://stackoverflow.com/comment/39335421
tagged with: java
has comment: http://stackoverflow.com/comment/39352364
has comment: http://stackoverflow.com/comment/39338702
has body: I have am inserting CSV file that is chosen using a JFileChooser.I get an error when importing, It display that the primary key IS NULL. It is auto-increment(I used and SQL command). What's strange is that the exact same insert code is working for a different table in the same database. Here's the code I have so far: JAVA CODE int returnVal = fileChooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); try { Scanner sin = new Scanner(new FileReader(new File(file.getName()))); while (sin.hasNext()) { String[] line = sin.nextLine().split(","); String name = line[0]; String surname = line[1]; int age = Integer.parseInt(line[2]); String gender = line[3]; String shoeSize = line[4]; Studentstbl st = new Studentstbl(); st.setAge(age); st.setDonationStatus("N"); st.setFirstName(name); st.setGender(gender); st.setShoeSize(shoeSize); st.setSurname(surname); yritpatPUEntityManager.getTransaction().begin(); yritpatPUEntityManager.persist(st); yritpatPUEntityManager.getTransaction().commit(); studentstblList.clear(); studentstblList.addAll(studentstblQuery.getResultList()); } } catch (IOException ex) { JOptionPane.showMessageDialog(jPanel1, "A problem occured when accessing the file "+file.getAbsolutePath(), "Error", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(jPanel1, "Cancelled by user", "Error", JOptionPane.ERROR_MESSAGE); } SQL create table studentstbl ( student_id int not null primary key GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), school_id int not null, first_name varchar(60) not null, surname varchar(60) not null, age int not null, gender varchar(1) not null, shoe_size int not null, donation_status varchar(1) not null) And ALTER TABLE STUDENTSTBL ADD CONSTRAINT SCHOOL_ID FOREIGN KEY (SCHOOL_ID) REFERENCES SCHOOLSTBL (SCHOOL_ID) CSV aname,asname,2,M,1 bname,bsname,3,F,1 cname,csname,4,F,2 dname,dsname,5,F,3 ename,esname,7,M,3 fname,fsname,6,M,3 gname,gsname,8,F,4 hnam…
score: 0
tagged with: sql

http://stackoverflow.com/q/25210780
answer count: 1
accepted answer: http://stackoverflow.com/a/25211059
favorite count: 0
has body: I am trying to use JSoup to select some text from an HTML document. The HTML I'm interested in is a part of a form: &lt;input type="text" name="key_12345" value="fizz" id="varz_key_12345" class="inline-edit-field"&gt; &lt;input type="text" name="key_28382" value="buzz" id="varz_key_28382" class="inline-edit-field"&gt; &lt;input type="text" name="key_83838" value="foo" id="varz_key_83838" class="inline-edit-field"&gt; &lt;input type="text" name="key_98383" value="bar" id="doekfeokf" class="inline-edit-field"&gt; &lt;input type="text" name="key_19283" value="widget" id="vars_key_19283" class="inline-edit-field"&gt; ...etc. I'm interested in obtaining any &lt;input&gt; element whose id attribute begins with varz_key_. Hence in the example above, I'd be interested in all the inputs except the 4th because its ID doesn't start with varz_key_. The best I've been able to come up with is: Document doc = Jsoup.parse(getHtml()); Elements planVarInputs = doc.select("input[id^=\"varz_key_\"]"); log.info("planVarInputs's size is ${planVarInputs.size()}"); for(Element input : planVarInputs) { System.out.println(input.ownText()); } But this gives me the following output: planVarInputs's size is 0 Any ideas?
has answer: http://stackoverflow.com/a/25211059
downvote count: 0
has title: Jsoup selectors with wildcards
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: jsoup
tagged with: css-selectors
upvote count: 1

http://stackoverflow.com/q/25089347
has title: Eclipse Android Project Java Buid Issue
has answer: http://stackoverflow.com/a/25317689
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25317689
score: 1
upvote count: 1
type: Question
has body: Just installed Eclipse Luna on a new computer with Ubuntu 14.10. Copied my workspace over. My projects will not build. The Console continues to show "Java Problem." For example one of the 500ish errors with Java Problem: Animator cannot be resolved to a type DefaultClusterRenderer.java /library/src/com/google/maps/android/clustering/view line 882 Java Problem And it says the same "Java Problem" for about 500 more lines. I have: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java as my java path and I also have a copy of the JRE folder with contents within the eclipse folder. What am I leaving out? My projects were building fine on my old computer.
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/39002008
score: 2
has text: no, it's not possible
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25069671

http://stackoverflow.com/q/25178318
tagged with: replace
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25178401
has comment: http://stackoverflow.com/comment/39203638
has answer: http://stackoverflow.com/a/25178460
has comment: http://stackoverflow.com/comment/39203487
tagged with: regex
has comment: http://stackoverflow.com/comment/39203609
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25178460
has body: "aaaa bbbb dddd ffff ".replace("\\t\\t", "\\tx\\t"); I want to insert an 'x' in between two consecutive tabs. I think i got the Java Regex pattern wrong. Could someone tell me whats wrong? The output should be: "aaaa bbbb x dddd x ffff x "
type: Question
has title: Java Replace Regex - replace consecutive tabs
has answer: http://stackoverflow.com/a/25178401

http://stackoverflow.com/comment/39016195
score: 0
type: Comment
type: QuestionComment
has text: I'm not sure if I could pull out a small enough region of code to use as an example. I'll try to run it under a profiler and see what's going on. I'm just surprised because as a C programmer, I know that if I spawn three threads, there are going to be at most three CPUs being used. I assume that the other CPU load is some background work the JVM is doing, but I'm not sure what.
comment on: http://stackoverflow.com/q/25076155

http://stackoverflow.com/a/25222812
has comment: http://stackoverflow.com/comment/39292029
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25222044
downvote count: 0
has body: If you want to use mixed access mode (i.e. use annotations on fields for some properties and on getters for others) you have to take a few extra steps. First, set the default access type for the entity. For example, this will set the default access type to FIELD: @Entity @Access(AccessType.FIELD) public class MyEntity { … } Then for the properties that you want to annotate on the getters, explicitly set the access type to PROPERTY: @Access(AccessType.PROPERTY) @Column(length=25) public String getFirstName() { return firstName; }
has comment: http://stackoverflow.com/comment/39290874
type: Answer

http://stackoverflow.com/comment/39152228
score: 1
has text: what if you use a Map instead? Then your search would be way faster
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25150263

http://stackoverflow.com/a/25126035
accepted answer of: http://stackoverflow.com/q/25125132
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25125132
has comment: http://stackoverflow.com/comment/39146458
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39114189
downvote count: 0
has body: I added a couple of debugging lines to your if statement at the bottom: if (m % 2 == 0) { result = m_pow(n, m / 2); System.out.println("m = " + m + ", result = " + result + ", returning " + ((result * result) % mod)); return ((result * result) % mod); } else { result = m_pow(n, (m - 1) / 2); System.out.println("m = " + m + ", n % mod = " + (n % mod) + ", result = " + result + ", returning " + (((n % mod) * (result * result)) % mod)); return (((n % mod) * (result * result)) % mod); } When I ran this with the value 13, this was the last line printed out: m = 1000000005, n % mod = 13, result = 846153852, returning -428497853 Now 846153852 &times; 846153852 &times; 13 > 263, so your code is overflowing the range of a Java long. mod is 109 + 7, and if result is between 0 and mod, then result * result won't be much more than 1018, certainly less than 1.1 &times; 1018. The maximum positive value a long can hold is about 9.2 &times; 1018, so once n creeps above about 9, there is the chance that result * result * n will exceed this value. As far as I can see, this first happens with n = 13. The product of two numbers modulo mod will never exceed the range of a Java long, but the product of three or more numbers might do. One way to fix this is by replacing the line return (((n % mod) * (result * result)) % mod); with return (((n % mod) * ((result * result) % mod) % mod);

http://stackoverflow.com/a/25150753
type: Answer
answers question: http://stackoverflow.com/q/25150646
has comment: http://stackoverflow.com/comment/39153502
has body: this.add(page) should be this.add(panel)
has comment: http://stackoverflow.com/comment/39153447
score: 0
has comment: http://stackoverflow.com/comment/39153069
has comment: http://stackoverflow.com/comment/39153426

http://stackoverflow.com/comment/39155065
type: QuestionComment
comment on: http://stackoverflow.com/q/25151509
has text: Check this post to get clarity of PipedInputSteam[http://stackoverflow.com/questions/3395714/use-cases-of-pipedinputstream-and-pipedoutputstream?lq=1]
score: 0
type: Comment

http://stackoverflow.com/q/25081611
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/25083308
accepted answer: http://stackoverflow.com/a/25083308
favorite count: 0
has answer: http://stackoverflow.com/a/25091375
has body: I have two entities: parent : public class UserGroup{ @OneToMany(fetch = FetchType.EAGER, mappedBy = "userGroup", cascade = CascadeType.ALL) private List&lt;User&gt; users; } and child: public class User{ @ManyToOne(fetch = FetchType.EAGER) @Fetch(FetchMode.SELECT) @JoinColumn(name = "user_group_id") private UserGroup userGroup; } when i am trying to save UserGroup with one User in list of users, with this method: @Transactional public E save(E e) { em.persist(e); em.flush(); em.refresh(e); return e; } my parent and child is getting saved, but user_group_id in child object is null. Is there any solution?
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39026674
has answer: http://stackoverflow.com/a/47567136
has comment: http://stackoverflow.com/comment/39025821
type: Question
possible better answer: http://stackoverflow.com/a/25091375
has title: Hibernate JPA persist saved child entity with null parent id
answer count: 3
has comment: http://stackoverflow.com/comment/39026853

http://stackoverflow.com/comment/39118081
type: QuestionComment
score: 0
has text: I'm sure it's being called the Log printed something which means it's being called, I'm not sure what else to show
comment on: http://stackoverflow.com/q/25131978
type: Comment

scala
tags question: http://stackoverflow.com/q/25198778
tags question: http://stackoverflow.com/q/25105546
tags question: http://stackoverflow.com/q/25126238
tags question: http://stackoverflow.com/q/25149833
tags question: http://stackoverflow.com/q/25072356
tags question: http://stackoverflow.com/q/25074954
tags question: http://stackoverflow.com/q/25195028
tags question: http://stackoverflow.com/q/25088475
tags question: http://stackoverflow.com/q/25206633
tags question: http://stackoverflow.com/q/25197322
tags question: http://stackoverflow.com/q/25099446
tags question: http://stackoverflow.com/q/25152580
tags question: http://stackoverflow.com/q/25173966
tags question: http://stackoverflow.com/q/25210180
tags question: http://stackoverflow.com/q/25127021
tags question: http://stackoverflow.com/q/25204332
tags question: http://stackoverflow.com/q/25125882
tags question: http://stackoverflow.com/q/25120893
tags question: http://stackoverflow.com/q/25182948
tags question: http://stackoverflow.com/q/25073336
tag name: scala
tags question: http://stackoverflow.com/q/25129848
tags question: http://stackoverflow.com/q/25221698
tags question: http://stackoverflow.com/q/25094568
tags question: http://stackoverflow.com/q/25154754
tags question: http://stackoverflow.com/q/25135606
tags question: http://stackoverflow.com/q/25211358
type: Tag
tags question: http://stackoverflow.com/q/25168922
tags question: http://stackoverflow.com/q/25204887
tags question: http://stackoverflow.com/q/25107026

http://stackoverflow.com/a/25109299
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25107991
has comment: http://stackoverflow.com/comment/39076815
type: Answer
score: 1
has body: You do not need an activity to access the main thread, a service will work just fine. Now, I do not have your code but I assume you are using an IntentService or similar. This poses a problem since IntentService.onHandleIntent() is activated on a worker thread To solve, either: A. place the Speechrecognizer invocation logic on IntentService.onCreate() which is always called on the main thread, or B. switch to using standard service and place your logic in onStartCommand() method which is, again, guaranteed to be called on the main thread.

http://stackoverflow.com/comment/39069344
type: Comment
type: QuestionComment
has text: Depends on what `thread.setRunning(false)` does. If it signals the game loop thread to exit the game loop and finish then that should work. Try adding `thread.setRunning(false)` before the code you had there before (beginning of `surfaceDestroyed`) and see if that works. Let the main thread print a log message after it has joined the game loop thread (at end of `surfaceDestroyed` after loop). If it prints then you can be sure that the game loop thread has exited and that the main loop has exited the loop (i.e. it's not stuck).
comment on: http://stackoverflow.com/q/25102836
score: 0

http://stackoverflow.com/comment/39182202
has text: Well, I hate to suggest this, but you could cast the CSV into JSON as `{"hi":1, "ho":"hello"}`, then use Jackson to init your class.
type: Comment
comment on: http://stackoverflow.com/q/25166233
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39371831
comment on: http://stackoverflow.com/q/25103191
type: QuestionComment
has text: i know its answered but just adding --- String tuition1 = "0", scholar1 = "0";
score: 0
type: Comment

http://stackoverflow.com/q/25126884
type: Question
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/15847025
has title: .jcall error in R: cannot determine object class
has comment: http://stackoverflow.com/comment/39108818
tagged with: http://stackoverflow.com/tag/r
answer count: 0
has body: I've been trying to develop R code that is using a function built in Java, but I'm having an error with .jcall. The code built in Java can be found here: Getting incorrect Score using SentiWordNet I've managed to create the .class and the .jar files. From the cmd window, I can check that my function returns an object of type double. The code I'm running in R is the following: .jinit(".") .jaddClassPath("D:\\Users\\cristina.cerqueira\\Documents\\R\\win-library\\3.0\\SWN3\\SWN3.jar") .jaddClassPath("C:\\Program Files\\Java\\jdk1.7.0_55\\lib\\SWN3.jar") .jclassPath() .jinit(".") c &lt;- .jnew("SWN3") jSWR3 &lt;-function(s) { result= .jcall("Ljava/lang/String", returnSig = "D", method=c, as.character(s), evalArray = TRUE, check = TRUE, evalString = TRUE, .jcast( rJava:::.rJava.class.loader,"java/lang/ClassLoader" ) ) } s &lt;- c("love","v") jSWR3(s) The error is the following: Error in .jcall("Ljava/lang/String", returnSig = "D", method = c, as.character(s), : RcallMethod: cannot determine object class Any help is much appreciated!
type: UnansweredQuestion
upvote count: 1
tagged with: rjava
has comment: http://stackoverflow.com/comment/39109010
score: 1
tagged with: java

header
type: Tag
tags question: http://stackoverflow.com/q/25104930
tag name: header

http://stackoverflow.com/comment/39246018
type: Comment
type: QuestionComment
has text: I just thought it would be nice to use those classes.
score: 0
comment on: http://stackoverflow.com/q/25198755

http://stackoverflow.com/a/25222440
has body: for (int i = 0; i &lt; 6; i++) { for (int k = 0; k &lt; 16; k++) { if (k &lt; 10) { symbols.add("\u30" + (char) (i + 65) + k); } else { symbols.add("\u30" + (char) (i + 65) + (char) (k - 10 + 65)); } } } To create a Unicode character whose value is computed by your program, all you really need to do is compute the code point and then cast it to a (char), as long as it's in the range 0 to FFFF. (Code points U+10000 and higher will need something different, I think new String(new int[]{codePoint}, 0, 1).) In your example, you're trying to compute 0x3000 + [16 times some letter value A-F] + [some digit or letter value], so for (int i = 0; i &lt; 6; i++) { for (int k = 0; k &lt; 16; k++) { char charValue = (char) (0x3000 + ((10 + i) &lt;&lt; 4) + k); symbols.add(Character.toString(charValue)); } } (10 + i) &lt;&lt; 4 gives you 00a0, 00b0, ..., which I think is what you want. P.S. You don't even need a double loop. Just one integer variable that goes from 0x00a0 to 0x00ff will give you what I think you need.
upvote count: 1
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25221596

http://stackoverflow.com/a/25143069
has comment: http://stackoverflow.com/comment/39138598
has comment: http://stackoverflow.com/comment/39138471
has comment: http://stackoverflow.com/comment/39138396
type: Answer
has comment: http://stackoverflow.com/comment/39140356
has body: You can just do it like the following /&lt;post author="(.*?)"/ Working Demo The comments are correct though with Regex not being the best tool to parse HTML. But this should do what you are looking for
score: 0
answers question: http://stackoverflow.com/q/25142957
has comment: http://stackoverflow.com/comment/39140490

http://stackoverflow.com/comment/39081271
comment on: http://stackoverflow.com/a/25111906
score: 0
type: AnswerComment
has text: @user3827788 This [link1](http://stackoverflow.com/questions/1917773/dynamic-listview-in-android-app?lq=1) and [link2](http://stackoverflow.com/questions/5070830/populating-a-listview-using-arraylist) will help you to use `ListView`
type: Comment

java-package
tags question: http://stackoverflow.com/q/25212511
tag name: java-package
type: Tag

http://stackoverflow.com/q/25111867
answer count: 2
has answer: http://stackoverflow.com/a/25111932
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25111906
possible better answer: http://stackoverflow.com/a/25111932
tagged with: android
linked to: http://stackoverflow.com/q/5070830
tagged with: android-activity
linked to: http://stackoverflow.com/q/1917773
tagged with: parse-platform
has body: I have tried to solve this error, and even with research, my attempts have been unsuccessful. In particular, I am receiving the following error: Cannot instantiate the type List Below is the code: public class MatchingActivity extends Activity { protected ParseRelation&lt;ParseUser&gt; mFriendsRelation; protected ParseUser mCurrentUser; protected List&lt;ParseUser&gt; mUsers; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.matching); // Show the Up button in the action bar. //create list variable mUsers = new List&lt;ParseUser&gt;(); } @Override protected void onResume() { super.onResume(); mCurrentUser = ParseUser.getCurrentUser(); setProgressBarIndeterminateVisibility(true); ParseQuery&lt;ParseUser&gt; query = ParseUser.getQuery(); query.findInBackground(new FindCallback&lt;ParseUser&gt;() { public void done(List&lt;ParseUser&gt; users, ParseException e) { if (e == null) { //add all the users to your list variable mUsers.addAll(users); } else { // Something went wrong. } } }); //check the size of your list to see how big it is before accessing it final int size = mUsers.size(); //or use a loop to loop through each one for(ParseUser mParseUser : mUsers) { //skip over the current user if(mParseUser == ParseUser.getCurrentUser()) continue; mParseUser.getString("name"); mParseUser.getNumber("age"); mParseUser.getString("headline"); } } } Any help would be greatly appreciated. Thanks in advance Update public class MatchingActivity extends Activity { protected ParseRelation&lt;ParseUser&gt; mFriendsRelation; protected ParseUser mCurrentUser; protected List&lt;ParseUser&gt; mUsers; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.matching); // Show the Up button in the action bar. //create list variable m…
upvote count: 1
type: AnsweredQuestion
tagged with: android-layout
has title: Cannot instantiate the type
has answer: http://stackoverflow.com/a/25111906
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/7960149

http://stackoverflow.com/q/25086764
type: Question
tagged with: eclipse
score: 0
has title: Maven build failed
has comment: http://stackoverflow.com/comment/39034183
answer count: 1
type: UnansweredQuestion
tagged with: maven
has body: I am trying to import a current maven project and the build fails throwing this error. Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:80 [repo.maven.apache.org/23.235.46.209] failed: Connection timed out: connect -&gt; [Help 1]
tagged with: java
has answer: http://stackoverflow.com/a/25087089

http://stackoverflow.com/comment/39222257
score: 0
has text: Also, are you sure this code correctly generates all permutations of the input string? I might try to use something like the Steinhaus-Johnson-Trotter algorithm implemented here: http://stackoverflow.com/a/11916946/2514228
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25188249

http://stackoverflow.com/q/25124933
score: 1
tagged with: tcp
tagged with: java
type: Question
has body: While SocketIn/OutputStreams in Java seem stream based to an API user, TCP packets are packet based. One can write only one byte or an array of bytes. But one could also write more bytes than a TCP packet could carry. So how does Java form TCP packets from the write methods? Creates calling write(singleByte) 4 times 4 TCP packets? Or does java join the bytes together? Does java join and split bytes to form the TCP packets?
tagged with: network-programming
has comment: http://stackoverflow.com/comment/39105644
has comment: http://stackoverflow.com/comment/39105116
has title: How does Java form TCP packets from byte arrays?
upvote count: 2
accepted answer: http://stackoverflow.com/a/25125944
answer count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/1803215
favorite count: 0
has answer: http://stackoverflow.com/a/25125944
tagged with: packet
tagged with: sockets
has comment: http://stackoverflow.com/comment/39106363
type: AnsweredQuestion

http://stackoverflow.com/q/25095261
type: Question
tagged with: imap
score: 0
tagged with: jakarta-mail
answer count: 1
tagged with: email
has body: I am trying to read javamail inbox and perform search. For this, I am fetching the latest 100 messages and then I am iterating through each to see if they have the sender for whom I am searching for. If its matching, I get its content via getContent(). Here is my javamail code snippet: try { Properties properties = new Properties(); properties.setProperty("mail.store.protocol", "imap"); properties.put("mail.imaps.starttls.enable", "true"); properties.put("mail.imap.socketFactory.port", "587"); System.setProperty("javax.net.debug", "ssl"); System.out.println("prop " + properties.getProperty("mail.smtp.port")); Session session = Session.getDefaultInstance(properties, null); // session.setDebug(true); Store store = null; store = session.getStore("imaps"); store.connect("imap.gmail.com", username, password); Folder inbox; inbox = store.getFolder("Inbox"); /* Others GMail folders : * [Gmail]/All Mail This folder contains all of your Gmail messages. * [Gmail]/Drafts Your drafts. * [Gmail]/Sent Mail Messages you sent to other people. * [Gmail]/Spam Messages marked as spam. * [Gmail]/Starred Starred messages. * [Gmail]/Trash Messages deleted from Gmail. */ inbox.open(Folder.READ_WRITE); Message msgs[] = inbox.getMessages(inbox.getMessageCount() - lastHistory, inbox.getMessageCount()); System.out.println("MSgs.length " + msgs.length); ArrayList&lt;Message&gt; aList = new ArrayList&lt;Message&gt;(); appendTextToConsole("Searching for appropriate messages!!"); for (int ii = msgs.length - 1; ii &gt;= 0; ii--) { Message msg = msgs[ii]; Address[] in = msg.getFrom(); String sender = InternetAddress.toString(in); System.out.println((++index) + "Sender: " + sender); boolean read = msg.isSet(Flags.Flag.SEEN); if (sender.contains(googleId) &amp;&amp; !read) { //This line below gives FolderClosedException sporadically Object content = msg.getContent(); if (content instanceof Multipart) { Multipart mp = (Multipart) content; for (int i = 0; i &lt; mp.getCount(); i++) { BodyPart bp = mp.g…
has title: Sporadically getting javax.mail.FolderClosedException while reading gmail emails using javamail
has comment: http://stackoverflow.com/comment/39060725
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25100009
tagged with: gmail
tagged with: java

http://stackoverflow.com/q/25138623
has comment: http://stackoverflow.com/comment/39130223
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/39130429
tagged with: eclipse-plugin
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25138765
has title: Eclipse plugin installation from Project File
tagged with: installation
downvote count: 0
has body: I want to install eclipse plugin Agilereview from following link: https://github.com/AgileReview-Project/AgileReview-EclipsePlugin I downloaded the zip and unzipped it. I added it in eclipse as project and many projects added into workspace. When I tried to select all those projects and export them as deploy-able plugins in eclipse repository, eclipse doesn't allow it and always show error like plugin file missing. A problem is the zip file include many folders and many of those folder has its own plugin.xml file. Therefore, I think this Agilereview plugin itself is a combination of many plugins. I am sure that plugin is okay and its my mistake to install it. Can anyone tell me, what is the mistake I am doing while installation? I want to install this plugin manually since later I need to optimize it.
score: 1
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/25139161

http://stackoverflow.com/a/25178790
type: Answer
score: 0
has body: i used POST method only... and i got error because of misunderstanding the servlet name.. out.write("Download "+fileItem.getName()+"");and that's all(before i included package name also). So now i cleared with space in my file path+ file name did not cause any error. Thanks Peter and vivek.
answers question: http://stackoverflow.com/q/25161073

http://stackoverflow.com/q/25077543
score: 4
tagged with: guava
tagged with: java
has comment: http://stackoverflow.com/comment/39016251
tagged with: collections
type: Question
has title: Java collection supporting: duplicate values, fast add, fast remove, fast min value?
has answer: http://stackoverflow.com/a/25078003
has comment: http://stackoverflow.com/comment/39016805
tagged with: data-structures
has comment: http://stackoverflow.com/comment/39016519
upvote count: 4
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/504103
has comment: http://stackoverflow.com/comment/39017923
favorite count: 0
has comment: http://stackoverflow.com/comment/39074909
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39072904
has body: Question: does anybody know of a Java implementation (I have too little time/knowledge to develop my own right now) of a collection with the following characteristics? fast add fast random-access remove fast minimum value duplicates Condensed (oversimplified) version of use case is: I have a class that keeps track of 'time', call it TimeClass Events start at monotonically increasing times (times are not unique), but can finish in any order When events start they report their start time to TimeClass When events finish they again report their start time to TimeClass TimeClass adds an event's start time to a collection* when the event starts (fast add) TimeClass removes an event's start time from that collection* when the event finishes (fast random-access remove) TimeClass is capable of reporting the lowest not-yet-finished start time (fast minimum value) * think of collection as: Collection&lt;Time&gt; implements Comparable&lt;Time&gt; Because I'm not sure what the runtime behavior of my system (the system in which TimeClass lives) will be, I've quickly benchmarked the following scenarios using these collections: TreeMultiSet (Guava), MinMaxPriorityQueue (Guava), ArrayList. Note, depending on the collection used, min value is achieved in different ways (remember elements are added in increasing order): TreeMultiSet.firstEntry().getElement(), MinMaxPriorityQueue.peekFirst(), ArrayList.get(0). ADD 1,000,000: TreeMultiSet: 00:00.897 (m:s.ms) List: 00:00.068 (m:s.ms) MinMaxPriorityQueue: 00:00.658 (m:s.ms) ADD 1, REMOVE 1, REPEAT 1,000,000 TIMES: TreeMultiSet: 00:00.673 (m:s.ms) List: 00:00.416 (m:s.ms) MinMaxPriorityQueue: 00:00.469 (m:s.ms) ADD 10,000 IN SEQUENTIAL ORDER, REMOVE ALL IN SEQUENTIAL ORDER: TreeMultiSet: 00:00.068 (m:s.ms) List: 00:00.031 (m:s.ms) MinMaxPriorityQueue: 00:00.048 (m:s.ms) ADD 10,000 IN SEQUENTIAL ORDER, REMOVE ALL IN RANDOM ORDER: TreeMultiSet: 00:00.046 (m:s.ms) List: 00:00.352 (m:s.ms) MinMaxPriorityQueue: 00:00.888 (m:s.ms) Current though…
has comment: http://stackoverflow.com/comment/39016798

http://stackoverflow.com/comment/39031945
has text: @whowantsakookie 13.1 version
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25084066

http://stackoverflow.com/a/25158009
answers question: http://stackoverflow.com/q/25157934
has body: You can traverse the Element's in links with for (Element e : links) { // called for every element, add them to a set if you wish }
score: 0
type: Answer

http://stackoverflow.com/comment/39027923
score: 0
has text: The problem is how to get the session id from http header for https site, for other site it's working
comment on: http://stackoverflow.com/q/25083514
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39079720
type: QuestionComment
type: Comment
has text: `tTextWidth.setBounds(42, 457, 86, 20);` Swing GUIs might have to work on different platforms, using different PLAFs, on different screen sizes and resolutions with different default settings for font size. As such, they are not conducive to exact placement of components. Instead use layout managers, or [combinations of layout managers](http://stackoverflow.com/a/5630271/418556) as well as [layout padding and borders](http://stackoverflow.com/q/17874717/418556) for white space.
score: 0
comment on: http://stackoverflow.com/q/25110588

http://stackoverflow.com/comment/39171429
type: Comment
comment on: http://stackoverflow.com/q/25160897
type: QuestionComment
score: 1
has text: `But when I change jre path in all keys`, this is a bad idea. You can install additional any version. You may vary the installation path at beginning of the install process. Then run a .bat and select the appropiated version.

http://stackoverflow.com/comment/39148551
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25146187
has text: yes i need it at runtime, so i guess its not an option. thanks.
type: AnswerComment

http://stackoverflow.com/q/25207110
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39259426
has body: How can I read an array into a view? @(week: Array[Int]) I've tried @week[0] but it's not working. Thanks, eapmartins
tagged with: java
score: -1
type: Question
tagged with: playframework
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25207351
has title: How to read an array into a view, in the Play framework?
favorite count: 0
tagged with: playframework-2.0
accepted answer: http://stackoverflow.com/a/25207351
downvote count: 1

snappy
type: Tag
tags question: http://stackoverflow.com/q/25128185
tag name: snappy

frameworks
tags question: http://stackoverflow.com/q/25171227
tag name: frameworks
type: Tag
tags question: http://stackoverflow.com/q/25080731
tags question: http://stackoverflow.com/q/25070360

http://stackoverflow.com/a/25089353
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25089264
has body: I guess the thing you are searching for is basically called Continous Integration Server. One example is Jenkins. I prefer using TeamCity but Jenkins is much more popular.
accepted answer of: http://stackoverflow.com/q/25089264

http://stackoverflow.com/comment/41777989
has text: You might want to consider using List instead since I've encountered NPE's when deserializing String arrays.
comment on: http://stackoverflow.com/a/25113463
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39143802
has text: Or I could keep both and go for an ArrayList (which is resizable). Like I said, I felt like I was missing something simple.
score: 0
comment on: http://stackoverflow.com/a/25144097
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25129331
has body: Don't use PointerInfo for this, all the information you need is passed to you via the MouseEvent... MouseEvent contains the local x/y coordinates of the mouse event relative on the component which raised in... public void mouseClicked(MouseEvent e) { int localX = e.getX(); int localY = e.getY(); To translate the localX/Y to another component's context, you would use something like... e = SwingUtilities.convertMouseEvent(e.getComponent(), e, frame); // Where frame would be the component you want to translate the current // local context into Take a look at SwingUtilities.convertMouseEvent(Component, MouseEvent, Component), SwingUtilities.convertPoint(Component, Point, Component) and SwingUtilities.convertPoint(Component, int, int, Component) for more details. Also, take a look at How to Write a Mouse Listener Generally, you are better off attaching listeners to the component you are interested, rather than the frame, a frame is made up of a number layered components, all of which could consume mouse events, preventing your frame from receiving mouse events
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/25129280
type: Answer

http://stackoverflow.com/comment/39094283
type: QuestionComment
comment on: http://stackoverflow.com/q/25119310
score: 2
has text: Please define 'wrong'
type: Comment

http://stackoverflow.com/a/25219419
downvote count: 1
score: 4
upvote count: 5
answers question: http://stackoverflow.com/q/25219394
has comment: http://stackoverflow.com/comment/39280867
has body: I'll rephrase that. While it can be done via reflection, it would be ugly, unsafe (since, as you see in the other answer, you have to supply the variable name as a String, and if you put a name of an un-existing variable, the compiler won't catch your error, and you'll get an exception at runtime) and less efficient. Therefore what you should do is store all these variables in a single array and use the index of the array to determine which of them is returned. A two dimensional array would be even better. BufferedImage[][] move = ...; ... return move[directionIndex][spriteIndex];
type: Answer

http://stackoverflow.com/q/25083851
has title: JFileChooser prompt then letter frequency count of text file
tagged with: counter
has body: import java.io.File; import javax.swing.JFileChooser; import java.util.Scanner; public class JFileChooser { public static void main(String args []) throws Exception{ JFileChooser chooser = new JFileChooser(); File F = new File("C:/Users/Seth/Desktop/Java"); chooser.setCurrentDirectory(F); chooser.showOpenDialog(null); } public String normalizeWord(String word) { String result = ""; for (int i=0; i &lt; word.length(); i+= 1) { char c= word.charAt(i); if (Character.isLetter(c)) result += Character.toLowerCase(c); } return result; } } } } My code I'm working on so far. I am trying to make it so that whatever chosen text file from the JFileChooser, I can prompt to count the letter frequency of that text. I have tried combining a separate frequency counter from another String example I have done but it did not compile. Any help would be very much appreciated.
score: 0
has comment: http://stackoverflow.com/comment/39029636
has comment: http://stackoverflow.com/comment/39029675
has comment: http://stackoverflow.com/comment/39028276
answer count: 1
favorite count: 0
tagged with: letter
type: UnansweredQuestion
tagged with: file
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25084981
tagged with: text
tagged with: java
type: Question

http://stackoverflow.com/comment/39118682
type: Comment
has text: I believe it's possible to terminate the running instance on uninstall, that should take care of the issue.
comment on: http://stackoverflow.com/q/25132353
score: 0
type: QuestionComment

http://stackoverflow.com/a/25145948
type: Answer
upvote count: 1
has body: You don't need GWT server capabilities at all (gwt-server.jar). You only need a web server to host your compiled GWT app like nginx. What works for me is coding simple REST calls (Spring MVC) from the server and GWT using GWTP Rest support. Jackson and GwtJackson are used in both sides to serialize/deserialize DTO's. To avoid SOP problems use a reverse proxy or implement CORS.
has comment: http://stackoverflow.com/comment/39179283
has comment: http://stackoverflow.com/comment/39174917
score: 1
has comment: http://stackoverflow.com/comment/39174249
has comment: http://stackoverflow.com/comment/39170789
has comment: http://stackoverflow.com/comment/39164308
downvote count: 0
has comment: http://stackoverflow.com/comment/39152641
answers question: http://stackoverflow.com/q/25144017

http://stackoverflow.com/a/25187201
has comment: http://stackoverflow.com/comment/39220288
type: Answer
has body: you are getting NPE because your link is null
has comment: http://stackoverflow.com/comment/39220380
score: 0
answers question: http://stackoverflow.com/q/25186959
has comment: http://stackoverflow.com/comment/39220340

http://stackoverflow.com/comment/39265625
comment on: http://stackoverflow.com/q/25208049
has text: I have edited something.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39121721
has text: Thanks! It works that way! I thought I initialize it with: "public Jpeg[] sub_images = new Jpeg[200];" Why that doesn't work?
type: AnswerComment
comment on: http://stackoverflow.com/a/25134032
type: Comment
score: 0

http://stackoverflow.com/q/25085310
has title: Spring runnable jar to run on window
type: UnansweredQuestion
tagged with: eclipse
has answer: http://stackoverflow.com/a/25086446
type: Question
answer count: 2
tagged with: spring
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/25085554
has body: I have created a project which was develop as a spring mvn project on eclipse but later had to add more jars which were not added though mvn , So i collected all the jar in a folder and created a runnable jar thru eclipse and try to run from command prompt ,it is showing below error and it is running in eclipse : log4j:WARN No appenders could be found for logger (org.springframework.core.env. StandardEnvironment).`enter code here` log4j:WARN Please initialize the log4j system properly. Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinit ionParsingException: Configuration problem: Unable to locate Spring NamespaceHan dler for XML schema namespace [http://www.springframework.org/schema/context] Offending resource: class path resource at org.springframework.beans.factory.parsing.FailFastProblemReporter.err or(FailFastProblemReporter.java:68)

http://stackoverflow.com/a/26012978
has comment: http://stackoverflow.com/comment/137027727
type: Answer
answers question: http://stackoverflow.com/q/25129781
upvote count: 15
downvote count: 0
has body: i solved this problem by trying following solution Project > Properties > Java Build Path Select Libraries tab Select JRE System Library Click Edit button Choose an alternate JRE (jre1.8.0_20) Click Finish button
score: 15

http://stackoverflow.com/q/25113210
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39083711
downvote count: 0
has answer: http://stackoverflow.com/a/25113570
has answer: http://stackoverflow.com/a/25113628
has body: I am trying to create a method to print out the largest n values in a binary search tree. I was considering altering a reverse order print method to achieve this. reverse order print method: public static void reverseOrderPrint(TreeNode node) { if (node == null) return; reverseOrderPrint(node.right); System.out.println(node.data); reverseOrderPrint(node.right); } I wanted to modify the method above to something like this to achieve my goals // print BST reverse Order public static void reverseOrder(TreeNode node, int n) { if (sizeOfBinaryTree(node) &lt; n) { System.out.print("n is bigger than tree"); return; } if (node == null) return; reverseOrder(node.right); System.out.print(node.data); reverseOrder(node.left); } I have considered storing the reverse order elements in an array and then returning the first n values but this would have a performance of O(n) and require extra memory. How can I perform the same task recursively without requiring extra memory? Also is this possible to complete this problem in O(log n)? or does it have to be O(n)?
possible better answer: http://stackoverflow.com/a/25113570
has comment: http://stackoverflow.com/comment/39082869
favorite count: 0
has comment: http://stackoverflow.com/comment/39083841
tagged with: binary-search-tree
upvote count: 2
has comment: http://stackoverflow.com/comment/39083566
has comment: http://stackoverflow.com/comment/39083378
accepted answer: http://stackoverflow.com/a/25113628
linked to: http://stackoverflow.com/q/2329171
has title: printing largest n values in binary search tree
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/39083258
tagged with: algorithm

http://stackoverflow.com/a/25191771
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/25191697
type: Answer
has comment: http://stackoverflow.com/comment/39229162
answers question: http://stackoverflow.com/q/25191697
has body: The Preferences class does this. You should not use it for more application specific values though. The size and location of the windows and such is what it is used for. Preferences prefs = Preferences.userRoot(); prefs.put("AppWindowSize", "10"); prefs.get("AppWindowSize","DefaultValueHere");
upvote count: 4

http://stackoverflow.com/a/43836904
upvote count: 1
has body: I'm using eclipse neon 3. I just wanted to use javafx.application.Application, so I followed Christian Hujer's answer above and it worked. Just some tips: the access rules are very similar to the import statement. For me, the access rules I added was "javafx/application/**". Just replace the dot in the import statement with forward slash and that's the rule. Hope that helps.
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25222811

http://stackoverflow.com/a/25212778
has comment: http://stackoverflow.com/comment/39269121
score: 1
has comment: http://stackoverflow.com/comment/39269681
has comment: http://stackoverflow.com/comment/39269740
downvote count: 0
has body: You should keep track of the index of the lowest number (each time you write lowest = input; you should add lowestIndex=i;. Then helTall[lowestIndex] will be the lowest number. So you swap helTall[lowestIndex] with helTall[0] instead of just overwriting the value of helTall[0]. I thought it was enough to describe the solution in words, but I guess it wasn't... int lowest = Integer.MAX_VALUE; int lowestIndex = 0; for(int i=0;i&lt;helTall.length;i++){ System.out.println("Integers? "); input = tastatur.nextInt(); if (input &lt; lowest){ lowest = input; lowestIndex = i; } helTall[i]=input; } // swap the numbers if (lowestIndex &gt; 0) { int temp = lowest; helTall[lowestIndex] = helTall[0]; helTall[0] = temp; } // display output for (int i = 0; i &lt; helTall.length; i ++) { System.out.println(helTall[i]); }
has comment: http://stackoverflow.com/comment/39269080
accepted answer of: http://stackoverflow.com/q/25212740
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39268516
has comment: http://stackoverflow.com/comment/39269923
answers question: http://stackoverflow.com/q/25212740
has comment: http://stackoverflow.com/comment/39268649
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39268977

http://stackoverflow.com/q/25125890
tagged with: audiorecord
has body: I am having a problem wit AudioRecord. I am developing an application that needs to record some an impulse response from the MIC and make some DSP with it. The audio captured is stored in a WAV file and being plotted afterwards from this file. I´ve created a class called GrabaAudio which is expected to record a wav file of 3 sec long. The problem is that I am obtaining ramdonly either wav files of 3 sec and 1,5 sec without a clear reason. This is what I am supossed to obtain always: Waveform: But actually, that result is just obtained sometimes, while most of the time this is what I obtain: What is really curious about this is that, when I obtain the expected result in the plot, I play the wav file to see what has actually been recorded and I can hear the impulse, but just for 1,5 sec instead of 3. Therefore the samples obtained are half of the expected. On the other hand, when I obtain the plot with the duplicated impulse, the number of samples is the expected and the wav duration is 3 sec, but I don´t know why the impulse appears twice. Do you guys know what am I doing wrong? Here´s the relevant part of the code: @TargetApi(Build.VERSION_CODES.JELLY_BEAN) @SuppressLint("NewApi") public class GrabaAudio { private static final int RECORDER_BPP = 16; private static final String AUDIO_RECORDER_FILE_EXT_WAV = ".wav"; private static final String AUDIO_RECORDER_FOLDER = "AudioRecorder"; private static final String AUDIO_RECORDER_TEMP_FILE = "record_temp.raw"; public int RECORDER_SAMPLERATE = 8000; private static final int RECORDER_CHANNELS = AudioFormat.CHANNEL_IN_MONO; private static final int RECORDER_AUDIO_ENCODING = AudioFormat.ENCODING_PCM_16BIT; private AudioRecord recorder = null; private int bufferSize = 0; private Thread recordingThread = null; public boolean isRecording = false; public boolean triggered=false, processed=false; int bufferTotal=0, read=0, indice=0, indice2=0; byte[] circBuffer=new byte[8192*3];//AudioRecord.getMinBufferSize(RECORDER_SAMPLERATE, /…
tagged with: arrays
type: UnansweredQuestion
type: Question
tagged with: android
has title: AudioRecord not always recording what expected
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25352862
tagged with: java
tagged with: wav

http://stackoverflow.com/comment/39186327
has text: No modifier means package visibility, not protected. But this does not solve your problem. You should better put your test into the same package than the class under test.
type: Comment
type: QuestionComment
score: 6
comment on: http://stackoverflow.com/q/25168690

http://stackoverflow.com/comment/39249501
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25202880
has text: Try to restart yarn server. Hope it helps.
score: 0

methods
tags question: http://stackoverflow.com/q/25173998
tags question: http://stackoverflow.com/q/25158362
tags question: http://stackoverflow.com/q/25110438
tags question: http://stackoverflow.com/q/25107016
tag name: methods
tags question: http://stackoverflow.com/q/25078578
tags question: http://stackoverflow.com/q/25194009
tags question: http://stackoverflow.com/q/25178387
tags question: http://stackoverflow.com/q/25190292
type: Tag
tags question: http://stackoverflow.com/q/25228954
tags question: http://stackoverflow.com/q/25180446
tags question: http://stackoverflow.com/q/25144463
tags question: http://stackoverflow.com/q/25224530
tags question: http://stackoverflow.com/q/25168771
tags question: http://stackoverflow.com/q/25090687
tags question: http://stackoverflow.com/q/25213625
tags question: http://stackoverflow.com/q/25133672
tags question: http://stackoverflow.com/q/25125596
tags question: http://stackoverflow.com/q/25215575
tags question: http://stackoverflow.com/q/25072867
tags question: http://stackoverflow.com/q/25100724
tags question: http://stackoverflow.com/q/25222120
tags question: http://stackoverflow.com/q/25140986

http://stackoverflow.com/q/25121216
tagged with: jsp
has title: Why does servlet name stay in url after RequestDispatcher.forward?
has comment: http://stackoverflow.com/comment/39097882
has comment: http://stackoverflow.com/comment/39097904
favorite count: 0
has answer: http://stackoverflow.com/a/25121259
has answer: http://stackoverflow.com/a/25121254
upvote count: 2
possible better answer: http://stackoverflow.com/a/25121259
has body: I am making a JSP/Servlet web app which starts with log in page. After user enters log in information, a servlet, called LoginServlet, processes the data and if the log in is successful the servlet redirects user to MainPage.jsp like this: RequestDispatcher rd = request.getRequestDispatcher("MainPage.jsp"); rd.forward(request,response); It works. It takes me to MainPage.jsp, only the URL is NOT: http://localhost:8080/RestauRec/MainPage.jsp it is: http://localhost:8080/RestauRec/LoginServlet It is not an actual problem, but still, I want to know why this is and how can I change this? Note: I don't know if it matters or not but, in the action attribute of the form element (in the log in page) I place LoginServlet. Like this: &lt;form action="LoginServlet" method="POST"&gt; Thanks in advance!
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: servlets
accepted answer: http://stackoverflow.com/a/25121254
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/q/25180902
downvote count: 3
has answer: http://stackoverflow.com/a/39234675
answer count: 4
possible better answer: http://stackoverflow.com/a/25180965
type: AnsweredQuestion
tagged with: java.util.scanner
type: Question
linked to: http://stackoverflow.com/q/18678939
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/25180968
has answer: http://stackoverflow.com/a/25180965
has title: how to check whether the input is integer or not
upvote count: 1
has comment: http://stackoverflow.com/comment/39208015
has answer: http://stackoverflow.com/a/25181206
accepted answer: http://stackoverflow.com/a/25181206
has body: I a making a program that will ask an int input from user and check whether user input is an integer or not. If no the program asks for an input tile it gets a integer. Scanner in = new Scanner(System.in); System.out.println("Eneter a nuber here:"); int num; if (in.hasNextInt()){ num =in.nextInt(); if(num % 2 == 0){ System.out.print("this is even!!"); } else{ System.out.println("this is odd!!"); } } else { System.out.print("pleas enter an integer only!!!"); num = in.nextInt(); if(num % 2 == 0){ System.out.print("this is even second check!!"); } else{ System.out.println("this is odd second check!!"); } } here is the code but i have some mistakes in there. it brings an error when input is not an int. pleas help with this, thanks in advance!
favorite count: 0

http://stackoverflow.com/q/25136433
upvote count: 1
tagged with: swing
has title: Java Fill JLabel with Background Color over time
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25136871
tagged with: java
has comment: http://stackoverflow.com/comment/39126007
has comment: http://stackoverflow.com/comment/39126941
has comment: http://stackoverflow.com/comment/39126534
has answer: http://stackoverflow.com/a/25144958
type: Question
score: -1
has body: Is there any way to fill a JLabel slowly over time with a background color from left to right? I am trying to set up some kind of audioplayer. The text which is spoken is shown(written) in a JLabel and I would like to have some kind of "animation" when the File with the spoken text is being played. Some kind of bar going from left to right through the JLabel would work as well. I appreciate any kind of help/ideas. Thank you!
has comment: http://stackoverflow.com/comment/39126061
has answer: http://stackoverflow.com/a/25137457
answer count: 3
has answer: http://stackoverflow.com/a/25136871
possible better answer: http://stackoverflow.com/a/25137457
favorite count: 0
downvote count: 2

http://stackoverflow.com/comment/39223736
type: QuestionComment
type: Comment
has text: If it's that invite popup then it's just a div that pops up on the page. I'm not sure what triggers it but there is a delay in it showing up. Perhaps a wait would allow this or a mouse move function would trigger it...only showed up the first time I hit the page. You need to track down what is actually triggering that event...
comment on: http://stackoverflow.com/q/25176605
score: 0

http://stackoverflow.com/q/25115539
has title: Selenium Web driver:Want to insert a string value in numeric field
tagged with: excel
has comment: http://stackoverflow.com/comment/39094075
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39098770
answer count: 0
has body: In my project ,I am reading SSN from Excel file and try to put it in numeric text field. I use the following code Sheet s; FileInputStream fi=new FileInputStream("C:\\Users\\user\\Desktop\\Selenium.xls"); Workbook w= Workbook.getWorkbook(fi); s=w.getSheet(0); driver.findElement(By.id("TabContainer1_IndividualInfo_txtScocialSecurity_II")).sendKeys(ssn); String ssn=s.getCell(5,1).getContents(); But data is not get inserted into the numeric textfield in browser.
type: Question
has comment: http://stackoverflow.com/comment/39101507
has comment: http://stackoverflow.com/comment/39101560
score: 0
tagged with: java
tagged with: selenium

http://stackoverflow.com/q/25190347
tagged with: try-with-resources
has answer: http://stackoverflow.com/a/25190467
type: Question
tagged with: java-7
downvote count: 0
has title: Does AutoCloseable.close() method break Backward compatibilty rule of Java
answer count: 1
accepted answer: http://stackoverflow.com/a/25190467
favorite count: 0
has body: From Java 7 ,Closeable interface has been retrofitted to extend AutoCloseable interface so that all classes implementing Closeable interface can work with try-with-resources statement. Till now,Closeable interface was free to throw any exception including InterrruptedException. However,with Java 7 any instance of Closeable interface used in try-with-resources statement might throw InterruptedException when there is automatic invocation of close method after exiting the try block and its InterruptedException might get suppressed by implicit call to Throwable.addSuppressed(InterruptedException); So does this break the backward compatibility rule of Java considering that somebody might have its exception unknowingly suppressed and program not behaving as it should
has comment: http://stackoverflow.com/comment/39226496
upvote count: 1
tagged with: autocloseable
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/39038720
score: 1
comment on: http://stackoverflow.com/a/25089078
type: AnswerComment
has text: no i have to convert it back to object. Its string already . and how to get the 3 parameters after split( as in get them in different variables) ??
type: Comment

http://stackoverflow.com/comment/39126476
type: QuestionComment
has text: Next, you should probably read more about binary floating point, and consider using `BigDecimal` instead.
comment on: http://stackoverflow.com/q/25136754
score: 6
type: Comment

http://stackoverflow.com/q/25202783
has answer: http://stackoverflow.com/a/25203496
answer count: 1
type: UnansweredQuestion
tagged with: css
has title: serve static files(js/css/images) from apache instead of tomcat
tagged with: java
has body: I am using apache and tomcat in ubuntu server, I want to serve all static files from apache instead of tomcat , I have configured like following, what's wrong in it. Its serving page when I hit url, but not seving css and js, when I comment Alias and JkUnMount its working properly, But I need all static files serve from Apache. Shall I enable anything in apache Ubuntu for this ? Any suggestions &lt;VirtualHost *:80&gt; DocumentRoot /var/www ServerName www.tesing.com ServerAlias testing.com Alias /js /var/lib/tomcat7/webapps-testing/ROOT/js Alias /styles /var/lib/tomcat7/webapps-testing/ROOT/styles Alias /images /var/lib/tomcat7/webapps-testing/ROOT/images &lt;Directory /var/lib/tomcat7/webapps-testing&gt; Order allow,deny Allow from all &lt;/Directory&gt; # Other directives here &lt;IfModule mod_jk.c&gt; JkUnMount /js* workervs JkUnMount /styles* workervs JkUnMount /images* workervs JkMount /* workervs JkMount /*/* workervs &lt;/IfModule&gt; &lt;/VirtualHost&gt; if I put www.testing.com/images, it shows Forbidden You don't have permission to access /images on this server.
type: Question
tagged with: apache
tagged with: tomcat
score: 0

http://stackoverflow.com/a/25206182
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: Try this out For GET URL url = new URL(urlString); HttpURLConnection c = (HttpURLConnection)url.openConnection(); //connecting to url c.setRequestMethod("GET"); BufferedReader in = new BufferedReader(new InputStreamReader(c.getInputStream())); //stream to resource String str; while ((str = in.readLine()) != null) //reading data responsestring += str+"\n";//process the response and save it in some string or so in.close(); //closing stream For POST URL obj = new URL(url); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); String urlParameters = ..; con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer res = new StringBuffer(); while ((inputLine = in.readLine()) != null) { res.append(inputLine); } in.close();
answers question: http://stackoverflow.com/q/25205714
has comment: http://stackoverflow.com/comment/39457095
accepted answer of: http://stackoverflow.com/q/25205714
type: Answer

http://stackoverflow.com/q/25130954
possible better answer: http://stackoverflow.com/a/25131015
tagged with: java-8
upvote count: 6
has answer: http://stackoverflow.com/a/25131015
type: AnsweredQuestion
tagged with: java
has title: Java 8 cannot import java.util.function
has answer: http://stackoverflow.com/a/66739055
type: Question
has answer: http://stackoverflow.com/a/25130970
has body: I am trying to import the package java.util.function but I keep getting the following error: FP.java:2: error: cannot find symbol import java.util.function; ^ symbol: class function location: package java.util I have verified that I am using jdk 1.8.0_11 (using javac -version).
score: 6
has answer: http://stackoverflow.com/a/25130990
has answer: http://stackoverflow.com/a/52215701
downvote count: 0
accepted answer: http://stackoverflow.com/a/25130970
favorite count: 0
answer count: 5

http://stackoverflow.com/q/25210180
has answer: http://stackoverflow.com/a/25221988
upvote count: 1
has body: I created a new project on Play Framework 2.3.2 with Scala. I added two packages models and utils. Created a class in each package and made an import into the model from utils and I get this error : [error] /media/hadareanrares/Media/Projects/TestingScala/app/models/Page.scala:3: not found: object utils [error] import utils._ [error] ^ [error] one error found Tried "_root_.utils._" and I'm getting the same result.
accepted answer: http://stackoverflow.com/a/25226913
type: Question
answer count: 3
tagged with: playframework
has title: Play Framework doesn't find package on clean project
downvote count: 0
tagged with: jvm
favorite count: 0
possible better answer: http://stackoverflow.com/a/25216681
has answer: http://stackoverflow.com/a/25226913
has answer: http://stackoverflow.com/a/25216681
tagged with: scala
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/25123425
has comment: http://stackoverflow.com/comment/39109435
has body: For Java Kepler Eclipse and JTable, I am trying to make a column work as JTextArea, JTextPane or something like that. I need the text to start at the top of the cell and change line when it reaches the border of the cell with a scrollBar if the text doesnt fit in the cell. All cells will be filled and I need them to work that way not just when they are clicked, except maybe for the scrollBar which can appear when cell is clicked but it is not important if it appears when cell is clicked or if it appears from the begining for all cells, whatever is easier. My project is actualy very different but I wrote this mini one with the table so you can copy, paste and run it to see exactly what the problem is. What do I add to my code or how do I alter it to make it do this? import javax.swing.*; import javax.swing.table.*; import java.awt.*; public class JavaTestOne { JFrame frmApp; private JTable table; DefaultTableModel model; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { JavaTestOne window = new JavaTestOne(); window.frmApp.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public JavaTestOne() { initialize(); } private void initialize() { frmApp = new JFrame(); frmApp.getContentPane().setFont(new Font("Tahoma", Font.PLAIN, 13)); frmApp.setBounds(300, 100, 500, 300); frmApp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmApp.getContentPane().setLayout(new CardLayout(0, 0)); frmApp.setTitle("App"); { JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(50, 50, 100, 100); frmApp.add(scrollPane); { table = new JTable(); table.setFillsViewportHeight(true); Object[][] data = { {"Monday", ""}, {"Tuesday", ""}, {"Wednesday", ""}}; String[] cols = {"DAY","PROGRAM"}; model = new DefaultTableModel(data, cols) { public boolean isCellEditable(int row, int col) { return false; } public Class getColumnClass(int column) { return getValueAt(0, column).getClass(); } }; table.setModel(model); …
type: UnansweredQuestion
tagged with: swing
tagged with: tablecellrenderer
has comment: http://stackoverflow.com/comment/39105766
has comment: http://stackoverflow.com/comment/39107304
has answer: http://stackoverflow.com/a/25158169
tagged with: java
tagged with: eclipse
linked to: http://stackoverflow.com/q/11780048
type: Question
has comment: http://stackoverflow.com/comment/39151729
answer count: 2
linked to: http://stackoverflow.com/q/25015808
has answer: http://stackoverflow.com/a/25132732
has comment: http://stackoverflow.com/comment/39147971
has comment: http://stackoverflow.com/comment/39151373
tagged with: jtable
has comment: http://stackoverflow.com/comment/39151025
score: 0
has comment: http://stackoverflow.com/comment/39105956
has title: How to make Java Eclipse Jtable Cell / Column work as scrollable TextField
has comment: http://stackoverflow.com/comment/39102686

http://stackoverflow.com/q/25121026
has title: Ranking variables, ordering
has comment: http://stackoverflow.com/comment/39097499
has comment: http://stackoverflow.com/comment/39099610
linked to: http://stackoverflow.com/q/7515377
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39100575
has comment: http://stackoverflow.com/comment/39097676
type: Question
tagged with: graph
has body: How to order a set of variables with given conditions. If I am given: A &lt; B, B &lt; C, and C &lt; A. This is impossible. A &lt; B, C &lt; B, and A &lt; C. The order, from least to greatest, is A, C, B. I prefer R, if I can just give the method strings such as c("A&lt;B", "C&lt;B", "A&lt;C") and from there, the method returns c("A","C", "B") Given any number of variables, how can I rank them from least to greatest, based on these conditions? Please do incorporate a break in the code if the scenario is impossible. Thank you.
answer count: 2
has answer: http://stackoverflow.com/a/25122603
has comment: http://stackoverflow.com/comment/39099380
tagged with: http://stackoverflow.com/tag/r
upvote count: 3
downvote count: 2
has comment: http://stackoverflow.com/comment/39097647
has answer: http://stackoverflow.com/a/25122367
favorite count: 0
has comment: http://stackoverflow.com/comment/39099108
type: UnansweredQuestion

http://stackoverflow.com/comment/39192987
has text: @mKorbel what did you mean?i didn't get it
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25162658
score: 0

http://stackoverflow.com/a/25206497
has comment: http://stackoverflow.com/comment/39286746
downvote count: 1
score: -1
upvote count: 0
has body: Thank you for the help. In the mean time I have found a much simpler and easy solution to this problem; below is the solution to my problem: public class RepeatTest { boolean repeat=true; Integer count=0; public boolean returncount(){ count++; System.out.println("the count is"+count); if(count.equals(5)){ repeat=false; } return repeat; } @Test public void testreturn() throws InterruptedException{ boolean flag=returncount(); while(flag){ flag=returncount(); Thread.sleep(4000); } } }
answers question: http://stackoverflow.com/q/25191083
type: Answer

http://stackoverflow.com/a/25122087
has body: On the other hand, if we had only one parameter, then the call is successful. Why is that ? Your method has a single type parameter. When you invoke a method, you either provide a type argument explicitly or have one be inferred implicitly. When you invoke it like addandDisp(ls2, new Object()); the compiler needs to extract a type to bind to T from both method arguments, since both method parameters rely on the method's type parameter, T. The issue here is that ? extends Object and Object do not produce a single type that can be bound to T safely. Imagine you had public static &lt;T&gt; void addandDisp(Collection&lt;T&gt; cs, T t) { cs.add(t); } ... List&lt;? extends Object&gt; ls2 = new LinkedList&lt;Number&gt;(); addandDisp(ls2, new Object()); This add should not be allowed since an Object should not be used where a Number would have been expected. Type safety would break. If you have a single parameter public static &lt;T&gt; void addandDisp(Collection&lt;T&gt; cs) { Then the compiler uses the single argument to infer the type argument. There is then no ambiguity about what to use.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25120951
answers question: http://stackoverflow.com/q/25120951
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/25074945
tagged with: python
tagged with: rabbitmq
possible better answer: http://stackoverflow.com/a/60247556
has comment: http://stackoverflow.com/comment/39011786
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/60247556
upvote count: 2
has comment: http://stackoverflow.com/comment/39047402
has title: rabbitmq not working with java
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25088415
has comment: http://stackoverflow.com/comment/39012134
answer count: 2
downvote count: 0
favorite count: 0
has body: I have rabbitmq setup on my machine and it has 3 different queues. One java code is listening to a queue and other queues are sending messages to python codes. Now python codes are working fine but java code seems to have a problem with AMQ. Following error is coming: Exception in thread "main" com.rabbitmq.client.PossibleAuthenticationFailureException: Possibly caused by authentication failure at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:341) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:590) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:612) at com.elki.test.Worker.main(Worker.java:73) Caused by: com.rabbitmq.client.ShutdownSignalException: connection error at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67) at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33) at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:343) at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:216) at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:202) at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:326) ... 3 more Caused by: java.io.EOFException at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:290) at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:95) at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:139) at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:532) at java.lang.Thread.run(Thread.java:744) How come there could be an AuthenticationFailure with java but not with python. Any help appreciated. CODE: public static void main(String[] argv) throws java.io.IOException, java.lang.InterruptedException { ConnectionFactory factory = new ConnectionFactory(); factory.setHost("127.0.0.1"); factory.setPort(5672); com.rabbitmq.client.Connection connection = factory.newConnection(); Cha…
accepted answer: http://stackoverflow.com/a/25088415

http://stackoverflow.com/q/25073074
favorite count: 0
tagged with: spring
has title: error: cannot access Filter
tagged with: spring-mvc
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/25076092
tagged with: spring-security
has body: Here is my error of my spring-security-loginform-annotation project I refer that from mkyong site link [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project spring-security-loginform-annotation: Compilation failure: Compilation failure: [ERROR] \Projects\SpringKT\spring-security-custom-login-form-annotation\src\main\java\com\mkyong\config\SecurityConfig.java:[12,7] error: cannot access Filter [ERROR] \Projects\SpringKT\spring-security-custom-login-form-annotation\src\main\java\com\mkyong\config\core\SpringSecurityInitializer.java:[5,7] error: cannot access ServletException Here is my details of project Versions &lt;spring.version&gt;4.0.6.RELEASE&lt;/spring.version&gt; &lt;spring.security.version&gt;3.2.3.RELEASE&lt;/spring.security.version&gt; &lt;jstl.version&gt;1.2&lt;/jstl.version&gt; &lt;javax.servlet.version&gt;3.1.0&lt;/javax.servlet.version&gt; I run it as like this mvn clean package install jetty:run But its gives above error @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter {//Line 12 public class SpringSecurityInitializer extends AbstractSecurityWebApplicationInitializer {//Line 05
accepted answer: http://stackoverflow.com/a/25076092
answer count: 1
downvote count: 0

http://stackoverflow.com/a/25154627
answers question: http://stackoverflow.com/q/25153370
score: 1
upvote count: 1
downvote count: 0
type: Answer
has body: Both subjects and grades have a limited number of values, so I suggest using enums: public class Example { public static void main(String[] args) throws IOException { Student s1 = new Student("John Doe"); s1.setGrade(Subject.MATHS, Grade.B); s1.setGrade(Subject.PHYSICS, Grade.A); s1.setGrade(Subject.ENGLISH, Grade.E); Student s2 = new Student("Jane Smith"); s2.setGrade(Subject.MATHS, Grade.C); s2.setGrade(Subject.PHYSICS, Grade.C); s2.setGrade(Subject.ENGLISH, Grade.A); // print students and their grades: s1.printAllGrades(); s2.printAllGrades(); // print every subject and its grades: for(Subject s : Subject.values()){ s.printAllGrades(); } } } enum Subject{ MATHS, PHYSICS, ENGLISH; private Map&lt;Student, Grade&gt; grades = new HashMap&lt;Student, Grade&gt;(); public void setGrade(Student student, Grade grade){ grades.put(student, grade); } public void printAllGrades(){ System.out.println(this); for(Student s : grades.keySet()){ System.out.println(s.getName() + " : " + grades.get(s)); } } } enum Grade{ A, B, C, D, E, F } class Student{ private String name; private Map&lt;Subject, Grade&gt; grades = new HashMap&lt;Subject, Grade&gt;(); public Student(String name){ this.name = name; } public String getName(){ return this.name; } public void setGrade(Subject subject, Grade grade){ grades.put(subject, grade); subject.setGrade(this, grade); } public Grade getGrade(Subject subject){ return grades.get(subject); } public void printAllGrades(){ System.out.println("Grades of " + name + ":"); for(Subject s : grades.keySet()){ System.out.println(s + " : " + grades.get(s)); } } } Using the enum type is suitable to list both subjects and grades. It guarantees that only suitable values can be passed as an argument and is easily extensible - you can add a method to an enum if you wish. A simple HashMap for every student is enough to hold the mappings between subjects and grades. You may want to read more on enums in java.

http://stackoverflow.com/comment/39273538
type: QuestionComment
comment on: http://stackoverflow.com/q/25176880
has text: It's to check if one word is the permutation of the other
score: 0
type: Comment

http://stackoverflow.com/comment/39094395
type: QuestionComment
has text: Filters_name doesn't work. The output still the same with it and without it.
comment on: http://stackoverflow.com/q/25119310
score: 0
type: Comment

http://stackoverflow.com/q/25081343
score: 0
tagged with: java
type: Question
has body: I am actually using the newly released Gradle 2, but having the same issues as described in the previous post. I am also a newb trying to follow the example given in the Spring guide (http://spring.io/guides/gs/gradle/#scratch) but after my first compile, there were no classes. I have tried various configurations of tree structure including adding the structure and code suggested in the above thread: "I guess the source file path is src/org/gradle/example/simple/HelloWorld.java. (The diagram shows something different.) That doesn't match Gradle's default, so you'll have to reconfigure it: sourceSets.main.java.srcDirs = ["src"] – Peter Niederwieser Dec 7 '12 at 1:23 " adding the line: sourceSets.main.java.srcDirs = ["src"] allows the code to compile, however, I still have no classes. Here is the successful build. :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :jar UP-TO-DATE :assemble UP-TO-DATE :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test UP-TO-DATE :check UP-TO-DATE :build UP-TO-DATE BUILD SUCCESSFUL Total time: 4.468 secs Here is the build file: apply plugin: 'java' sourceSets.main.java.srcDirs=["src"] repositories { mavenLocal() mavenCentral() } dependencies { compile "joda-time:joda-time:2.2" } jar { baseName = 'gs-gradle' version = '0.1.0' } task wrapper(type:Wrapper) { gradleVersion = '1.11' } apply plugin: 'application' mainClassName = 'hello.HelloWorld' Where are my classes? Please help.
answer count: 1
has comment: http://stackoverflow.com/comment/42308847
has answer: http://stackoverflow.com/a/26893418
tagged with: build.gradle
has comment: http://stackoverflow.com/comment/39033158
tagged with: spring
accepted answer: http://stackoverflow.com/a/26893418
type: AnsweredQuestion
has title: Followup to Gradle 1.3: build.gradle not building classes

http://stackoverflow.com/comment/39005883
has text: This is very important concept, take the time to understand it and use it to your advantage ;)
type: Comment
comment on: http://stackoverflow.com/a/25071662
score: 0
type: AnswerComment

http://stackoverflow.com/comment/44222568
type: QuestionComment
comment on: http://stackoverflow.com/q/25100115
score: 0
has text: I just ran into this myself. Seems like a dagger bug.
type: Comment

http://stackoverflow.com/comment/39071962
comment on: http://stackoverflow.com/q/25107158
type: Comment
type: QuestionComment
score: 0
has text: your data will be always integers? if your data contains strings your code would fails if it contains strings like "Hello, world!"

http://stackoverflow.com/q/25107074
tagged with: java
has body: this is my first post so forgive me if i have posted incorrectly. I have a task that i need to complete but i cant get it to work properly. the compiler that i use is bluej. what i need to do is to use scanner to read a text file and compare a user input to the text file. if the input string compares then it should print out that ""The word is on the text file". Unfortunately i cant get this to work. My code reads the file because it prints out to the console but no comparison it s happening. please have a look at my code and give me some pointers. i have been trying to use .equals(): private boolean searchFromRecord(String recordName, String word) throws IOException { // Please write your code after this line File file = new File(recordName); Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { System.out.println(scanner.nextLine()); for(int i = 0; scanner.hasNextLine(); i++){ String compare = scanner.nextLine(); IO.outputln("word#" + i + ":" + compare); } scanner.close(); if (scanner.equals(word)){ return true; } else{ return false; } } return true; } this is what i get output in the console: Input a word: IRON AA 888 word#0:BULLET word#1:1 word#2:AE 1688 word#3:CHEERS word#4:GAMES word#5:IRON MAN word#6:WOLF word#7:Testing word#8:Wonderful The word "IRON" is not in the record.
type: Question
has comment: http://stackoverflow.com/comment/39071804
possible better answer: http://stackoverflow.com/a/25107145
has answer: http://stackoverflow.com/a/25107145
has comment: http://stackoverflow.com/comment/39071491
has comment: http://stackoverflow.com/comment/39071458
score: -1
has answer: http://stackoverflow.com/a/25108224
accepted answer: http://stackoverflow.com/a/25108224
downvote count: 2
answer count: 3
upvote count: 1
favorite count: 0
has title: HW : search for input string in text document
has answer: http://stackoverflow.com/a/25107201
type: AnsweredQuestion

http://stackoverflow.com/a/39923888
answers question: http://stackoverflow.com/q/25083812
upvote count: 1
downvote count: 0
type: Answer
score: 1
has body: You dont need both jTDS and JDBC in your classpath. Any one is required. You'll most likley need only sqljdbc.jar. Be sure to place it in a psychical location like lib within WEB-INF directory of your project instead of adding it into your classpath via IDE. Reset your service, and trying again. It should fix it self. Jar file can be found here: www.java2s.com/Code/JarDownload/sqlserverjdbc/sqlserverjdbc.jar.zip

http://stackoverflow.com/comment/39257078
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25205993
score: 0
has text: In my case these files are already excluded in sonar.exclusions from other analysis (Cobertura in this case). The Technical Debt analysis does not honor those exclusions in sonar.exclusions.

http://stackoverflow.com/q/25107472
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/25108415
has title: Change the background of date picker dialog programmatically
has answer: http://stackoverflow.com/a/25108415
type: Question
answer count: 2
tagged with: android-datepicker
upvote count: 1
tagged with: android
has body: I am showing DatePicker in dialog by following this tutorial, The dialog is showing white background which does not matches my app branding, so I want to change its color. How can I do that programmatically ? Any Ideas? Thanks in advance !
has answer: http://stackoverflow.com/a/25113098
accepted answer: http://stackoverflow.com/a/25113098
favorite count: 0
downvote count: 0
tagged with: datepickerdialog

http://stackoverflow.com/a/25186722
has comment: http://stackoverflow.com/comment/39219397
score: 1
answers question: http://stackoverflow.com/q/25186543
has body: The problem is this: ListView lv = (ListView) findViewById(R.id.listView1); You are calling findViewById() too early! You always have to be aware of the Activity Lifecycle! findViewById() can only be called after you set a layout with setContentView(). You should look for Views in onCreate() like this: public class ViewFeeds extends Activity { private ArrayList&lt;String&gt; items = new ArrayList&lt;String&gt;(); private ListView lv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.viewfeeds); lv = (ListView) findViewById(R.id.listView1); ... } ... }
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25186543

http://stackoverflow.com/q/25162274
has comment: http://stackoverflow.com/comment/39173954
has comment: http://stackoverflow.com/comment/39173932
has answer: http://stackoverflow.com/a/25162308
score: 2
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12524322
type: Question
has comment: http://stackoverflow.com/comment/39173902
tagged with: java
has answer: http://stackoverflow.com/a/25162381
has comment: http://stackoverflow.com/comment/39174070
has title: Overriding Java code
has comment: http://stackoverflow.com/comment/39174326
answer count: 3
has answer: http://stackoverflow.com/a/25163179
has body: I am trying to understand what I am doing wrong with this code but I don't find the answer. Why it does not print anything in the compiler? Please help. Thanks in advance. public class ClassA { int x = 0; int y = 1; public void methodA() { System.out.println( "x is " + x + " , and y is " + y) ; System.out.println( "I am an instance of: " + this.getClass().getName() ) ; } } class ClassB extends ClassA { int z = 3; public static void main(String[] args) { ClassB obj1 = new ClassB(); obj1.methodA(); } }
downvote count: 0
has comment: http://stackoverflow.com/comment/39173945
has comment: http://stackoverflow.com/comment/39173892
favorite count: 0

http://stackoverflow.com/a/25315412
has body: If you want all you string fields be instances of java.lang.String then you only have to configure the compiler: java -jar /path/to/avro-tools-1.7.7.jar compile -string schema or if you are using the Maven plugin org.apache.avro avro-maven-plugin 1.7.7 String [...] If you want one specific field to be of type java.lang.String then... you can't. It is not supported by the compiler. You can use "java-class" with the reflect API but the compiler does not care. If you want to learn more, you can set a breakpoint in SpecificCompiler line 372, Avro 1.7.7. You can see that before the call to addStringType() the schema have the required information in the props field. If you pass this schema to SpecificCompiler.javaType() then it will do what you want. But then addStringType replaces your schema by a static one. I will most likely ask the question on the mailing list since I don't see the point.
type: Answer
has comment: http://stackoverflow.com/comment/84123843
has comment: http://stackoverflow.com/comment/80281372
score: 77
upvote count: 77
answers question: http://stackoverflow.com/q/25118727
accepted answer of: http://stackoverflow.com/q/25118727
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25101871
has answer: http://stackoverflow.com/a/25101895
accepted answer: http://stackoverflow.com/a/25101895
favorite count: 0
possible better answer: http://stackoverflow.com/a/25101898
has answer: http://stackoverflow.com/a/25101906
has comment: http://stackoverflow.com/comment/39061808
has answer: http://stackoverflow.com/a/25101898
upvote count: 10
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25102025
type: Question
linked to: http://stackoverflow.com/q/4040001
tagged with: java
score: 10
answer count: 6
has title: don't random number that are being random before
tagged with: random
has body: I know how to random number using java Random class. This will random a number between 0-13 13 times; public static void main(String[] args) { int ctr = 13; int randomNum = 0; while(ctr != 0) { Random r = new Random(); randomNum = r.nextInt(13); ctr--; System.out.println(ctr +": " + randomNum); } } Question -I would like to random a number between 0-13 for 13 times -If the first random number is e.g(5),then my second random number will random any number from 0-13 again EXCLUDING 5; If the second random number is e.g(4),then my third random number will random any number from 0-13 again EXCLUDING 5 and 4; etc.. is there a way to do it?
has answer: http://stackoverflow.com/a/25101954
has comment: http://stackoverflow.com/comment/39062196
has answer: http://stackoverflow.com/a/25101904

http://stackoverflow.com/comment/39013847
type: Comment
type: QuestionComment
has text: if at work that kind of searching gets popular they should know about encoding those special characters
comment on: http://stackoverflow.com/q/25076223
score: 0

http://stackoverflow.com/q/25189837
tagged with: spring
has comment: http://stackoverflow.com/comment/39230225
has comment: http://stackoverflow.com/comment/39228683
has comment: http://stackoverflow.com/comment/39227343
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39226577
has comment: http://stackoverflow.com/comment/39225756
has comment: http://stackoverflow.com/comment/39227301
has comment: http://stackoverflow.com/comment/40575353
has comment: http://stackoverflow.com/comment/46484434
has comment: http://stackoverflow.com/comment/39225704
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39227734
has body: Trying to debug a problem we're experiencing and I am at a loss. We have a non-web project that uses Spring and we're compiling it into an executable jar (only the Spring part should matter here). When we run the jar that is built on my local machine using maven, all of our spring beans wire up correctly. However, when i run the jar built by our Jenkins build server (also using maven), one of the beans does not get wired in properly. I've verified that both my machine and the build server are using the same version of java (not same build, as I am on windows and build server is on linux) and maven. They also should have the exact same source code when building (i have no local changes). I am running them both from my development machine. I've remote debugged the execution of both the jars and am getting different behavior. Given the example code below, when i run the jar built locally, when the MyConfig#bar method is invoked and the value of MyConfig#foo is the Foo bean i expected. However, when i run the jar built on our build server, when MyConfig#bar is invoked, the value of MyConfig#foo is null (I didn't think this could happen w/o a Spring exception being thrown). In addition, the console logs an error saying there is a circular reference on the use of the bean "foo". @Configuration public class MyConfig { @Autowired Foo foo; @Bean public Bar bar() { Bar bar = new Bar(); bar.setFoo(this.foo); return bar; } } Other things i've seen is that the jar build on the build server is a different file size than the one built locally. However, when i uncompress the jar and inspect the differences, all class and resource files are exactly the same. The only difference is in the manifest files that state the time and machine that built the jar (which i believe has no affect on execution). Any help is greatly appreciated. Thank you. EDIT (in response to @Nambari) Also, to maybe shed some more light on this, we tried building the jar on a different build server with its own J…
has comment: http://stackoverflow.com/comment/39225545
type: Question
has title: Spring bean wiring issues when jar build on different operating systems
has comment: http://stackoverflow.com/comment/39230809
has comment: http://stackoverflow.com/comment/39230478

http://stackoverflow.com/comment/39156320
comment on: http://stackoverflow.com/q/25152635
type: Comment
has text: What do you consider _leaf_ and _non-leaf_ classes? Which `Map` implementation are you talking about?
type: QuestionComment
score: 2

http://stackoverflow.com/comment/39252420
score: 0
type: Comment
type: QuestionComment
has text: @m4rtin I am using Hibernate framework and i am implementing the Servlet interface for servlet.
comment on: http://stackoverflow.com/q/25204160

http://stackoverflow.com/comment/39483763
has text: To stop recording you can simulate Ctrl+C after specific interval..to do it refer-http://stackoverflow.com/questions/2886756/trigger-os-to-copy-ctrlc-or-ctrl-x-programmatically..see if it works now...
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25215435

http://stackoverflow.com/q/25165969
favorite count: 0
accepted answer: http://stackoverflow.com/a/25221709
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has body: I use the following source to try out @Transactional @Transactional(value = TxType.REQUIRED, rollbackOn = { SQLException.class }) public void insert_Required() throws Exception { insert("INSERT_REQUIRED"); int i = 1; if (i == 1) { throw new SQLException("error"); } return; } private void insert(final String description) throws SQLException { PreparedStatement pst = connection.prepareStatement(INSERT_STMT); pst.setString(1, description); pst.execute(); } But unfortunately the record gets inserted and committed instead of rolling back the transaction. What is wrong there?
type: Question
tagged with: transactional
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25221709
tagged with: cdi
has title: CDI @Transactional.rollbackOn doesn't work

http://stackoverflow.com/comment/39140946
has text: Well it did provide the answer but I'll admit my answer was undevelopped. I corrected it, thank you for the advice.
comment on: http://stackoverflow.com/a/25143656
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25210535
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25210365
has body: Compilers are not predictive to get the result exactly in the format humans want. They obviously work on the limited syntax and semantics rule and as per some grammar (or rules you can say). Errors are also Exceptions in Java that define exceptions which aren't expected to be caught under normal circumstances. So basically, an error is that problem which requires human handling for getting the correct result. Also, your assumption that errors aren't handled is incorrect, as errors are reported like errors occurring during runtime. But, they don't specifically correct the error and also they don't provide much detail about the error.
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25210365
upvote count: 1

http://stackoverflow.com/comment/39018622
type: AnswerComment
has text: So, you mean i first need to learn `Maven` before jumping `Spring framework`?
type: Comment
comment on: http://stackoverflow.com/a/25078911
score: 0

http://stackoverflow.com/comment/39166460
comment on: http://stackoverflow.com/a/25158313
type: Comment
type: AnswerComment
has text: @DividebyZero so? what is your point?
score: 0

http://stackoverflow.com/a/25078122
has body: Its due to many long running threads, You must have to first find out the threads which are running from a long time. You can easily find out by taking thread dump. ps -fL will give you a list and check LWP respective to time running jstack it wil give you hexadecimal value of long running thread Above PID is java process id. Hope it will help you to resolve the issue.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25076155
upvote count: 1

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/25164282
tags question: http://stackoverflow.com/q/25225051
type: Tag
tags question: http://stackoverflow.com/q/25120576
tags question: http://stackoverflow.com/q/25229759

http://stackoverflow.com/comment/93799518
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26676719
type: AnswerComment
has text: Thanks for the explanation, now I know why `null` is always returned for parameter names... And the solution offered is a very nice workaround, but it seems not consistent with the principles of AOP with which codes that are not related to the logic should not be added. That being said, I have no better solution than yours.

http://stackoverflow.com/comment/39104710
comment on: http://stackoverflow.com/q/25124482
score: 0
type: Comment
has text: @TheConstructor I update the table outside the listener. Do you want me to show those codes?
type: QuestionComment

http://stackoverflow.com/q/25141265
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/25204505
accepted answer: http://stackoverflow.com/a/25204505
type: AnsweredQuestion
tagged with: jmeter
tagged with: java
has title: Is it possible to change the title bar of Jmeter?
tagged with: jmeter-plugins
has body: I have written a plugin for Jmeter. I am wondering if I can display the version of the plugin in the title bar of Jmeter. I am hoping to do this without modifying the Jmeter code base.
type: Question

http://stackoverflow.com/q/25228474
answer count: 1
has comment: http://stackoverflow.com/comment/39305005
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39305201
has answer: http://stackoverflow.com/a/25228510
has title: java.lang.String cannot be cast to TreeComparable
tagged with: java
has body: TreeComparable is a Comparable interface. The Error: java.lang.String cannot be cast to TreeComparable This is the line giving me the error if (((TreeComparable) r.getInfo()).compareTo((TreeComparable) p.getInfo()) &lt; 0 ) And here is the method for that line: public void insertBST(Object o) { ObjectTreeNode p, q; ObjectTreeNode r = new ObjectTreeNode(o); if (root == null) root = r; else { p = root; q = root; while (q != null) { p = q; if (((TreeComparable)(r.getInfo())).compareTo((TreeComparable)(p.getInfo())) &lt; 0 ) q = p.getLeft(); else q = p.getRight(); } if (((TreeComparable)(r.getInfo())).compareTo((TreeComparable)(p.getInfo())) &lt; 0) setLeftChild(p, r); else setRightChild(p, r); } } Note: BST stands for binary search tree. The getInfo method of the ObjectTreeNode class: private Object info; public Object getInfo() { return info; } and finally, I don't know if these will help, but my TreeComparable compareTo declaration: int compareTo(Object o); and the compareTo method in the (Word) class: String word; public int compareTo(Object o) { Word w = (Word) o; return this.word.compareTo(w.getWord()); } The Help is greatly appreciated.
has comment: http://stackoverflow.com/comment/39304976
downvote count: 1
type: Question
tagged with: casting
has comment: http://stackoverflow.com/comment/39297598
tagged with: comparable
has comment: http://stackoverflow.com/comment/39298108
has comment: http://stackoverflow.com/comment/39304536
score: 0
upvote count: 1

http://stackoverflow.com/q/25130859
possible better answer: http://stackoverflow.com/a/25130896
type: Question
linked to: http://stackoverflow.com/q/218384
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/25131331
answer count: 2
tagged with: nullpointerexception
accepted answer: http://stackoverflow.com/a/25131331
has comment: http://stackoverflow.com/comment/39116099
has comment: http://stackoverflow.com/comment/39116020
favorite count: 0
tagged with: swing
type: AnsweredQuestion
has body: I've tried going to the original Null Pointer Exception question, but it didn't help. Here is the first and second line of the stack trace: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Client.SpriteField.paintComponent(SpriteField.java:30) So this is telling me that it is in the package "Client", the class "SpriteField", and the method "paintComponent" right? Here is the code in the class SpriteField: package Client; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import javax.swing.JPanel; public class SpriteField extends JPanel { RoundSprite mSprite; public void CreateSpriteAt(float tX, float tY, int tWidth, int tHeight, int tRotation) { mSprite = new RoundSprite(); mSprite.SetPosition(tX, tY); mSprite.SetSpriteWidth(tWidth); mSprite.SetSpriteHeight(tHeight); mSprite.SetSpriteRotation(tRotation); } public void paintComponent (Graphics g) { if(g != null) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; AffineTransform tOldTransform = g2.getTransform(); mSprite.DrawSprite(g2); g2.setTransform(tOldTransform); } } } It might have been just a careless mistake, but I can't seem to find it. Please help, thanks for your time. EDIT: As asked, here is the main method: final SpriteField mSpritePanel = new SpriteField(); mSpritePanel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { float tX = e.getX(); float tY = e.getY(); if(tTextWidth.getText() == null) { tTextWidth.setText("50"); } int tIntWidth = Integer.parseInt(tTextWidth.getText()); if(tIntWidth == 0) { tIntWidth = 50; } if(tTextHeight.getText() == null) { tTextHeight.setText("50"); } int tIntHeight = Integer.parseInt(tTextHeight.getText()); if(tIntHeight == 0) { tIntHeight = 50; } int tRotate = Integer.parseInt(tTextRotation.getText()); mSpritePanel.CreateSpriteAt(tX, tY, tIntWidth, tIntHeight, tRotate); mSpritePanel.repaint(); } });
has comment: http://stackoverflow.com/comment/39116033
has answer: http://stackoverflow.com/a/25130896
tagged with: java
downvote count: 2
has title: I have a null-pointer exception and don't know how to fix it

http://stackoverflow.com/comment/39264047
type: Comment
has text: Ok, see my answer below, it shows you how to do it. Hope it helps!
comment on: http://stackoverflow.com/q/25209786
score: 0
type: QuestionComment

http://stackoverflow.com/a/25205814
type: Answer
has body: You can use a map. Map&lt;String, ArrayList&lt;String&gt;&gt; map = new HashMap&lt;String, ArrayList&lt;String&gt;&gt;(); ArrayList&lt;String&gt; messages1 = new ArrayList&lt;String&gt;(); messages1.add("message11"); messages1.add("message12"); map.put("user1", messages1); And so on. Then, if you do: ArrayList&lt;String&gt; messagesOfUser1 = map.get("user1"); You will receive all the messages for user1.
score: 0
answers question: http://stackoverflow.com/q/25205751

http://stackoverflow.com/comment/39027212
type: QuestionComment
score: 3
has text: possible duplicate of [Converting int to char in java](http://stackoverflow.com/questions/833709/converting-int-to-char-in-java)
comment on: http://stackoverflow.com/q/25083208
type: Comment

http://stackoverflow.com/comment/39118058
has text: I would have used a TreeSet but it is averse to duplicates. So I am a bit skeptical.
score: 0
comment on: http://stackoverflow.com/q/25131530
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25187476
has comment: http://stackoverflow.com/comment/39221437
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25187181
accepted answer of: http://stackoverflow.com/q/25187181
type: AcceptedAnswer
downvote count: 0
has body: The trick to doing something like this efficiently is to realize that you don't need to read the entire file into memory in order to manipulate it. You can create a loop which reads one line of input at a time and does whatever work is required to create one line of output: Scanner scanner = new Scanner(new File("input.txt")); PrintWriter writer = new PrintWriter("output.txt"); while (scanner.hasNextLine()) { String line = scanner.nextLine(); // read a line from the input file writer.println(line.split(" ")[1]); // write a line to the output file } scanner.close(); writer.close(); This will allow you make line-by-line modifications on a file of any size.
type: Answer

http://stackoverflow.com/comment/39246351
score: 0
has text: @AleksandrM yes the problem is resolved but can you please elaborate this behavoiur.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25201142

http://stackoverflow.com/comment/39270197
score: 0
type: AnswerComment
has text: You can use IHS, but then it will become a SPOF. So you usually place two of them, and then need some balancer to distribute traffic among IHSes. If you have ND license, then as separate download you will have Edge components', from where you can install software load balnacer - http://www-01.ibm.com/support/knowledgecenter/SS7K4U_8.0.0/com.ibm.websphere.edge.doc/lbip4/nd6mst08.html%23int?lang=en
comment on: http://stackoverflow.com/a/25211099
type: Comment

http://stackoverflow.com/comment/39295060
type: AnswerComment
has text: Yes, this was reason. Thanks :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25226992

http://stackoverflow.com/comment/39240333
comment on: http://stackoverflow.com/a/25184848
type: AnswerComment
score: 0
type: Comment
has text: I have a button when i clic at it i can choose the file to upload that is all and as i say before it works great with absolute url D:/....

http://stackoverflow.com/q/25226665
answer count: 1
has body: based on this answer, while I was looking for tut-install, I poked around in glassfish and found: thufir@dur:~$ thufir@dur:~$ ll glassfish4/samples/ejb/hello-stateless-ejb/hello-stateless-ejb-bean/src/main/java/enterprise/hello_stateless_ejb/StatelessSession.java In and of itself, the code is minimal: package enterprise.hello_stateless_ejb; import javax.ejb.Remote; @Remote public interface StatelessSession { public String hello(); } I would like to run this sample, there's a pom file. How can I load this project into glassfish? I was trying to load tut-install, which would also be useful. However, this example looks like, perhaps, a simpler version. A stateless "hello world" sample is where I would like to start, preferably just by loading the pom. I've glanced through some older EJB books, but they're woefully out of date; working code would be preferable. the pom is: 4.0.0 org.glassfish-samples ejb-samples 4.0-SNAPSHOT hello-stateless-ejb pom hello-stateless-ejb hello-stateless-ejb-bean hello-stateless-ejb-client
tagged with: glassfish
score: 0
tagged with: pom.xml
type: UnansweredQuestion
tagged with: maven
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/25111335
has answer: http://stackoverflow.com/a/25230389
tagged with: java
has title: load hello_stateless_ejb project from pom
type: Question
linked to: http://stackoverflow.com/q/10211826

http://stackoverflow.com/q/25137791
has comment: http://stackoverflow.com/comment/39248485
downvote count: 0
answer count: 1
tagged with: jsp
tagged with: tomcat
tagged with: struts2
has comment: http://stackoverflow.com/comment/39247296
favorite count: 0
has comment: http://stackoverflow.com/comment/39137252
has body: I am running a Struts2-JSP application on Tomcat-8.0. My Application is running well, but on Tomcat log it shows error on starting the application: 05-Aug-2014 11:34:10.953 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized() 05-Aug-2014 11:34:10.953 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized() 05-Aug-2014 12:00:04.993 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed() 05-Aug-2014 12:00:04.993 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed() 05-Aug-2014 12:00:14.872 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized() 05-Aug-2014 12:00:14.872 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized() 05-Aug-2014 12:01:32.369 SEVERE [http-nio-8084-exec-12] org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for servlet jsp threw exception java.lang.StackOverflowError And then it continues to print log infinitely until I stop the server Small part from the infinite stack trace: at javax.servlet.ServletRequestWrapper.getRequest(ServletRequestWrapper.java:54) at javax.servlet.http.HttpServletRequestWrapper._getHttpServletRequest(HttpServletRequestWrapper.java:49) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229) at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:562) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229) at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:562) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229) at org.apache.catalina.core.ApplicationHttpRequest.ge…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39131973
has comment: http://stackoverflow.com/comment/39157468
upvote count: 1
has title: java.lang.StackOverflowError thrown by tomcat
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39137445
has comment: http://stackoverflow.com/comment/39248602
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/25147003
has comment: http://stackoverflow.com/comment/39248374

http://stackoverflow.com/comment/39053157
has text: I am sorry. The question in the link you gave is about changing the device volume. I want to to change the mp3 file.
comment on: http://stackoverflow.com/q/25097065
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/39262677
type: Comment
type: QuestionComment
has text: @JeffStorey, it happens both when running from cmd line and from Jenkins. Thanks for reading/commenting. I'll post the pom in a sec too
score: 0
comment on: http://stackoverflow.com/q/25195214

http://stackoverflow.com/comment/39254327
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25142625
score: 0
has text: Not really. My list view has gotten even larger since this, and I am at 150 mb with visible out of memory errors. One compromise I had to fix was to rewrite my custom adapters getview method to reuse views and use the viewholder, but this was causing my list view to get out of order. To fix, I removed the two types of objects in my list view and made it one object, which cut memory by 30 mb. So no more out of memory, but still slow.

http://stackoverflow.com/comment/39015093
has text: Are the two packages running in the same JBoss instance? If so, you can only configure one debug port, but you'll be able to debug both applications using the same remote debug configuration.
comment on: http://stackoverflow.com/q/25072857
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39062826
type: Comment
comment on: http://stackoverflow.com/a/25085677
has text: We are here to help each other. As long as my answer solved your problem it makes me smile :)
score: 1
type: AnswerComment

http://stackoverflow.com/a/25138575
has body: It doesn't matter how object was created (directly using constructor, deserialized or via clone). If class of this object defines hashCode (or equals) that method will be used.
score: 0
answers question: http://stackoverflow.com/q/25138414
type: Answer

http://stackoverflow.com/a/25074717
type: Answer
has body: You can put your JSON file in the raw folder (res/raw) and load it with this code : InputStream inputStream = getResources().openRawResource(R.raw.foo); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } inputStream.close(); JSONArray jArray = new JSONArray(sb.toString()); Then you can use your knowledge to parse the JSONArray.
score: 0
answers question: http://stackoverflow.com/q/25074448
has comment: http://stackoverflow.com/comment/39011751

http://stackoverflow.com/q/25173618
has title: How to Create directory inside the path that has set?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39195922
has body: I have convert file into DBF format. But i must save that dbf file into specific folder which has generated when i create directory. The common coding just written like this import java.io.File; // demonstrates how to create a directory in java public class JavaCreateDirectoryExample { public static void main(String[] args) { File dir = new File("/Users/al/tmp/TestDirectory"); // attempt to create the directory here boolean successful = dir.mkdir(); if (successful) { // creating the directory succeeded System.out.println("directory was created successfully"); } else { // creating the directory failed System.out.println("failed trying to create the directory"); } } } But, i would like change "/Users/al/tmp/TestDirectory" into a dynamic state which i take it from the path JFileChooser that i've made. Is there any possibilities to make it done? Thanks a lot
has answer: http://stackoverflow.com/a/25176370
tagged with: dbf
tagged with: directory
has comment: http://stackoverflow.com/comment/39248192
type: Question
has answer: http://stackoverflow.com/a/25195553
has comment: http://stackoverflow.com/comment/39199000
has comment: http://stackoverflow.com/comment/39197442
score: 0
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/39199113
has comment: http://stackoverflow.com/comment/39200455

http://stackoverflow.com/comment/39288873
has text: The main parent could have the image as its background and the image views that show the image would be transparent, others would be what ever they are; right? Add black borders to the image views.
comment on: http://stackoverflow.com/q/25223811
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/73737287
type: AnswerComment
score: 0
has text: Dear Sir, according to this example: https://www.intertech.com/Blog/spring-frameworks-webdatabinder/ , you can infact register multiple custom editors.
type: Comment
comment on: http://stackoverflow.com/a/25654287

http://stackoverflow.com/q/25211002
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25211617
has title: Found some code for serialization of an ItemStack in Bukkit, how to deserialize it?
has body: I've dug up the following code for serializing an ItemStack in bukkit (Minecraft). I've been able to serialize an item in hand with the following: itemString = ItemStackUtils.deserialize(player.getInventory().getItemInHand()); I can't figure out how to utilize the deserial call however. What I am trying to do is to pull an item from the players hand, serialize it, stick it into a config file, then when the player runs another command... deserialize it and slap it into their inventory. I am fairly certain this class will meet my needs if I just can get the last part working. public final class ItemStackUtils { public static String getEnchants(ItemStack i){ List&lt;String&gt; e = new ArrayList&lt;String&gt;(); Map&lt;Enchantment, Integer&gt; en = i.getEnchantments(); for(Enchantment t : en.keySet()) { e.add(t.getName() + ":" + en.get(t)); } return StringUtils.join(e, ","); } public static String deserialize(ItemStack i){ String[] parts = new String[6]; parts[0] = i.getType().name(); parts[1] = Integer.toString(i.getAmount()); parts[2] = String.valueOf(i.getDurability()); parts[3] = i.getItemMeta().getDisplayName(); parts[4] = String.valueOf(i.getData().getData()); parts[5] = getEnchants(i); return StringUtils.join(parts, ";"); } public ItemStack deserial(String p){ String[] a = p.split(";"); ItemStack i = new ItemStack(Material.getMaterial(a[0]), Integer.parseInt(a[1])); i.setDurability((short) Integer.parseInt(a[2])); ItemMeta meta = i.getItemMeta(); meta.setDisplayName(a[3]); i.setItemMeta(meta); MaterialData data = i.getData(); data.setData((byte) Integer.parseInt(a[4])); i.setData(data); if (a.length &gt; 5) { String[] parts = a[5].split(","); for (String s : parts) { String label = s.split(":")[0]; String amplifier = s.split(":")[1]; Enchantment type = Enchantment.getByName(label); if (type == null) continue; int f; try { f = Integer.parseInt(amplifier); } catch(Exception ex) { continue; } i.addEnchantment(type, f); } } return i; } }
tagged with: java
tagged with: bukkit
has answer: http://stackoverflow.com/a/72630282
type: Question
answer count: 2
tagged with: minecraft
score: 0
upvote count: 1

http://stackoverflow.com/q/25172495
tagged with: recursion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25172601
tagged with: file
has title: Search for file of a specific pattern in a directory
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25172601
answer count: 1
has body: In Java, how do I check folders recursively for a file of a specific pattern? I've seen the below code in a lot of posts online: public static void findFiles() throws IOException { File dir = new File("."); FileFilter fileFilter = new WildcardFileFilter("*.txt"); File[] files = dir.listFiles(fileFilter); for (int i = 0; i &lt; files.length; i++) { System.out.println(files[i]); } } In my application, I basically need to check files matching *.txt in a user's home directory. Since the path will vary for each user, how do I use this code to search for a file matching a pattern anywhere on the filesystem?
has comment: http://stackoverflow.com/comment/39193543

http://stackoverflow.com/comment/39062528
type: AnswerComment
type: Comment
has text: Or in short in case of Integer and String as either one of the type is eligible to be 'null' hence the ambiguity is caused but in case of Object and String the ambiguity is there but as String can be labelled a "More Specific" type of "Object" hence as per the Java Spec you mentioned it's the one which gets picked up for execution. Please correct me if I am wrong!
score: 2
comment on: http://stackoverflow.com/a/25102035

http://stackoverflow.com/comment/40066924
type: QuestionComment
type: Comment
has text: Great 1.1.5 works as needed, thanks! I was on 1.1.4.
score: 0
comment on: http://stackoverflow.com/q/25148199

http://stackoverflow.com/comment/39230231
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25192282
has text: It is required for the FileReader to work correctly otherwise it won't build. @Kayaman I have read as much as I can but I learn best by doing but thank you very much for the heads up. I know how to set up a Try Catch just wasn't 100% which way to put the code.
type: Comment

http://stackoverflow.com/a/55668059
answers question: http://stackoverflow.com/q/25101534
has body: Check my blog Different ways to reduce apk size Main Points are : android.enableR8=true // enable New R8 Code Shrinker minifyEnabled true &amp;&amp; Add Proguard Rules Examine Your APK Using Android Studio’s APK Analyzer Enable Resource Shrinking Convert Your PNGs, JPEGs, and BMPs Into WebP Avoid enumerations and use @IntDef annotation Use aaptOptions { cruncherEnabled = false } to compress images Use Remove Unused Resources android studio built-in function to remove all the unused resources in the application Use Code Cleanup android studio built-in function to remove Note: Go enable it! (*just double and triple check everything works afterwards)
type: Answer
score: 0

http://stackoverflow.com/comment/39199685
has text: what error are you getting? Also there are many bugs in your code. 1. i<str.size() should be i<str.size()-1. 2. the variable i u are using for looping same variable you are assigning values too.
comment on: http://stackoverflow.com/q/25176033
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39124841
type: QuestionComment
has text: possible duplicate of [java, show JFrame in a specific screen in dual monitor configuration](http://stackoverflow.com/questions/4627553/java-show-jframe-in-a-specific-screen-in-dual-monitor-configuration)
comment on: http://stackoverflow.com/q/25135516
score: 0
type: Comment

http://stackoverflow.com/a/32433795
type: Answer
has body: following code is working for me : UserSearchManager usm = new UserSearchManager(connection); Form searchForm = usm.getSearchForm("search." + connection.getServiceName()); //Here i am searching for the service name Form answerForm = searchForm.createAnswerForm(); UserSearch userSearch = new UserSearch(); answerForm.setAnswer("Username", true); answerForm.setAnswer("search", "*"); ReportedData data = userSearch.sendSearchForm(connection, answerForm, "search." + connection.getServiceName()); if (data.getRows() != null) { System.out.println("not null"); Iterator&lt;ReportedData.Row&gt; it = data.getRows(); arryAllUsers.clear(); while (it.hasNext()) { //System.out.println("row"); ReportedData.Row row = it.next(); Iterator iterator = row.getValues("jid"); if (iterator.hasNext()) { String jid = iterator.next().toString(); //here i get all the user's of the open fire.. // l.add(value); } // Log.i("Iteartor values......"," "+value); } }
has comment: http://stackoverflow.com/comment/55794390
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/55215797
has comment: http://stackoverflow.com/comment/82005742
answers question: http://stackoverflow.com/q/25132437
upvote count: 3

http://stackoverflow.com/comment/39114931
has text: Use a different layout manager, maybe `GridBagLayout` for example. Take a look at [Laying Out Components Within a Container](http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html) for more details
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25130250

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
tags question: http://stackoverflow.com/q/25162131
type: Tag

http://stackoverflow.com/comment/39141892
type: Comment
has text: Thank you. But honestly, I am not planning to introduce a higher complexity into the solution. I can have up to 20 people hitting up the request at once and I want to the processing to be done in serial manner. Thus my orginal question, how can I queue them? Do I create a static Queue variable and access it (in a syncrohnized manner)?
comment on: http://stackoverflow.com/a/25131196
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39181582
has text: There is very little overhead in that code segment. A good JITC can probably get the cost to zero in many cases.
comment on: http://stackoverflow.com/q/25165981
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39146514
type: QuestionComment
comment on: http://stackoverflow.com/q/25147096
score: 3
has text: What are the exact command lines you used on unix?
type: Comment

http://stackoverflow.com/comment/39088354
comment on: http://stackoverflow.com/a/25115114
has text: Hi David, Just one more thing.. If I take any user from the list and set it in setServiceAccountUser(test1@xyz.com) . it gives me the error - Exception in thread "main" com.google.api.client.auth.oauth2.TokenResponseException: 403 Forbidden { "error" : "access_denied", "error_description" : "Requested client not authorized." } .. So how do we pass the token with the request here..
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/25203384
downvote count: 0
has comment: http://stackoverflow.com/comment/39284274
has body: This is a really nice use case for the EasyBind framework. You can just create a mapping from sortedList to dataSet and it will handle all the additions and deletions for you. The code would look something like ObservableList&lt;XYChart.Data&gt; dataSet = EasyBind.map(sortedList, this::makeChartData) ; // ... private XYChart.Data makeChartData(PlanItem planItem) { // Just return a XYChart.Data corresponding to planItem }
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25200704
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25200704

http://stackoverflow.com/q/25163054
type: Question
answer count: 1
tagged with: jsp
score: 0
has title: How to see "Process c=Runtime.getRuntime().exec( "java C:\\file");" output?
has answer: http://stackoverflow.com/a/25164158
has comment: http://stackoverflow.com/comment/39175568
has comment: http://stackoverflow.com/comment/39176116
accepted answer: http://stackoverflow.com/a/25164158
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39175970
has body: I am trying to exec class file(java class file) using process statement. But I am unable to figure out how to see output on screen.

http://stackoverflow.com/comment/39232362
has text: so when referring to this question, regarding an exponential condition where x^n, does n = the number of iterations?
type: AnswerComment
comment on: http://stackoverflow.com/a/25193501
score: 0
type: Comment

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/25197197
tags question: http://stackoverflow.com/q/25084331
tags question: http://stackoverflow.com/q/25129601
type: Tag

http://stackoverflow.com/comment/39329458
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25202623
has text: OK jaimin thank you for the code i paste it , but if you can test it with this url : bbqhmkcode.appspot.com/jsonservlet : and tell me if you got any result here: http://hmkcode.appspot.com/post-json/index.html , because i did and nothing was added ..

http://stackoverflow.com/q/25156974
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25158664
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39164595
has comment: http://stackoverflow.com/comment/39165436
tagged with: jsp
tagged with: tomcat
has title: ERROR : HTTP Status 500 - org.apache.jasper.JasperException, root cause : java.util.NoSuchElementException
has comment: http://stackoverflow.com/comment/39164182
type: Question
has comment: http://stackoverflow.com/comment/39164233
tagged with: java
score: 0
tagged with: web-applications
has body: org.apache.jasper.JasperException: An exception occurred processing JSP page /ShopLoginCheck2.jsp at line 60 57: &lt;br&gt; You have entered the wrong credentials! 58: &lt;br&gt; Press any key to go back to the Login page 59: &lt;% 60: String takeIn = sc.next(); 61: session.invalidate(); 62: response.sendRedirect("WelcomeShop.jsp"); 63: } In the above code, I am not able to proceed because of the shown error. Any suggestions to get rid of it? Am adding more code as asked : Scanner sc = new Scanner(System.in); String s_id_string=(String)request.getParameter("s_id"); int s_id=0; if(s_id_string !=null) { s_id = Integer.parseInt(s_id_string); } String s_name=(String)request.getParameter("s_name"); String s_password=(String)request.getParameter("s_password"); Statement stmt1 = con.createStatement(); ResultSet rs1 = stmt1.executeQuery("SELECT * FROM ShopSystem.Shop where s_id='"+s_id+"' AND s_name='"+s_name+"' AND s_password='"+s_password+"'"); if(rs1.next()) { if((s_id == rs1.getInt("s_id")) &amp;&amp; (s_name.equals(rs1.getString("s_name"))) &amp;&amp; (s_password.equals(rs1.getString("s_password")))) { session = request.getSession(); session.setAttribute("s_id", s_id); session.setAttribute("s_name", s_name); session.setAttribute("s_password", s_password); response.sendRedirect("ShopMenu3.jsp"); } } else { %&gt; &lt;br&gt; You have entered the wrong credentials! &lt;br&gt; Press any key to go back to the Login page &lt;% String takeIn = sc.next(); session.invalidate(); response.sendRedirect("WelcomeShop.jsp"); } sc.close(); And no I dnt intend to use takeIn in any way. sc is a Scanner object

http://stackoverflow.com/comment/39191152
type: Comment
has text: A few points, unless it's directly related to solving the problem. I would out your tips last, focus on solving the problem first, as I read about half it and thought, how is this an answer, in fact, only the last line is even close to solving the problem at hand. It's not that the tips aren't useful, but they are distracting people from the answer and puts your answer at the borderline of not been an answer, just saying ;)
comment on: http://stackoverflow.com/a/25170839
score: 0
type: AnswerComment

http://stackoverflow.com/a/25105306
score: 2
upvote count: 2
has body: The problem is a security check that is performed in that same constructor. Instead of throwing more precise exception it just throws the runtime exception: if (!JceSecurityManager.INSTANCE.isCallerTrusted()) { throw new NullPointerException(); } The code was taken from the GPL'ed source code of OpenJDK 7 starting at line 250. It should be the same for any Oracle version of Java SE. This is part of the requirement that a security provider needs to be signed before it can be used. To sign the provider you need to create code signing key pair and a certificate obtained from Oracle. To understand how to obtain one, please take a look at the technote: "How to Implement a Provider in the Java Cryptography Architecture". Note that many other classes can be extended, but they still cannot be part of a Provider in the list of trusted providers within the Security class (i.e. calling Signature.getInstance(String algorithm) will never return your implementation. Note that this restriction may not be present in other (unofficial) Java implementations.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25105305
type: Answer
answers question: http://stackoverflow.com/q/25105305

http://stackoverflow.com/a/71202366
score: 5
downvote count: 1
has comment: http://stackoverflow.com/comment/133371768
has body: IN 2022 use this! all other answers too old!!!!!!!!!!! result = "(123) 456-7890".replace(/[^+\d]+/g, "");
has comment: http://stackoverflow.com/comment/134620890
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/25089362

http://stackoverflow.com/a/25150482
type: Answer
has comment: http://stackoverflow.com/comment/39152547
downvote count: 0
answers question: http://stackoverflow.com/q/25150470
has comment: http://stackoverflow.com/comment/39152560
score: 1
accepted answer of: http://stackoverflow.com/q/25150470
has body: You need to POST your form data to a servlet which is mapped to particular URL for example /process and container will delegate that request to mapped Servlet See servlet info with example
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/39158248
score: 0
comment on: http://stackoverflow.com/q/25153391
type: Comment
type: QuestionComment
has text: You're about to hit another problem. Resources contained within the "source" package may not be available at runtime (depending on which IDE you use) or won't be accessible via the means you are using now. They should be loaded using `Class#getResource`

http://stackoverflow.com/a/25131810
type: AcceptedAnswer
downvote count: 0
has body: In your first java, there is only getter method and no setter method! private double latitude; private double longitude; private String address; public double getLatitude(){ return latitude; } public double getLongitude(){ return longitude; } public String getAlamat(){ return address; } /* THE BELOW SETTER METHODS ARE MISSING IN YOUR CODE.*/ public void setLatitude(double latitude){ this.latitude = latitude; } public void setLongitude(double longitude){ this.longitude=longitude; } public setAlamat(String address){ this.address=address; } At appropriate location (say whereever you get lat/long/address), add these lines. latitude = nwLocation.getLatitude(); setLatitude (latitude); longitude = nwLocation.getLongitude(); setLongitude (longitude);
has comment: http://stackoverflow.com/comment/39119147
type: Answer
has comment: http://stackoverflow.com/comment/39118720
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25131743
answers question: http://stackoverflow.com/q/25131743

http://stackoverflow.com/comment/39172965
has text: It is a problem of translation, and I corrected. When I change some value of the sectors are updated, but when I remove an item from the list and then update the site, is still listed as his child.
comment on: http://stackoverflow.com/q/25160879
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25137467
type: Question
possible better answer: http://stackoverflow.com/a/25138622
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25138622
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39129491
has comment: http://stackoverflow.com/comment/39129320
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25138639
tagged with: spring-batch
favorite count: 0
has title: How to launch a Spring Batch job after startup?
has comment: http://stackoverflow.com/comment/39129310
has body: How can I run a job configured using Spring-Batch right after application startup? Currently I'm specifying an exact time using cron job, but that requires to change the cron every time I restart the application: @JobRegistry, @Joblauncher and a Job. I execute the job as follows: @Scheduled(cron = "${my.cron}") public void launch() { launcher.run(job, params); }
accepted answer: http://stackoverflow.com/a/25138639
upvote count: 1
tagged with: spring

http://stackoverflow.com/q/25223599
type: UnansweredQuestion
tagged with: io
has answer: http://stackoverflow.com/a/25223756
has title: Java How to read/write files to/from any user's desktop
linked to: http://stackoverflow.com/q/17357554
score: 1
tagged with: java
tagged with: file
upvote count: 1
type: Question
tagged with: desktop
has body: I want to read a file from the user's desktop, and then write a new file to the desktop. Below is the code to do this on my own computer, but I'm not sure how to do it for any user. I found this previously-asked question, but I'm not sure how to implement such a method in Java. Would I possibly use the System.getProperty() method? Any help or advice is appreciated. Thanks! public static String [] read() { ArrayList&lt;String&gt; fileArrList = new ArrayList&lt;&gt;(); Scanner scan = new Scanner(System.in); System.out.print("File name &gt; "); String fileName = scan.nextLine(); try { Scanner file = new Scanner(new File("C:\\Users\\pez\\Desktop\\" + fileName)); while (file.hasNextLine()) { String line = file.nextLine(); fileArrList.add(line); } file.close(); String [] fileArr = new String[fileArrList.size()]; fileArr = fileArrList.toArray(fileArr); return fileArr; } catch (FileNotFoundException fnfe) { System.out.println("File not found"); } return null; } public static void writeNewFile(ArrayList outputArr) { try { FileOutputStream fos = new FileOutputStream("C:\\Users\\pez\\Desktop\\output.txt", false); PrintWriter pw = new PrintWriter(fos); for (Object i : outputArr) { pw.println(i); } pw.close(); } catch (FileNotFoundException fnfe) { } }
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25223806
favorite count: 0

http://stackoverflow.com/comment/39090649
comment on: http://stackoverflow.com/a/25116084
has text: no. still nothing. but i've just noticed the funny thing : i've run "df $EXTERNAL_STORAGE" and it points to the internal storage... and i get the 24gb... that are being faulty displayed as the external ones... i feel like dieing :(((
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25075504
answer count: 1
has title: java jLabel image does not update
tagged with: jlabel
type: UnansweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/39014400
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/50181065
tagged with: image
has comment: http://stackoverflow.com/comment/39013973
score: 0
has body: I'm creating a feedback label that displays the picture that the user has chosen in a file dialog. The moment when a picture file is selected, the label will update itself into that image of which the user has clicked. The first time when the picture is chosen it works fine, however when another picture is chosen for the 2nd time onwards, it remains as the first picture. Codes: private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { //browse button FileDialog fd = new FileDialog(this, "Choose a file", FileDialog.LOAD); fd.setDirectory("C:\\"); fd.setFile("*.jpg"); // jpg files only fd.setVisible(true); String filename = fd.getFile(); if (filename == null) { System.out.println("You cancelled the choice"); } else { savePicture("temp"); // save it in temp.jpg. This overwrites any existing picture. ImageIcon imgThisImg = null; imgThisImg = new ImageIcon(absfilePath+ "/temp.jpg"); jLabel7.setIcon(null); jLabel7.setIcon(imgThisImg); jLabel7.revalidate(); jLabel7.repaint(); } During debugging, the moment after savePicture() function is executed, the directory picture is updated. Therefore it's not an issue with overwritting the file. The file is overwritten correctly, why does it still display the previous image? Is there a cache or something that i need to clear? Thanks.

http://stackoverflow.com/q/25163172
has comment: http://stackoverflow.com/comment/39180185
tagged with: playframework
has comment: http://stackoverflow.com/comment/39203113
has comment: http://stackoverflow.com/comment/39179886
type: Question
tagged with: maven
has title: Dependency management with Heroku Java web apps
tagged with: heroku
tagged with: playframework-2.0
has body: I'm new to web apps, the play framework, heroku and dependency management. I've created a new Heroku Play framework based Java web app and I'm trying to install the dependencies for auth0 (https://addons.heroku.com/auth0#dev). The auth0 documentation (https://docs.auth0.com/#!/web/java) only documents how to add a dependency with Maven. There is no "pom.xml" file within the Heroku app files as I think is normally the case with Maven in a Java app. What really confuses me, is that in some areas on the Heroku documentation, it states that Maven is used by default for Java web apps, in other areas SBT, then within the project files there is a dependencies.yml file (under the conf directory). I'm really confused as to how dependencies in Heroku Play Java web apps are managed (if its Maven by default then where's the pom.xml file?) and how I add the dependencies for auth0 and some other .Jar files (like JSOUP). There is very little documentation or examples on the dependencies.yml file, whether it's supposed to replace/supplement something like Maven or SBT, or how to add to it. Does anyone know what the deal is with dependency management in Heroku?
has comment: http://stackoverflow.com/comment/39193483
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39193473
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25203256
answer count: 1
has body: I have a list of baskets. Each basket contains 30 items. I also have a list of purchase history containing items that was bought on a particular day, regardless of who bought it. The data looks like the following: Basket1: item1, item2, item3, item4 .. item30 Day1: item_x1, item_x2, item_x3 .... item_xn The total number of baskets is 4000. The total number of distinct items is 15000. I want to score each day based on the probability of baskets that dominate a particular day. p(basket_1|day_1) = p(basket1_item1|day_1) * p(basket1_item2|day_1) * p(basket1_item3|day_1) * ...* p(basket1_item30|day_1) ---&gt; (Formula 1) the probability of an item given a particular day is smoothed. In other words, must be calculated regardless of whether the item was bought at that particular day or not. This is done for all baskets over all days. I would like to speed up the processing time and my current approach is the following: 1- Score all items for each particular day (the 15000 items) regardless of whether they occur on that day or not. The number of items bought every day is smaller than this (800 items on average) but since all these calculation are needed I do them all once. 2- Iterate over each item (t) and do the following: a- Check for every basket (b) if that item is in it, if b contains t then: a.1 Update the basket by calculating Formula 1 above and don't check or do anything with this basket again. Items scores are stored in TObjectDoubleHashMap&lt;String&gt; itemScore; Baskets scores are stored in TObjectDoubleHashMap&lt;String&gt; basketScore; To update a basket, I do the following: Iterator&lt;String&gt; itr=baskets.get(basket).iterator(); String item=null; while(itr.hasNext()){ item=itr.next(); sum+= itemScore.get(item); } sum= sum / (baskets.get(basket).size() * 1.00d); basketScore.put(basket, sum); I'm curious if there is a more efficient method to do the update or tackle this task in general.
score: 0
has comment: http://stackoverflow.com/comment/39250164
tagged with: collections
type: Question
type: AnsweredQuestion
tagged with: algorithm
has comment: http://stackoverflow.com/comment/39250092
has answer: http://stackoverflow.com/a/25203426
tagged with: java
accepted answer: http://stackoverflow.com/a/25203426
has title: Scalable update of java collections
tagged with: scalability

http://stackoverflow.com/comment/39303940
type: Comment
score: 1
has text: There are some problems with this code: you are using both classes that have been deprecated in JavaFX 8 (the builder classes), and classes that are not part of the public API (`PropertyReference`, for example), which could well be removed in future releases.
type: AnswerComment
comment on: http://stackoverflow.com/a/25229736

http://stackoverflow.com/a/25080750
accepted answer of: http://stackoverflow.com/q/25080678
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/39023685
upvote count: 1
has body: This: Object ob = new Object(); spr = ImageIO.read(ob.getClass().getResourceAsStream(fileName)); You probably want to load the image from the same location your code originates from (e.g. a jar file). Instead you ask java.lang.Object.class to give back the stream of the image which is probably not you want (this would search the filename resource in the internal libraries of the JRE or JDK - more specifically in the rt.jar file). If indeed you want to load the image from the same jar your class files originates from, you should acquire the stream like this: InputStream in = YourClass.class.getResourceAsStream(filename); You should pass this InputStream to your loadAnimation() method, or pass both the Class along with the file name to be used to get the stream of the image.
answers question: http://stackoverflow.com/q/25080678
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39302666
comment on: http://stackoverflow.com/q/25229880
has text: OT but normally you don't need to send an entity with a DELETE [because](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7) "The DELETE method requests that the origin server delete the resource identified by the Request-URI". Your method reference sounds more like updating a reference then deleting a resource.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/39123202
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25134848
has text: I have just added this to the question now.

http://stackoverflow.com/comment/39190163
comment on: http://stackoverflow.com/q/25168332
type: Comment
type: QuestionComment
score: 0
has text: @mKorbel Perhaps you could write an answer? I looked at NavigationFilter, but it doesn't seem to prevent keyboard driven manipulation of the caret.

http://stackoverflow.com/q/25081172
has comment: http://stackoverflow.com/comment/39023319
has title: Web Service can't be accessed in Java code, but its wsdl can be normally seen from Chrome
tagged with: web-services
has comment: http://stackoverflow.com/comment/39023015
tagged with: java
has answer: http://stackoverflow.com/a/25081540
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39023091
has answer: http://stackoverflow.com/a/34349657
has body: everybody! I encountered a very strange problem. I have wrote one web service example in Netbeans. In the Netbeans IDE, the web service client and the web service run fluently, if a little slowly. But after being deployed at Tomcat 7.0, the web service can't be assessed normally by the client. The url for wsdl is http://221.207.220.12:7001/InterWebService/InterService.wsdl?wsdl, which can be seen through Chrome. Following are the exception information: Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: java.net.ConnectException: Connection timed out: connect at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:117) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:208) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130) at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95) at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:1121) at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:1035) at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:1004) at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:862) at com.sun.xml.internal.ws.client.Stub.process(Stub.java:448) at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:178) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:93) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147) at com.sun.proxy.$Proxy32.news(Unknown Source) at Main.news(Main.java:19) at Main.main(Main.java:13) Caused by: java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketI…
has comment: http://stackoverflow.com/comment/39023124
score: 0
has comment: http://stackoverflow.com/comment/39023045
has comment: http://stackoverflow.com/comment/39023523
has comment: http://stackoverflow.com/comment/39023190
tagged with: wsdl
tagged with: soap
tagged with: netbeans
has comment: http://stackoverflow.com/comment/39022927
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39022972

http://stackoverflow.com/q/25191697
answer count: 3
has comment: http://stackoverflow.com/comment/39229152
has comment: http://stackoverflow.com/comment/39229053
tagged with: variables
has answer: http://stackoverflow.com/a/25191799
has body: My Idea is to give the User a chance to store a value (in my case an int how broad the JFrame should be, so that the next time he starts my .jar, I can make it that broad from beginning on and he hasn't got to resize it again). As it is only one single value, I would not like to have to write it into a separate file etc., so is there an elegant way, sth. like a variable more "hard code" than usual? And Yes, I used the Searchbar of my browser, but I had no Idea what to search for...
has answer: http://stackoverflow.com/a/25191771
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
linked to: http://stackoverflow.com/q/16627648
type: Question
has answer: http://stackoverflow.com/a/25191735
has title: How to store a variable in Java, so i can use it the next time i start my .jar?
upvote count: 1
duplicate of: http://stackoverflow.com/q/16627648
has comment: http://stackoverflow.com/comment/39229061
accepted answer: http://stackoverflow.com/a/25191771
possible better answer: http://stackoverflow.com/a/25191735
linked to: http://stackoverflow.com/q/333363
tagged with: java

http://stackoverflow.com/a/25108175
has comment: http://stackoverflow.com/comment/39293246
score: 0
answers question: http://stackoverflow.com/q/25105691
accepted answer of: http://stackoverflow.com/q/25105691
type: AcceptedAnswer
has body: Save them in a local database using SQLite and then reload them back into the listview when the user opens that activity again. I made a blog post recently on using SQLite within Android. It can be found here
type: Answer

http://stackoverflow.com/comment/89208704
has text: The `Launch Configuration` setting is blank, so there is nothing I can choose. What do I do?
type: Comment
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/25114143

http://stackoverflow.com/comment/39031984
comment on: http://stackoverflow.com/q/25085569
has text: It's saying you don't have rJava (or at least don't have it for the x64 arch). Did you think you did?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39289923
comment on: http://stackoverflow.com/q/25224275
type: Comment
type: QuestionComment
has text: Brute force algorithms remind me of a man taking down a wall with a sledgehammer because he doesn't like the paint color, and for good reason. Brute force algorithms literally try EVERY possibility until one of them works, comparable to throwing a deck of cards in the air, picking it up, and if it isn't completely in order, throw it again. (The basis behind bogosort as a matter of fact.)
score: 0

http://stackoverflow.com/q/25079760
downvote count: 1
has title: change ActionBar layout when click on button
type: Question
has answer: http://stackoverflow.com/a/25079827
accepted answer: http://stackoverflow.com/a/25079827
score: -1
answer count: 1
favorite count: 0
has body: I want to change my actionbar for an actionbar with custom layout when i click on a button. I don't have found solution. I tried getActionBar().setCustomView(R.layout.actionbar_layout); but it does not work. Thx for your help !
tagged with: android-actionbar
type: AnsweredQuestion
upvote count: 0
tagged with: java

http://stackoverflow.com/a/25092327
type: Answer
answers question: http://stackoverflow.com/q/25092316
has body: Try this: Cmember cm=null; Vipmember vip=null; if(sel==1){ ... cm = new Cmember(Name,Hpnum,age,CompanyName); } else{ ... vip = new Vipmember(Name,Hpnum,age,email); } if(sel==1){ r[i]=new RegMember(cm); } else{ r[i]=new RegMember(vip); } s.nextLine(); Basically, cm and vip were not in the scope when you were trying to use them
score: 0

http://stackoverflow.com/q/25215320
type: UnansweredQuestion
tagged with: google-app-engine
linked to: http://stackoverflow.com/q/18703212
upvote count: 1
has answer: http://stackoverflow.com/a/25225310
tagged with: java
type: Question
answer count: 2
tagged with: api
downvote count: 0
tagged with: google-cloud-sql
score: 1
has body: I am developing google endpoint API in that I got only POJO class response from API method.so how can I get String or Integer,Float,boolean response from google endpoint API method?
favorite count: 0
has title: generate String response from endpoints API method(java)
has answer: http://stackoverflow.com/a/25215372

http://stackoverflow.com/comment/39158207
type: Comment
has text: Yes, actually you do not need to call `getToken()` at any point. You can just make use of these wrappers to make Google API's call. API will automatically request token on behalf of user, if its not there and persist it. It will re-obtain it automatically once its expires, if the user has already authorized the app.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25153178

http://stackoverflow.com/q/25197779
linked to: http://stackoverflow.com/q/23341866
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25197988
tagged with: java
score: -1
type: Question
has body: i have custom list adapter with checkboxes i want to remove list items on checked items . when removing item of listview after coming to this fragment deleted item coming back to the listview. and next problem when checked item( this problem for clicking in body list view not not clicking on checkbox) for deleting all item checked not together deleting most clicking More than once deleting buttons. any person help me i enjoyed. my fragment listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); listView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { chk = (CheckBox) view.findViewById(R.id.checkBox6); chk.toggle(); } }); Button btn = (Button) view.findViewById(R.id.button1); btn.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { for (int i = 0; i &lt; list.size()/*this is the original model*/; i++) { if(list.get(i).isSelected()==true){ adapter.remove(list.get(i)); } } adapter.notifyDataSetChanged(); } }) listadapter public class ListAdapter extends BaseAdapter { private final String TAG = "*** ListAdapter ***"; Context context; LayoutInflater myInflater; List&lt;contac&gt; list; CheckBox checkBox6; public ListAdapter(Context context) { super(); myInflater = LayoutInflater.from(context); this.context = context; Log.i(TAG, "Adapter setuped successfully."); } public void remove(contac object) { list.remove(object); notifyDataSetChanged(); } public void setData(List&lt;contac&gt; list) { this.list = list; Log.i(TAG, "Data passed to the adapter."); } @Override public int getCount() { return list.size(); } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { final ViewHolder holder; if (convertView == null) { convertView = myInflater.inflate(R.layout.list_adapter, nul…
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25197988
favorite count: 0
has title: removing item from ListView
tagged with: android
downvote count: 1

http://stackoverflow.com/comment/39205060
has text: you mean add the full code?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25179163

http://stackoverflow.com/a/25086451
has body: Since the parent can't instantiate the child directly (because it doesn't "know" it) you can use reflection to do it: class Thing { protected int a; protected int b; public void setB(int b) { this.b = b; } public void setA(int a) { this.a = a; } public Thing(){} public Thing(int a, int b) { this.a = a; this.b = b; } Thing copy() { // adding a copy method return new Thing(a, b); } public Thing transform() throws IllegalAccessException, InstantiationException { // Thing result = (Thing)this.getClass().newInstance(); // one way to do it (reflection) Thing result = copy(); // a better way to do it result.setA(a); result.setB(b+1); return result; } public static void main(String[] args) throws InstantiationException, IllegalAccessException { ThreeThing x = new ThreeThing(1); System.out.println(x.a + " : " + x.b); Thing y = x.transform(); System.out.println(y.a + " : " + y.b); } } class ThreeThing extends Thing { public ThreeThing(){} ThreeThing(int b) { this.a = 3; this.b = b; } @Override Thing copy() { // adding a copy method return new ThreeThing(b); } } That said, it's better to avoid using newInstance() and if you find yourself using it - you might want to back up a few steps and check the overall design and see if it can be improved. As an example, I added a copy() method which should be overridden in the child classes.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39034438
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25086216
accepted answer of: http://stackoverflow.com/q/25086216
has comment: http://stackoverflow.com/comment/39035095

http://stackoverflow.com/comment/39180431
has text: It is not said how precisely the function is called. But what's sure is that the function may be called even if a view was already generated for an item at some position. Old views are dropped. To prevent to much garbage collection, the method includes possibility of recycling old views (see `convertView`).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25163506
type: Comment

jetty
tags question: http://stackoverflow.com/q/25127982
tag name: jetty
tags question: http://stackoverflow.com/q/25129576
tags question: http://stackoverflow.com/q/25157186
tags question: http://stackoverflow.com/q/25180070
tags question: http://stackoverflow.com/q/25124485
tags question: http://stackoverflow.com/q/25204183
tags question: http://stackoverflow.com/q/25132196
tags question: http://stackoverflow.com/q/25192001
tags question: http://stackoverflow.com/q/25131505
type: Tag
tags question: http://stackoverflow.com/q/25195128
tags question: http://stackoverflow.com/q/25138517
tags question: http://stackoverflow.com/q/25100128
tags question: http://stackoverflow.com/q/25070639
tags question: http://stackoverflow.com/q/25149600

http://stackoverflow.com/comment/39289609
type: QuestionComment
comment on: http://stackoverflow.com/q/25222406
has text: @owlstead The relationship question is one that has answers that directly pertain to this one. Further understanding can be found by following those dups. The accepted answer to that question would be an answer to this one. The question "overriding equals and hashCode in Java" was originally the dup target, however that got reopened because its not an exact duplicate.
score: 0
type: Comment

http://stackoverflow.com/comment/39245939
type: Comment
comment on: http://stackoverflow.com/a/25199822
has text: But my URL is http://localhost:8080/myapp/Education.html not http://localhost/myapp/Education.html. When i'm passing the URL :-http://localhost/myapp/Education.html not works fine. Actually i have added it into pom.xml file
type: AnswerComment
score: 0

http://stackoverflow.com/q/25085353
upvote count: 3
has body: I am facing an issue while marshalling a java class. In code snippet 1, Class A use List whereas snippet 2 has List<B<? extends C>>. Code snippet 1 produces <?xml version="1.0" encoding="UTF-8" standalone="yes"?> Success!! whereas snippet 2 is missing data inside Class C <?xml version="1.0" encoding="UTF-8" standalone="yes"?> Can someone please help me resolve this? Snippet 1: public class JaxBXMLTest { @Test public void testMarshalling() throws JAXBException{ testBaseClass(); } private void testBaseClass() throws JAXBException{ A resp = new A(); C test = new C(); test.setName("Success!!"); List data = new ArrayList(); B wrap = new B(); wrap.setItem(test); data.add(wrap); resp.setTest(data); JAXBContext context = JAXBContext.newInstance(A.class); Marshaller m = context.createMarshaller(); //for pretty-print XML in JAXB // Write to System.out for debugging m.marshal(resp, System.out); } @XmlRootElement @XmlType(name = "MyResponse") public static class A{ List test; public List getTest() { return test; } public void setTest(List test) { this.test = test; } } public static class B{ private C item; public C getItem() { return item; } public void setItem(C item) { this.item = item; } } public static class C{ private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } } Snippet 2: public class JaxBXMLTestB { @Test public void testMarshalling() throws JAXBException { testSubClass(); } private void testSubClass() throws JAXBException { A resp = new A(); C test = new C(); test.setName("Failure!!!"); B<? extends C> wrap = new B<C>(); wrap.setItem(test); List<B<? extends C>> finalObj = new ArrayList<B<? extends C>>(); finalObj.add(wrap); resp.setTest(finalObj); JAXBContext context = JAXBContext.newInstance(A.class); Marshaller m = context.createMarshaller(); // for pretty-print XML in JAXB // m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // Write to System.out for debugging m.marshal(resp, System.out);…
answer count: 1
tagged with: generics
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has title: JaxB marshalling wildcard generics extended class
type: AnsweredQuestion
score: 3
downvote count: 0
linked to: http://stackoverflow.com/q/2723397
tagged with: java
tagged with: jaxb
type: Question
has answer: http://stackoverflow.com/a/26247319
accepted answer: http://stackoverflow.com/a/26247319

http://stackoverflow.com/comment/39129804
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25138414
has text: ah ok... i thought you meant the methods are written in a file. that's why i was confused.

http://stackoverflow.com/q/25214765
tagged with: spring
possible better answer: http://stackoverflow.com/a/25216191
has answer: http://stackoverflow.com/a/25216191
type: AnsweredQuestion
score: 1
tagged with: hibernate-cache
tagged with: java
tagged with: hibernate
has title: Hibernate caches the query while data is being changed
has answer: http://stackoverflow.com/a/25231824
type: Question
answer count: 2
downvote count: 0
tagged with: caching
accepted answer: http://stackoverflow.com/a/25231824
favorite count: 0
has body: I'm developing an application which connects to an outside service to fetch new SMS. Theses messages are stored in a local database by Hibernate. My client can search these messages based on numerous parameters such as time, number, and etc. After calling the search method with a list of parameters called 'List1', I get the desired result without any problems. Though while I'm waiting for this result a new message has arrived. Soon after, I call the search method with same parameter list again and I'm expecting to get the new message as well, but I get the previous result. I have checked my database and the new message is present so all I can think of is Hibernate caching. Since both queries are exactly the same, I guess hibernate return the same result set as before. In case my assumption is correct, how can I overcome this problem? If not, so what exactly is going on? Edit here is relevant part of my source code. Following two methods will be invoked when client initiates a search request: smsService.refresh(); JSONArray result = smsService.retrieveMessages(...); @Transactional public JSONArray retrieveMessages(Long periodBegining, Long periodEnd, String order, Integer limit, String profile, Boolean unread, String correspondent) { List&lt;ShortMessage&gt; messageList = shortMessageDAO.find(beginDate, endDate, order, limit, profile, unread, correspondent); JSONArray result = new JSONArray(); for (ShortMessage message : messageList) result.put(message.toJSON()); shortMessageDAO.markRead(messageList); return result; } @Transactional public void refresh() { webService.authentication(serviceUsername, servicePassword); while(webService.hasUnread() &gt; 0) { SMS sms = webService.retrieveMessage(); ShortMessage message = new ShortMessage(sms.getHash(), sms.getFrom(), sms.getTo(), "DEFAULT", sms.getMessage(), new Date(sms.getTime()), true); shortMessageDAO.insert(message); } } } public List&lt;ShortMessage&gt; find(Date beginDate, Date endDate, String order, Integer limit,…
upvote count: 1

http://stackoverflow.com/comment/39090633
type: Comment
comment on: http://stackoverflow.com/a/25117271
type: AnswerComment
has text: Yes , because I dont knw what are the fields in class, if it is of JLabel and JButton , I want to translate them to french language.
score: 0

http://stackoverflow.com/q/25143666
has title: Java Logger FileHandler naming convention
tagged with: logging
has answer: http://stackoverflow.com/a/25144921
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25144921
type: Question
has answer: http://stackoverflow.com/a/25165871
accepted answer: http://stackoverflow.com/a/25165871
score: 0
answer count: 2
has body: I have a servlet deployed. I am a little confused about the log files being generated. particularly i am not sure which one to look at. There are several generated with the same data. I am using the following code to initialize my Filehandler. Logger logger = Logger.getLogger(Global.TAG); String path = realPath + "myappname" + ".%g.log"; FileHandler fh = new FileHandler(path, 10240000, 1000, true); logger.addHandler(fh); logger.setLevel(Level.ALL); SimpleFormatter formatter = new SimpleFormatter(); fh.setFormatter(formatter); logInfo("Logger Configured!"); Notice that i have %g in there for when files are rotated. The files generated are something like this. myappname.0.log myappname.0.log.1 myappname.0.log.2 myappname.0.log.3 myappname.0.log.4 myappname.0.log.5 myappname.0.log.6 myappname.1.log myappname.1.log.2 myappname.1.log.4 myappname.1.log.5 myappname.2.log myappname.2.log.1 myappname.2.log.2 myappname.2.log.3 myappname.2.log.4 myappname.2.log.5 myappname.2.log.6 myappname.3.log myappname.3.log.1 myappname.3.log.3 myappname.3.log.6 The servlet was undeployed and redeployed several times in the last 2-3 weeks in which the logs were generated. What i have noticed is that logs with the same name (except the last bit after the ".log" part) have the same logging statements. Some files have more and some less. What gives? How should i be reading this?
tagged with: filehandler

javac
tags question: http://stackoverflow.com/q/25123432
tags question: http://stackoverflow.com/q/25146628
tag name: javac
tags question: http://stackoverflow.com/q/25190374
type: Tag
tags question: http://stackoverflow.com/q/25071623
tags question: http://stackoverflow.com/q/25158340
tags question: http://stackoverflow.com/q/25147096
tags question: http://stackoverflow.com/q/25116532
tags question: http://stackoverflow.com/q/25227704
tags question: http://stackoverflow.com/q/25098026

data-structures
tags question: http://stackoverflow.com/q/25164868
tag name: data-structures
tags question: http://stackoverflow.com/q/25077543
tags question: http://stackoverflow.com/q/25215865
tags question: http://stackoverflow.com/q/25195319
tags question: http://stackoverflow.com/q/25177379
tags question: http://stackoverflow.com/q/25172195
tags question: http://stackoverflow.com/q/25131530
tags question: http://stackoverflow.com/q/25226721
type: Tag
tags question: http://stackoverflow.com/q/25125940

http://stackoverflow.com/a/31717048
type: Answer
has comment: http://stackoverflow.com/comment/51372128
has body: In short, consider this: Input: {(a:1),(b:2),(c:2),(a:3),(b:2),(c:3)} Pass it to reduceByKey. Output: {(a:4),(b:4),(c:5)}
downvote count: 3
answers question: http://stackoverflow.com/q/25091091
upvote count: 0
score: -3

http://stackoverflow.com/comment/39241719
type: Comment
has text: Read the question. can you see a real question here?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25198668

http://stackoverflow.com/comment/105567125
type: Comment
has text: With springboot 2 this should now implement WebMvcConfigurer as WebMvcConfigurerAdaptor is deprecated. The rest remains the same.
type: AnswerComment
comment on: http://stackoverflow.com/a/25219142
score: 0

http://stackoverflow.com/comment/39193003
comment on: http://stackoverflow.com/q/25172178
score: 0
has text: Are you using any native (jni) libraries?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39050837
type: QuestionComment
score: 0
has text: Are you able to use batch inserts with PreparedStatement? A little more info: http://stackoverflow.com/questions/6892105/bulk-insert-in-java-using-prepared-statements-batch-update
comment on: http://stackoverflow.com/q/25095868
type: Comment

http://stackoverflow.com/q/25200310
downvote count: 1
type: Question
score: -1
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39257118
has answer: http://stackoverflow.com/a/25206543
type: UnansweredQuestion
has title: Understanding criteria in hibernate
has comment: http://stackoverflow.com/comment/39257272
has comment: http://stackoverflow.com/comment/39256564
tagged with: java
tagged with: hibernate
has body: Could you possibly explain what exact Criteria object represents in Hibernate? I have read Criteria API documentation and haven't understood general purpose of that object. What exact information is contained in the Criteria instance? Consider the following code example: @Entity @Table(name = "partner.partner_statistic") public class PartnerStatistic { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private int id; @Column(name = "partner_id") private Integer partnerId; //Getters, Setters } We have created Criteria object by the invocation of Session.createCriteria(PartnerStatistics.class);. What information is assembled in the object that we've created? Does criteria query act likes Builder design pattern for the query?

http://stackoverflow.com/comment/39010030
type: AnswerComment
comment on: http://stackoverflow.com/a/25074175
type: Comment
score: 1
has text: It would be a better program with this change. However, I tested it, and this change is not sufficient to make the program work. Without the `volatile` keyword a thread can go on working with an old Integer instance without notices that the variable has changed. With the `volatile` keyword, each thread sees each change in `i`, and at any given stage they are all synchronizing on the same variable.

http://stackoverflow.com/comment/39159168
has text: with this you just instantiated MassSMSRunnable, you need to also inject the dependencies massSMSForm and username
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25140961
type: AnswerComment

http://stackoverflow.com/comment/39208882
comment on: http://stackoverflow.com/a/25181408
type: Comment
score: 0
type: AnswerComment
has text: When I posted this comment my page refreshed almost instantly (maximum 2 seconds) and then I had the first downvote... Is this some sort of automated system? Or, if someone actually read the post in 1½ seconds flat and decided it was worth a downvote, could you please explain why?

http://stackoverflow.com/q/25108655
has title: Can't read data from a file in java
type: Question
has comment: http://stackoverflow.com/comment/39076155
has comment: http://stackoverflow.com/comment/39074668
linked to: http://stackoverflow.com/q/16265693
has comment: http://stackoverflow.com/comment/39074507
has comment: http://stackoverflow.com/comment/39074428
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39074685
has comment: http://stackoverflow.com/comment/39074929
favorite count: 0
tagged with: file-io
has comment: http://stackoverflow.com/comment/39076240
has body: Here is the problem I want to solve https://www.codeeval.com/open_challenges/100/ and here is my solution: public static void main(String[] args) { // TODO code application File file = null; try{ FileReader f = new FileReader("C:\\Users\\ranaa\\Desktop\\merna1.txt"); BufferedReader br = new BufferedReader(f); String getContent; while((getContent=br.readLine())!=null){ int content = Integer.parseInt(getContent); System.out.println(content); if(content %2==0) System.out.println("1"); else System.out.println("0"); } }catch(Exception e){ System.out.println(e); } } no output appears to me nor exception. Can anybody help me?
score: -3
linked to: http://stackoverflow.com/q/11871520
has comment: http://stackoverflow.com/comment/39074786
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25109511
has comment: http://stackoverflow.com/comment/39074691
downvote count: 3
has comment: http://stackoverflow.com/comment/39074458
has comment: http://stackoverflow.com/comment/39078110
has comment: http://stackoverflow.com/comment/39074482
has comment: http://stackoverflow.com/comment/39074483
tagged with: java
has comment: http://stackoverflow.com/comment/39074831

http://stackoverflow.com/comment/39160432
type: QuestionComment
type: Comment
has text: Are you consistently getting these results?
comment on: http://stackoverflow.com/q/25154899
score: 0

http://stackoverflow.com/comment/39306884
type: AnswerComment
score: 0
has text: Sorry, I wasn't sure with your question. Try this tutorial by Vogella, they make great tutorials! http://www.vogella.com/tutorials/AndroidLiveWallpaper/article.html
type: Comment
comment on: http://stackoverflow.com/a/25227885

http://stackoverflow.com/comment/39010921
comment on: http://stackoverflow.com/q/25074586
score: 0
type: Comment
type: QuestionComment
has text: Chrome Penguin Studios the idea is that i cant use them at 1st session of app , only after i restart my app

http://stackoverflow.com/a/25179443
has body: My understanding about "inflating" is "reading" a resource file (a XML file which describes a layout or GUI element) and "creating" the actual objects that correspond to it; this will make the menu object visible within an Android application. MenuInflater class represents an Android framework class specialized in parsing and constructing menus from menu resource files. Have a look at: Build Menus in Android with Java and XML: Introduction From the article: Once the menu resource file (my_menu.xml) is ready and has all the items you intend to add, you can use MenuInflater to override the function onCreateOptionsMenu. This function is supposed to fill the menu object with the desired menu items, but Android’s MenuInflater class helps you create menu items from the XML resource mentioned above
upvote count: 6
answers question: http://stackoverflow.com/q/25179055
type: Answer
downvote count: 0
score: 6

http://stackoverflow.com/q/25128344
has body: I am building an Android app and I need to show a very simple monthly calendar (with next and previous month links). And, if possible, display events on some days. I have search, high and low, for a solution but found nothing. Isn´t there a very simple way of doing this? All the widgets I find got too much features.
has comment: http://stackoverflow.com/comment/39111901
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25128578
tagged with: android
has title: How to display a simple monthly calendar
has comment: http://stackoverflow.com/comment/39111723
has comment: http://stackoverflow.com/comment/39111841
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25129129
type: Question

http://stackoverflow.com/comment/39171662
type: Comment
comment on: http://stackoverflow.com/a/25160956
score: 0
type: AnswerComment
has text: What to do to get 2 inside <>

http://stackoverflow.com/comment/67795094
type: AnswerComment
score: 0
has text: The escape character was killing me...in windows was working flawlessly Thanks.
type: Comment
comment on: http://stackoverflow.com/a/25201551

http://stackoverflow.com/comment/39043733
type: AnswerComment
score: 0
type: Comment
has text: this is my controller `@RequestMapping(value = {"/report_emp"}) public String reportTest(Model model) {return null;}`
comment on: http://stackoverflow.com/a/25091839

http://stackoverflow.com/comment/39248604
comment on: http://stackoverflow.com/a/25202367
score: 1
type: AnswerComment
type: Comment
has text: please, check my updated answer, tried your solution

custom-exceptions
type: Tag
tags question: http://stackoverflow.com/q/25223496
tag name: custom-exceptions
tags question: http://stackoverflow.com/q/25084990

http://stackoverflow.com/a/25136146
upvote count: 4
score: 4
downvote count: 0
has body: To compare Strings you have to use the .equals(String) function. A String is an Object, therefore the == does compare the object reference of the two Strings . But what you want is to compare the String value. You should use if ( "".equals(get) ) System.out.println("Is not empty");
answers question: http://stackoverflow.com/q/25136103
type: Answer

http://stackoverflow.com/comment/39091772
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25117834
has text: Maybe this is also a part of your solution: http://stackoverflow.com/questions/18144131/loading-resources-with-filemanager-doesnt-work-in-jena-2-10-1
score: 0

http://stackoverflow.com/a/25156556
has body: The straightforward thing to do would be to evade the overcomplicated middleware. public List&lt;Map&lt;String, Object&gt;&gt; valueList(String dataSource, Object[] params, String sql) throws DataAccessException { Connection con = null; PreparedStatement ps = null; ResultSet rs = null; Clob clob = null; try { con = dataSource.getConnection(); ps = con.prepareStatement( "SELECT samplefield FROM sampletable WHERE SDE.ST_INTERSECTS(SHAPE, SDE.ST_GEOMETRY(?, ?)) = 1 AND SHAPE IS NOT NULL" ); // probably externalize this SQL string somewhere // Note that Oracle's two-arg ST_GEOMETRY function takes a CLOB and an INTEGER // see http://resources.arcgis.com/en/help/main/10.1/index.html#//006z00000050000000 Clob clob = OracleUtils.createTemporaryCLOB(conn, true, 10); clob.setString(1, (String) params[0]); ps.setClob( 1, clob ); ps.setObject( 2, params[1], java.sql.Types.INTEGER ); rs = ps.executeQuery(); // inefficient and overdone output format, but hey. List&lt;Map&lt;String,Object&gt;&gt; out = new LinkedList() while (rs.next()) { Map&lt;String,Object&gt; oneBindingMap = new HashMap(1); oneBindingMap.put("samplefield", rs.getObject(1)); //again, maybe externalize the field name out.add( oneBindingMap ); } return out; } catch ( SQLException e ) { throw new DataAccessException( e.getMessage(), e ); // adapt to expected Exception type } finally { try { if ( clob != null ) clob.free(); } catch ( Exception e ) { e.printStackTrace(); } // in java 7+ you could avoid the rest of this via the try-with-resources construct try { if ( rs != null ) rs.close(); } catch ( Exception e ) { e.printStackTrace(); } try { if ( ps != null ) ps.close(); } catch ( Exception e ) { e.printStackTrace(); } try { if ( con != null ) con.close(); } catch ( Exception e ) { e.printStackTrace(); } } } I'm just typing this into a web page; I've not tested whether it compiles, and I'm making some assumptions about the semantics you want (e.g. the format and key name in the output maps). But I think that this…
answers question: http://stackoverflow.com/q/25152875
has comment: http://stackoverflow.com/comment/39191380
accepted answer of: http://stackoverflow.com/q/25152875
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/39224152
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25189146
has text: yes entries have id. The issue is not about last entry, it is about any missed entry. Even if i go with this approach, due to some reason i missed a entry which was suppose to come in between, then how can i make system fool proof, so that it corrects all entries which were missed but exist in between. Thanks for suggestion.

http://stackoverflow.com/a/65641601
score: 0
answers question: http://stackoverflow.com/q/25229880
type: Answer
has body: I used also RESTeasy Jersey client and worked for my: Response response = client.target(yourUrlToCall).request(MediaType.APPLICATION_JSON) .build("DELETE", Entity.entity(yourJsonDTO, MediaType.APPLICATION_JSON)).invoke(); Is very usefull to solve some complex scenarios that are not "allowed" by normal usage of get(), delete(), etc.

http://stackoverflow.com/comment/39295258
comment on: http://stackoverflow.com/q/25227197
score: 0
has text: Ok... So how can I refresh the ResultSet?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39120749
type: AnswerComment
type: Comment
has text: The problem is at `<spring:message message="${item.value}"/>`. there is no message for `Company: ABC COMPANY for Metal: A Exists` key. Better to share `messages.properties` as well.
comment on: http://stackoverflow.com/a/25132917
score: 0

http://stackoverflow.com/comment/39169572
comment on: http://stackoverflow.com/q/25159166
score: 0
type: Comment
type: QuestionComment
has text: You will have to change your class so that it has `serialVersionUID=0L` and re-release your app. Unless proguard has renamed different class before to `com.rio.g.l` and different class now. You should add classes that you serialize -> deserialize to be skipped by proguard.

http://stackoverflow.com/comment/39096134
has text: @LinkTheProgrammer Suit yourself. You have an incredible amount of reinventing the wheel ahead of you. Note as stated in http://en.wikipedia.org/wiki/Java_3D that Java3d is implemented over OpenGL and D3D. These _are_ driver APIs. Don't say I didn't warn you.
score: 4
type: QuestionComment
comment on: http://stackoverflow.com/q/25110647
type: Comment

http://stackoverflow.com/comment/39062925
type: Comment
comment on: http://stackoverflow.com/a/25101694
type: AnswerComment
has text: This URL has a modified version of your code: http://ideone.com/dCr1CW - I've added comments explaining what we're doing there & why it works.
score: 0

http://stackoverflow.com/comment/39121834
comment on: http://stackoverflow.com/q/25122228
has text: `Table` in javafx is extends from the `Node` family. So you can directly print it
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/39300054
has text: What exactly is your requirement? If you don't want JAXB changing a field, you could mark it xml transient via the `@XmlTransient` annotation.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25229342

http://stackoverflow.com/q/25177034
tagged with: sql
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/25177709
tagged with: jdbc
has title: using same statement object to execute multiple queries in multiple threads?
tagged with: multithreading
type: AnsweredQuestion
has body: Is it a good idea to re-use java.sql.Statement object to execute multiple queries in multiple threads simultaneously? I've read somewhere that it's recommended to reuse same statement object, however it was sequential execution. Statement statement = con.createStatement(); Now if I use this single statement instance to run executeUpdate() for multiple queries in multiple threads simultaneously? Note that it's not PreparedStatement and I am not getting any ResultSet. I think answer depends on two scenarios: If queries are mutually exclusive, then it should be okay. If queries are working on same set of data, then there may be issues. Is my understanding correct? Thanks.
tagged with: java
tagged with: database
has answer: http://stackoverflow.com/a/25177709
type: Question

http://stackoverflow.com/q/25222792
has answer: http://stackoverflow.com/a/25335930
tagged with: android
score: 1
tagged with: java
tagged with: android-intent
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39297996
has title: Android app crashes on four specific activities
has comment: http://stackoverflow.com/comment/39286986
has body: I've been having some trouble with the intents on four specific activities. It randomly crashes, and I can't understand why this is the case. It occurs on four activities, and I think it has something to do with the activity not receiving the intent properly. I have used a diff-checker to verify that there's nothing different between this code and the activities that do not crash, and it turned up no differences. Even more interestingly, it seems to restart the activity that before the one that crashed, and continues normally past that activity with no crashing, but then crashes on another one of those four activities. Here's my Logcat: 08-09 16:16:39.031 384-399/system_process I/Choreographer﹕ Skipped 75 frames! The application may be doing too much work on its main thread. 08-09 16:16:40.081 384-398/system_process I/Choreographer﹕ Skipped 83 frames! The application may be doing too much work on its main thread. 08-09 16:16:40.831 1064-1064/tk.test.wirewizard I/Process﹕ Sending signal. PID: 1064 SIG: 9 08-09 16:16:42.011 384-607/system_process I/ActivityManager﹕ Process tk.test.wirewizard (pid 1064) has died. 08-09 16:16:42.081 384-396/system_process I/WindowState﹕ WIN DEATH: Window{b22499a0 u0 tk.test.wirewizard/tk.test.wirewizard.Start} Let me know if I need to post more code/logcat readouts. I am a newbie at this, so please explain your answers as thoroughly as possible. Thanks. UPDATE: Some code from an activity: package tk.test.wirewizard; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import tk.test.wirewizard.R; public class HDMI extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_hdmi); Button b1 = (Button)findViewById(R.id.button); Button b2 = (Button)findViewById(R.id.button2); b1.setOnClickListener(new View.O…
tagged with: ui-thread
has comment: http://stackoverflow.com/comment/39458152
upvote count: 2
has comment: http://stackoverflow.com/comment/39286984
answer count: 1
has comment: http://stackoverflow.com/comment/39460307
favorite count: 0
tagged with: android-logcat
type: UnansweredQuestion

http://stackoverflow.com/comment/39078401
type: Comment
has text: The parenthesis allow the expression to compile, but the intended effect isn't there... Any ideas?
comment on: http://stackoverflow.com/a/25110576
score: 0
type: AnswerComment

http://stackoverflow.com/a/31401069
downvote count: 0
has body: Converting Binary Search tree into Doubly Linked List is kind of easy task if we use left and right fields of Node. Recursion helps us here. First, go down till the left node. Assign the left most leaf node as prev and also as head of list. Once control come back from leaf node to its parent, assign current node i.e. parent of left node as right of prev and left of current node as leaf node. Same is goes for right leaf child of current node. Once we are out of complete recursion, we will have our doubly linked list, with listHead and listTail. { Node prev = null; Node listHead = null; Node listTail = null; public void convertToList(Node node) { if(node == null) return; convertToList(node.left); if(listHead == null) listHead = node; if(prev == null) prev = node; else { node.left = prev; prev.right = node; } prev = node; convertToList(node.right); if(node.right == null) listTail = node; } public void printList() { Node node = listHead; System.out.println("Doubly Linked List from Head: "); while(node!= null) { System.out.print(node.data+" "); node = node.right; } } public void printListFromTail() { Node node = listTail; System.out.println("Doubly Linked List from Tail: "); while(node!= null) { System.out.print(node.data+" "); node = node.left; } } }
type: Answer
answers question: http://stackoverflow.com/q/25101778
upvote count: 2
has comment: http://stackoverflow.com/comment/50778809
score: 2
has comment: http://stackoverflow.com/comment/50777253

smooth-scrolling
tags question: http://stackoverflow.com/q/25076968
tag name: smooth-scrolling
type: Tag

http://stackoverflow.com/q/25130820
has body: I have been searching SO and the web and I dont seem to find concrete example (or maybe just me not getting it). So maybe you guys can get me some help I have created a survlet that extends HTTPREQUEST on TOMCAT 7. The doGet successfully access the file and do a long writing operation then returns the results to the requester. Now my goal is to handle requests if they come at the same time. I.e queue them and execute one after the other. Any idea how to do that? Any example to follow? Thank you
tagged with: java
tagged with: concurrency
has answer: http://stackoverflow.com/a/25131196
tagged with: servlets
score: 0
answer count: 1
has title: concurrency in tomcat/servlets
tagged with: tomcat
type: UnansweredQuestion
type: Question

http://stackoverflow.com/q/25092118
has answer: http://stackoverflow.com/a/25116519
accepted answer: http://stackoverflow.com/a/25116519
tagged with: java
has body: I have added an @ExceptionHandler method on a specific controller. @ExceptionHandler(NullPointerException.class) @ResponseStatus(HttpStatus.Not_FOUND) public @ResponseBody doSomeThing(NullPointerException e) {...} Problem is : I have also an custom org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver defined as a @Component in my Rest Application (Legacy). Now the @ExceptionHandler in my specific controller never gets called. I need to support both Exception Handling strategies. How can I configure spring 4.0.5 so that my @ExceptionHandler in my Controller gets called?
upvote count: 3
answer count: 1
has title: How-to configure Spring 4.0.5 to use an @ExceptionHandler instead of an ExceptionResolver?
favorite count: 0
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: spring-data
type: Question

http://stackoverflow.com/comment/39140821
type: QuestionComment
comment on: http://stackoverflow.com/q/25144294
has text: basically when i run the program and try to get the distance its not getting any values from the second robot that is created so when it finds the distance its subtracting x from x and y from y so the distance it shows is 0
score: 0
type: Comment

http://stackoverflow.com/comment/39237753
score: 0
type: AnswerComment
has text: @EJP : I will remove that note from answer :)
type: Comment
comment on: http://stackoverflow.com/a/25196377

http://stackoverflow.com/comment/39251094
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25203778
has text: Is this code in my next comment correct for the TextView? Note I have called your code "circle 2". This code is not making a circle is it making a rectangle with curved edges?
score: 0

http://stackoverflow.com/comment/39282515
type: Comment
has text: It is a case of strangely encoded strings, but those are coming via HTTP requests from a server I have no control over and cannot simply change its behavior. Above code is the way to force it to produce correctly encoded strings.
score: 0
comment on: http://stackoverflow.com/q/25205533
type: QuestionComment

http://stackoverflow.com/comment/39057214
type: Comment
has text: @EdwinBuck _it can be unloaded from memory much more easily._ Can you explain this please.
comment on: http://stackoverflow.com/a/25099121
type: AnswerComment
score: 0

http://stackoverflow.com/q/25092316
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25092327
type: UnansweredQuestion
has title: Compiler error: Can not find symbol
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25092329
has body: import java.util.Scanner; public class TestPerson { /** * Creates a new instance of TestPerson. */ public TestPerson() { } /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here MemberType[] m = { new MemberType("Corporate Member"),new MemberType("VIP Member") }; RegMember[] r = new RegMember[2]; Scanner s = new Scanner(System.in); for(int i=0;i<r.length;i++){ System.out.println("your reg no is :"+(RegMember.getNextNo()+1)); for(int a=0;a<m.length;a++){ System.out.println((a+1)+". "+m[a].toString()); } System.out.println("Enter Your selection:"); int sel=s.nextInt(); if(sel==1){ s.nextLine(); System.out.println(" enter name:"); String Name=s.nextLine(); System.out.println(" enter Handphone:"); String Hpnum=s.next(); System.out.println(" enter Age:"); int age=s.nextInt(); System.out.println("enter Company Name:"); String CompanyName=s.nextLine(); Cmember cm = new Cmember(Name,Hpnum,age,CompanyName); } else{ s.nextLine(); System.out.println(" enter name:"); String Name=s.nextLine(); System.out.println(" enter Handphone:"); String Hpnum=s.next(); System.out.println(" enter Age:"); int age=s.nextInt(); System.out.println("enter Email:"); String email=s.next(); Vipmember vip = new Vipmember(Name,Hpnum,age,email); } if(sel==1){ r[i]=new RegMember(cm); } else{ r[i]=new RegMember(vip); } s.nextLine(); } displayInfor(r); } public static void displayInfor( RegMember[]r){ for(int i =0; i<r.length;i++) System.out.println( r[i].toString()); } } The problem is that I get this error. 60: error: cannot find symbol r[i]=new RegMember(cm); ^ symbol: variable cm location: class TestPerson 64: error: cannot find symbol r[i]=new RegMember(vip); ^ symbol: variable vip location: class TestPerson 2 errors

http://stackoverflow.com/q/25216255
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/39275099
upvote count: 2
has title: Cannot return supertype in generic method
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/39275080
has body: Some example code: public class Main { class SomeType { } class A { protected &lt;T extends SomeType&gt; T createSomething() { return null; // Don't worry about this. } } class B extends A { @Override protected &lt;T extends SomeType&gt; T createSomething() { SomeType orig = super.createSomething(); // do some stuff with orig return orig; } } } What am I getting wrong here? On the line return orig; the compiler spits out the error that Type mismatch: cannot convert from Main.SomeType to T Thanks to &lt;T extends SomeType&gt;, we can be sure that T is always a subtype of SomeType, right? So why can't I just return the supertype SomeType? I've already read &lt;? extends SuperType&gt; cannot be applied to SuperType and Explanation of the get-put principle but I don't see how it applies here.
tagged with: java
linked to: http://stackoverflow.com/q/1292109
has answer: http://stackoverflow.com/a/25216268
accepted answer: http://stackoverflow.com/a/25216268
type: Question
linked to: http://stackoverflow.com/q/23995682
has comment: http://stackoverflow.com/comment/39276225
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/39642257
score: 0
has text: How are you handling the received messages in the coordinator?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25097365

http://stackoverflow.com/comment/39133826
type: AnswerComment
comment on: http://stackoverflow.com/a/25140402
type: Comment
score: 1
has text: Java won't create your .txt file until you write something to it.

http://stackoverflow.com/a/25154811
score: 4
has body: Well, 5 minutes is always 300,000 milliseconds, so: long millis = date1.getTime(); millis += 300000; Date date2 = new Date(millis); Or perhaps more readably: long millis = date1.getTime(); millis += TimeUnit.MINUTES.toMilliseconds(5); Date date2 = new Date(millis);
type: Answer
answers question: http://stackoverflow.com/q/25154754
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/39203248
score: 0
comment on: http://stackoverflow.com/q/25177428
type: Comment
type: QuestionComment
has text: So I did what you told me to do and now I'm having import issues. Can't find classes in three java files in my project.

http://stackoverflow.com/q/25082937
favorite count: 0
has comment: http://stackoverflow.com/comment/39026867
tagged with: jframe
has comment: http://stackoverflow.com/comment/39027294
tagged with: swing
linked to: http://stackoverflow.com/q/22394845
has comment: http://stackoverflow.com/comment/39026774
tagged with: jbutton
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I am trying to make buttons change color when pressed. I have created the following code: import java.awt.BorderLayout; import java.awt.Color; import java.awt.EventQueue; import java.awt.Font; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.KeyStroke; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.border.EmptyBorder; public class KeyboardTest extends JFrame { public static void main(String[] args) { new KeyboardTest(); } public KeyboardTest() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (Exception ex) { try { UIManager.setLookAndFeel(UIManager .getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setBounds(100, 100, 650, 390); } }); } public class TestPane extends JPanel { public TestPane() { JPanel contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); add(contentPane); contentPane.setLayout(null); JPanel keyboardPanel = new JPanel(); keyboardPanel.setBounds(10, 122, 614, 181); contentPane.add(keyboardPanel); keyboardPanel.setLayout(new GridLayout(5, 0, 0, 0)); ... adding panels and buttons... addKeyBinding(A, "A", KeyEvent.VK_A); addKeyBinding(B, "B", KeyEvent.VK_B); addKeyBinding(C, …
type: Question
has title: Buttons don't show when keybinding buttons
tagged with: jpanel
upvote count: 1
has answer: http://stackoverflow.com/a/25083469
accepted answer: http://stackoverflow.com/a/25083469
answer count: 1
has comment: http://stackoverflow.com/comment/39026662
has comment: http://stackoverflow.com/comment/39026937

http://stackoverflow.com/q/25115780
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39111694
has comment: http://stackoverflow.com/comment/39088917
tagged with: java
has title: How can I transfer different JPG's and INT's over ObjectOutputStream as one package
has body: I want to do a screen motion detection algorithm. I lay a grid over the desktop screen and only want to transfer the parts of the screen that have changed. I have Integer values to determine the position of the piece in the grid and a Array of Bytes that store the JPG information. At a time it can be that I have to transfer 1 piece of the grid and at another time it can be all pieces of the screen. I want to transfer these information as one "package" over ObjectOutputStream. How can I create a way to pack these variables together and send them? I guess it should be some kind of array or an Object that contains an array.
type: Question
has comment: http://stackoverflow.com/comment/39090197
has comment: http://stackoverflow.com/comment/39088118
score: 0
has comment: http://stackoverflow.com/comment/39088200
tagged with: objectoutputstream
has comment: http://stackoverflow.com/comment/39088318
has comment: http://stackoverflow.com/comment/39088497
answer count: 0
tagged with: multidimensional-array

http://stackoverflow.com/comment/39173999
has text: Are you running it by double clicking on the jar? If yes, open up a terminal window and run it from there, it should print the complete stacktrace if some error occours
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/25162311

http://stackoverflow.com/q/25179022
has body: I have a set of thousands of GZIP files which I'm accessing through HTTP. Each file may be up to few hundreds of MB in size. I need to read first few kilobytes (header) from a file inside these compressed files. This is my current approach: URL url = new URL("http://example.com/file123.gz"); DataInputStream ds = new DataInputStream(new GZIPInputStream(url.openStream())); byte[] header = new byte[5760]; ds.readFully(header); What I need to do is to download first 5760 bytes from the file inside this GZIP file, but I do not want Java to download the whole file (which is usually more than few MB). My question is - does Java first download the whole GZIP file and then decompress it, or does it download just the necessary amount of data to fill the byte[5760] buffer? How can I find how much data was actually downloaded from the HTTP server?
answer count: 3
has title: GZIPInputStream: Read first n bytes from decompressed file
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25179993
accepted answer: http://stackoverflow.com/a/25179313
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39213049
upvote count: 1
type: Question
tagged with: gzip
possible better answer: http://stackoverflow.com/a/25179296
has answer: http://stackoverflow.com/a/25179313
tagged with: inputstream
has answer: http://stackoverflow.com/a/25179296
tagged with: optimization

http://stackoverflow.com/comment/39034242
comment on: http://stackoverflow.com/a/25084706
type: AnswerComment
has text: question is about getting set of objects which extend A and implemnt I. It mentions nothing about compile time or run time. Yes objects not suiting the criteria(just implementing I) may compile while adding to the set via above mentioned function but they will not actually be added as the inner check will fail.
score: 0
type: Comment

http://stackoverflow.com/comment/39044098
comment on: http://stackoverflow.com/q/25092090
score: 0
has text: Perhaps I could have given the whole definition but its too lengthy so I have tried my best to explain the algorithm in shortest of the form. 50% of the work is done; just the point remains how to I re-arrange the array so as to achieve the maximum product of the elements.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25101889
has comment: http://stackoverflow.com/comment/39061823
answer count: 1
has title: Check if an BST is a subtree of another bigger BST
favorite count: 0
tagged with: binary-search-tree
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25101930
tagged with: java
score: -1
downvote count: 1
has body: This is a question on my assignment: write a program in java, given 2 binary search tree, a big one and a small one, how do you check if the small one is a subtree of the bigger one ?
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/39061842

http://stackoverflow.com/q/25088705
tagged with: operator-precedence
has title: Calculator class, parsing and processing multiple operations in single input line
score: 2
has comment: http://stackoverflow.com/comment/39038072
upvote count: 2
has comment: http://stackoverflow.com/comment/39037973
tagged with: java
has comment: http://stackoverflow.com/comment/39037838
type: Question
has body: I'm working on a calculator class to better understand Java. Below is a skeleton of my code to give you an idea. For now, it can only handle simple commands, such as 2+2, 2/2, 2^2, etc. Can anyone provide guidance or examples on how to proceed from here? How can I adjust my parser to understand more complicated commands, such as (2 + (2 * 2^2)) / 2? Also, how can I adjust my methods to accept any number of arguments? I use an array to store my values and operators. Perhaps I could use an ArrayList so it can handle whatever number of elements/arguments? How can I establish general guidelines and order of operations (PEMDAS) to guide my program in its calculations? Thanks for the help! import java.util.Scanner; public abstract class Calc { private static double num1, num2; public static void start() { System.out.println("Calculator. Type \"exit\" to quit."); System.out.print("&gt; "); Scanner scan = new Scanner(System.in); String entry = scan.nextLine(); while (! (entry.equals("exit"))) { String [] operands = entry.replaceAll("\\s+", "").split("[\\+\\-\\/\\*\\%\\^]"); String operator = entry.replaceAll("(\\s+|\\d+|\\.)", ""); Double [] numbers = new Double[operands.length]; for (int i = 0; i &lt; operands.length; i++) { numbers[i] = new Double(operands[i]); } num1 = numbers[0]; num2 = numbers[1]; double result = 0; switch (operator) { case "+": result = Calc.add(num1, num2); break; case "-": ... case "*": ... case "/": ... case "^": ... case "%": ... default: System.out.println("Not valid."); } System.out.println(result); System.out.print("&gt; "); entry = scan.nextLine(); } } public static double add(double num1, double num2) { double sum = num1 + num2; return sum; } public static double subtract(double num1, double num2) { ... } public static double multiply(double num1, double num2) { ... } public static double divide(double num1, double num2) { ... } public static double exponentiate(double num1, double num2) { ... } public static double modulus(double num1, doubl…
has answer: http://stackoverflow.com/a/25089117
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/39038608
tagged with: parsing
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39040604

http://stackoverflow.com/q/25124451
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has comment: http://stackoverflow.com/comment/39104331
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/39143790
score: 1
tagged with: java
type: Question
has title: Tomcat 7 ignoring my server.xml file (vhost)
downvote count: 0
tagged with: tomcat
has body: I am running into a wall with the tomcat manuals. I want to run two domains on the same server by using tomcat. I was successfully changing the port 8080 to 80 in the server.xml Then I wanted to configure the vhosts as its written on the apache tomcat page. After spending days in it, I gave up and just moved the server.xml to an other place and saw that tomcat is not even taking care about that. Not even a single error in the log files. Tomcat is installed at /etc/tomcat7 on an ubuntu server. Other softwares are ip2ban and java8 - so nothing specially going on there.
has comment: http://stackoverflow.com/comment/39158645

http://stackoverflow.com/q/25093255
has answer: http://stackoverflow.com/a/25093394
has body: I am designing a stopwatch, and for my application I need to continuously get the time difference between this moment and the moment that stopwatch started. Here is what I have private int timestamp; private Date startTime; public void start() { if (!working) { startTime = new Date(); working = true; tick = new Thread() { public void run() { while (true) { try { timestamp = (new Date().getDate() - startTime.getDate())/1000; msg = handler.obtainMessage(0, getTimeStamp()); handler.sendMessage(msg); } catch (InterruptedException ex) { ex.printStackTrace(); working = false; timestamp = 0; break; } } } }; tick.start(); } } But I'm getting a message that getDate() method is deprecated. How to refactor it? I have searched for a solution, and found out some similar posts, and tried out the solutions, but my IDE just doesn't recognise DateUtil, or DateTime, or toCalendar Methods, I guess I miss the right libraries? And one more question, could you give me some information about what exactly means that the methods are deprecated? It's not very clear to me. Thanks in advance.
has answer: http://stackoverflow.com/a/25093271
accepted answer: http://stackoverflow.com/a/25093271
type: Question
type: AnsweredQuestion
has title: How to get time difference in Android?
possible better answer: http://stackoverflow.com/a/25093563
tagged with: java
tagged with: date
answer count: 3
score: 0
has answer: http://stackoverflow.com/a/25093563
tagged with: android

http://stackoverflow.com/a/25205921
upvote count: 15
has comment: http://stackoverflow.com/comment/39255411
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25205750
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25205750
has body: The fastest way to square a number is to multiply it by itself. Why is Math.pow so slow? It's really not, but it is performing exponentiation instead of simple multiplication. and why does it cope badly with > 1 and even worse with &lt; -1 numbers First, because it does the math. From the Javadoc it also contains tests for many corner cases. Finally, I would not rely too much on your micro-benchmark.
score: 15

http://stackoverflow.com/a/25124836
score: 0
type: Answer
has body: Sure, there are a few plugins for Eclipse that can generate UML from Java code. Try this one or simply Google "java generate uml"
answers question: http://stackoverflow.com/q/25124780
has comment: http://stackoverflow.com/comment/39105219

http://stackoverflow.com/q/25123695
has title: First time android programmer can't move between activities
has answer: http://stackoverflow.com/a/25123842
accepted answer: http://stackoverflow.com/a/25124241
has comment: http://stackoverflow.com/comment/39103180
has body: This is my first time programming for android and in java. I am using the latest Android Studio. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_log_in); nametxt = (EditText) findViewById(R.id.Txtname); final Button nextbutton = (Button) findViewById(R.id.NextButton); nametxt.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { nextbutton.setEnabled(!(nametxt.getText().toString().trim().isEmpty())); } @Override public void afterTextChanged(Editable editable) { } }); nextbutton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { editor.putString("Name",nametxt.getText().toString()); editor.apply(); Intent nextScreen = new Intent(view.getContext(), MainMenu.class); startActivity(nextScreen); } }); } In this code I am trying to get the user's name, save it in the android preferences file, and then move to the next screen. Well haha it doesn't work. Any idea why? Thank Alot
possible better answer: http://stackoverflow.com/a/25123842
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39102664
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/39102745
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39103105
answer count: 2
has comment: http://stackoverflow.com/comment/39103346
tagged with: mobile
has comment: http://stackoverflow.com/comment/39102888
has answer: http://stackoverflow.com/a/25124241
score: 0
has comment: http://stackoverflow.com/comment/39102788
tagged with: android
has comment: http://stackoverflow.com/comment/39102894
has comment: http://stackoverflow.com/comment/39102774
favorite count: 0

http://stackoverflow.com/comment/39212932
type: QuestionComment
type: Comment
has text: @sᴜʀᴇsʜᴀᴛᴛᴀ [Yes, it is](http://www.domainnameshop.com/faq.cgi?id=8&session=106ee5e67d523298).
comment on: http://stackoverflow.com/q/25183405
score: 0

jvm
tags question: http://stackoverflow.com/q/25079439
type: Tag
tags question: http://stackoverflow.com/q/25192583
tags question: http://stackoverflow.com/q/25173208
tags question: http://stackoverflow.com/q/25097978
tags question: http://stackoverflow.com/q/25172178
tags question: http://stackoverflow.com/q/25109942
tags question: http://stackoverflow.com/q/25134706
tags question: http://stackoverflow.com/q/25130047
tags question: http://stackoverflow.com/q/25196168
tag name: jvm
tags question: http://stackoverflow.com/q/25190728
tags question: http://stackoverflow.com/q/25117276
tags question: http://stackoverflow.com/q/25122047
tags question: http://stackoverflow.com/q/25210180
tags question: http://stackoverflow.com/q/25114261
tags question: http://stackoverflow.com/q/25210480
tags question: http://stackoverflow.com/q/25120546
tags question: http://stackoverflow.com/q/25092992
tags question: http://stackoverflow.com/q/25093340
tags question: http://stackoverflow.com/q/25146628
tags question: http://stackoverflow.com/q/25194903
tags question: http://stackoverflow.com/q/25106278
tags question: http://stackoverflow.com/q/25143195
tags question: http://stackoverflow.com/q/25160220
tags question: http://stackoverflow.com/q/25152316
tags question: http://stackoverflow.com/q/25086475
tags question: http://stackoverflow.com/q/25216734

http://stackoverflow.com/a/25308018
score: 0
has body: the application is hosted on a WebSphere 5.1 server. There are 5 java processes (one for each service related to the application) running on the server. At times, there is an additional java process which is created. This will stop the application from functioning. Once we kill the extra process and restart the services, the application works as expected. We are unable to identify how this extra process is being triggered. We would like to know if there is any specific logs where we can check for this or any if we can collect any specific traces which will point out the reason for this additional java process.
type: Answer
answers question: http://stackoverflow.com/q/25117669

http://stackoverflow.com/a/25108760
has body: In super super SUPER simple terms: Function: A block of code with a name that you can call any time, like example(); These are also sometimes known as "Subroutines" Method: A function defined in a class, like myInstance.example(); State: Storing temporary values Mutable State: values that can change: var a: Int = 0 a = 5 // legal Immutable State: values that cannot change: val a: Int = 0 a = 5 // error First Class Function: A function that takes another function as parameter, aka Higher Order Function: def apply(f: Int =&gt; Boolean, a: Int): Int = f(a) def even(a: Int): Boolean = a % 2 == 0 apply(even, 2) // returns true First Class Function (continued): A function that returns another function, aka Higher Order Function: def odd(a: Int): Boolean = a % 2 != 0 def something(a: String): Int =&gt; Boolean = if(a == "odd") odd else even val calcOdd = something("odd") calcOdd(3) // returns true First Class Function (continued): A function without a name, aka Anonymous Function: ((a: Int) =&gt; a * 2)(2) // returns 4 A thing to note, something that is very important to understand, is that Subroutines don't always return something but functions in Functional Programming always do. In Java for example, you have the type void which just means a method doesn't return anything, but in Scala (and most other FP languages) you have the type Unit instead, which means it returns noting. Although these things sound similar, they're in fact very different concepts Java Void: void printSomething() { // doesn't return a value System.out.println("Something"); } Scala Unit: def printSomething(): Unit = println("Something") // returns ()
type: Answer
has comment: http://stackoverflow.com/comment/39078163
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25107026
has comment: http://stackoverflow.com/comment/39087010
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25107026
has comment: http://stackoverflow.com/comment/39078151
has comment: http://stackoverflow.com/comment/39079005

http://stackoverflow.com/comment/39252900
has text: A sine wave takes values in the range [-1,1]. There are only three values in that range that can be represented in any integer type, -1, 0, and 1.
comment on: http://stackoverflow.com/q/25201304
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39163133
has text: By doesn't work i mean i get a Syntax Error
score: 0
comment on: http://stackoverflow.com/q/25156337
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39057412
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25097768
type: Comment
has text: You can add your config settings to your post. Maybe there are some isues. Also if you can you can try to run your test on MySql db and use innoDb engine for table

http://stackoverflow.com/a/25145737
upvote count: 1
has body: This code is based on a java.sql.ResultSet, but the pattern should be applicable to your case as well. Option 1: Provide a foreach method You can define a class like this: class Cursor[T](rs: ResultSet)(f: Row =&gt; T) { def foreach(g: T =&gt; Unit) { val row = new Row(rs) while (rs.next()) { g(f(row)) } } } It gets two arguments: The underlying result set A function f which produces an instance for each row. So during iteration, instances based on the current row are constructed. The Cursor class provides a foreach method. So it can be used in a "for comprehension": val cursor = Cursor(rs) { row =&gt; Person(row.getString(1), row.getString(2)) } for { person &lt;- cursor } { println(person) } To be able to use the { ... } syntax for the function f, a companion object is required: object Cursor { def apply[T](rs: ResultSet)(f: Row =&gt; T) = { new Cursor(rs)(f) } } A wrapper class Row representing a row of the result set is used, because some methods of the underlying result set should not be visible to the function (like next()). class Row(rs: ResultSet) { def getString(n: Int) = rs.getString(n) def getInt(n: Int) = rs.getInt(n) // ... more getters for other types } Option 2: Extend Iterator class CursorWithIterator[T](rs: ResultSet)(f: Row =&gt; T) extends Iterator[T] { private val row = new Row(rs) override def hasNext = rs.next() override def next() = f(row) } You can use an Iterator in a for "comprehension" as well. And it gives you access to the full collection API like map etc.
answers question: http://stackoverflow.com/q/25135606
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/25123447
has body: I am trying to add ad to my simply game. I' ve followed instructions from here: [url]https://github.com/libgdx/libgdx/wiki/Admob-in-libgdx[/url] . My AndroidLauncher looks like this : package com.redHoodie.android; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.RelativeLayout; import com.badlogic.gdx.backends.android.AndroidApplication; import com.google.ads.AdSize; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdView; import com.redHoodie.MainHoodie; public class AndroidLauncher extends AndroidApplication { @Override protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Create the layout RelativeLayout layout = new RelativeLayout(this); // Do the stuff that initialize() would do for you requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); // Create the libgdx View View gameView = initializeForView(new MainHoodie()); // Create and setup the AdMob view AdView adView = new AdView(this, AdSize.BANNER, "xxxxx"); // Put in your secret key here adView.loadAd(new AdRequest()); // Add the libgdx view layout.addView(gameView); // Add the AdMob view RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); adParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); adParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); layout.addView(adView, adParams); // Hook it all up setContentView(layout); } } and this three rows of code are underlined by eclipse : View gameView = initializeForView(new MainHoodie(),false); // Create and setup the AdMob view AdView adView = new AdView(this, AdSize.BANNER, "xxxxx"); // Put in your secret key here adView.loadAd(new AdR…
answer count: 1
has comment: http://stackoverflow.com/comment/39110839
tagged with: android
has answer: http://stackoverflow.com/a/25129696
type: AnsweredQuestion
has title: adMob new AdRequest() unrecognized by eclipse
tagged with: java
tagged with: admob
type: Question
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/25129696
score: 0

http://stackoverflow.com/a/25449704
upvote count: 8
has comment: http://stackoverflow.com/comment/111953397
has comment: http://stackoverflow.com/comment/121810994
has comment: http://stackoverflow.com/comment/75595406
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25081829
has comment: http://stackoverflow.com/comment/99917340
accepted answer of: http://stackoverflow.com/q/25081829
type: Answer
score: 8
downvote count: 0
has body: Ok the solution is: 1- create a Connection Factory class import java.sql.Connection; import java.sql.SQLException; import java.util.Properties; import javax.sql.DataSource; import org.apache.commons.dbcp.DriverManagerConnectionFactory; import org.apache.commons.dbcp.PoolableConnection; import org.apache.commons.dbcp.PoolableConnectionFactory; import org.apache.commons.dbcp.PoolingDataSource; import org.apache.commons.pool.impl.GenericObjectPool; public class ConnectionFactory { private static interface Singleton { final ConnectionFactory INSTANCE = new ConnectionFactory(); } private final DataSource dataSource; private ConnectionFactory() { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); System.exit(0); } Properties properties = new Properties(); properties.setProperty("user", "root"); properties.setProperty("password", "root"); GenericObjectPool<PoolableConnection> pool = new GenericObjectPool<PoolableConnection>(); DriverManagerConnectionFactory connectionFactory = new DriverManagerConnectionFactory( "jdbc:mysql://example.org:3306/exampleDb", properties ); new PoolableConnectionFactory(connectionFactory, pool, null, "SELECT 1", 3, false, false, Connection.TRANSACTION_READ_COMMITTED); this.dataSource = new PoolingDataSource(pool); } public static Connection getDatabaseConnection() throws SQLException { return Singleton.INSTANCE.dataSource.getConnection(); } } 2- create a configuration file into src/main/resources called log4j2.xml <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" /> <ConnectionFactory class="my.pack.ConnectionFactory" method="getDatabaseConnection" /> <!-- <Column name="id" literal="LOGGING.APPLICATION_LOG_SEQUENCE.NEXTVAL" /> --> <Column name="date" isEventTimestamp="true" /> <Column name="level" pattern="%level" /> <Column name="message" pattern="%message" /> <Column name="class" pattern="%class" /> <AppenderRef ref="Console" …
has comment: http://stackoverflow.com/comment/89136264

http://stackoverflow.com/comment/39046357
type: Comment
type: QuestionComment
has text: FYI you can just do `if(sta)`.
comment on: http://stackoverflow.com/q/25093512
score: 0

http://stackoverflow.com/a/25140402
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25140373
answers question: http://stackoverflow.com/q/25140373
has comment: http://stackoverflow.com/comment/39133826
type: Answer
has body: The line: myfile.mkdirs(); Creates a directory based on the File object myfile. If you wish to create a regular file, simply writing to myfile is sufficient, there is no need to call mkdirs. If you are trying to create the directory that myfile will go into, then calling: myfile.getParent().mkdirs() Will do that.
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/39133468

http://stackoverflow.com/q/25206863
tagged with: jdbc
possible better answer: http://stackoverflow.com/a/25206926
has answer: http://stackoverflow.com/a/25207026
answer count: 4
has comment: http://stackoverflow.com/comment/39257564
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39257800
has answer: http://stackoverflow.com/a/25206926
has comment: http://stackoverflow.com/comment/39257182
tagged with: java
score: 0
type: Question
has answer: http://stackoverflow.com/a/25206891
has title: What is the default datatype for stmt.executeQuery(query)?
accepted answer: http://stackoverflow.com/a/25207026
has body: My oracle table employee has different datatype columns. For my purposes, I just need the data of each column as string. So, When I execute the below query, can I assume that date_of_birth (date datatype) will be returned as string. ... rs = stmt.executeQuery("select * from employee"); ... rs.getString("date_of_birth"); ...
has comment: http://stackoverflow.com/comment/39257594
has answer: http://stackoverflow.com/a/25206920
has comment: http://stackoverflow.com/comment/39257213

http://stackoverflow.com/a/25169781
type: Answer
has comment: http://stackoverflow.com/comment/90695074
has comment: http://stackoverflow.com/comment/107188631
upvote count: 19
has comment: http://stackoverflow.com/comment/39188510
has comment: http://stackoverflow.com/comment/70077029
has comment: http://stackoverflow.com/comment/90694998
score: 19
has comment: http://stackoverflow.com/comment/39189550
answers question: http://stackoverflow.com/q/25169175
downvote count: 0
has body: Before Java 8, you couldn't define static methods in an interface. This is heavily discussed in this question. I'm going to refer to this answer (by user @JamesA.Rosen) as to why the Java designers probably didn't want static methods in an interface initially: There are a few issues at play here. The first is the issue of declaring a static method without defining it. This is the difference between public interface Foo { public static int bar(); } and public interface Foo { public static int bar() { ... } } Java doesn't allow either, but it could allow the second. The first is impossible for the reasons that Espo mentions: you don't know which implementing class is the correct definition. Java could allow the latter, as long as it treated Interfaces as first-class Objects. Ruby's Modules, which are approximately equivalent to Java's Interfaces, allow exactly that: module Foo def self.bar ... end end However, since the release of Java 8, you can actually add default and static methods inside an interface. I'm going to be quoting this source a lot here. This is the initial problem: Java's interface language feature lets you declare interfaces with abstract methods and provide implementations of those methods in the classes that implement the interfaces. You are required to implement each method, which is burdensome when there are many methods to implement. Also, after publishing the interface you cannot add new abstract methods to it without breaking source and binary compatibility. This was the solution Java 8 provided default: Java 8 addresses these problems by evolving the interface to support default and static methods. A default method is an instance method defined in an interface whose method header begins with the default keyword; it also provides a code body. Every class that implements the interface inherits the interface's default methods and can override them And for static: A static method is a method that's associated with the class in which it's defined,…

http://stackoverflow.com/a/25168121
has comment: http://stackoverflow.com/comment/39185218
answers question: http://stackoverflow.com/q/25167974
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25167974
type: Answer
has comment: http://stackoverflow.com/comment/39185302
has body: why the compiler is producing different byte code for very similar fields a and b From integer -1 - 5 iconst_x(x is number ranging from 0 - 5) is used that it is already a constant number bytecode. iconst_m1 02 → -1 load the int value -1 onto the stack iconst_0 03 → 0 load the int value 0 onto the stack iconst_1 04 → 1 load the int value 1 onto the stack iconst_2 05 → 2 load the int value 2 onto the stack iconst_3 06 → 3 load the int value 3 onto the stack iconst_4 07 → 4 load the int value 4 onto the stack iconst_5 08 → 5 load the int value 5 onto the stack Hence if the number is not a constant value of iconst_ bytecode then it will be using the bipush bytecode. More info on the list of java bytecode &amp;&amp; JVMS
upvote count: 7
score: 7
has comment: http://stackoverflow.com/comment/39215919

http://stackoverflow.com/q/25196565
possible better answer: http://stackoverflow.com/a/25196628
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39237960
type: Question
score: 0
has title: Java compilation error while using xor operator
has answer: http://stackoverflow.com/a/25196612
accepted answer: http://stackoverflow.com/a/25196612
has answer: http://stackoverflow.com/a/25196628
has answer: http://stackoverflow.com/a/25196882
linked to: http://stackoverflow.com/q/2279718
has answer: http://stackoverflow.com/a/25196652
has body: I am attempting to write a string reverse function in Java (I am aware I can simply call an existing function, but I am trying this to practice and learn) public class HelloWorld{ public static void main(String []args){ String s = reverse("abcd"); System.out.println(s); } public static String reverse(String str){ int end = str.length() - 1; int start = 0; char[] arr = str.toCharArray(); while (start &lt; end) { arr[start] = arr[start] ^ arr[end]; arr[end] = arr[start] ^ arr[end]; arr[start] = arr[start] ^ arr[end]; start++; end--; } String ret = new String(arr); return ret; } } However, it gives me these errors: HelloWorld.java:16: error: possible loss of precision arr[start] = arr[start] ^ arr[end]; ^ required: char found: int HelloWorld.java:18: error: possible loss of precision arr[end] = arr[start] ^ arr[end]; ^ required: char found: int HelloWorld.java:20: error: possible loss of precision arr[start] = arr[start] ^ arr[end]; ^ required: char found: int 3 errors I have tried casting like arr[end] = (char) arr[start] ^ arr[end]; Didn't solve the problem. What is going on here?
answer count: 4
tagged with: precision
tagged with: bit-manipulation

http://stackoverflow.com/q/25124385
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39104291
has comment: http://stackoverflow.com/comment/39104017
has title: Sending an SSH comand with JSCH to Raspberry Pi
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: jsch
favorite count: 0
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/39108382
tagged with: ssh
has comment: http://stackoverflow.com/comment/39108984
has body: I want to write an app for sending an SSH command to my Raspberry Pi with my smartphone. I read that JSCH is a good choice, so I included the JSCH Library to my project in Eclipse. I created a new class named SSH.java and put this code in: package com.app.bondrucker; import java.io.ByteArrayOutputStream; import java.util.Properties; import com.jcraft.jsch.ChannelExec; import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; public class SSH { public static String executeRemoteCommand() throws Exception { JSch jsch = new JSch(); Session session = jsch.getSession("pi", "192.168.2.10", 22); session.setPassword("raspberry"); // Avoid asking for key confirmation Properties prop = new Properties(); prop.put("StrictHostKeyChecking", "no"); session.setConfig(prop); session.connect(); // SSH Channel ChannelExec channelssh = (ChannelExec) session.openChannel("exec"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); channelssh.setOutputStream(baos); // Execute command channelssh.setCommand("sudo shutdown -h now"); channelssh.connect(); channelssh.disconnect(); return baos.toString(); } } Could you please check my code? The App crashes when this line gets executed: session.connect(); I start the JSCH-code with a button, which is executing this code: SSH.executeRemoteCommand(); Here are the LogCat messages which appear when I press the button (to execute the SSH comand): 08-04 22:00:38.668: D/libc(29531): [NET] getaddrinfo+,hn 12(0x3139322e313638),sn(),family 0,flags 4 08-04 22:00:38.668: D/libc(29531): [NET] getaddrinfo-, SUCCESS 08-04 22:00:38.668: W/dalvikvm(29531): threadid=1: thread exiting with uncaught exception (group=0x41d4be18) 08-04 22:00:38.678: E/ActivityManager(755): App crashed! Process: com.app.bondrucker 08-04 22:00:38.678: E/AndroidRuntime(29531): FATAL EXCEPTION: main 08-04 22:00:38.678: E/AndroidRuntime(29531): Process: com.app.bondrucker, PID: 29531 08-04 22:00:38.678: E/AndroidRuntime(29531): java.lang.IllegalStateException: Could not execute m…
has comment: http://stackoverflow.com/comment/39104210
upvote count: 1
has comment: http://stackoverflow.com/comment/39104810
tagged with: java

http://stackoverflow.com/a/25175566
has body: I figured it out. The problem was that when I added a contract, service or location to the entity I did not update the id object to reflect that. Once I figured that out the resolution was simple. In the entity with the composite key (in my case ContractServiceLocation.java), to the setters of properties which make up the composite key I've added this piece of code: public void setContract(Contract contract) { this.contract = contract; this.id.setContractId(contract.getId()); //added line } So each time I set/change a composite property, the id will reflect that. Also this isn't perfect(but works for now) and could be improved by checking if property id is null/default and in case it is throw an exception.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25156886
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25156886
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39238717
type: Comment
comment on: http://stackoverflow.com/a/25196914
has text: @Drew Looking into that now. Are the `curl` errors gone, at least?
score: 0
type: AnswerComment

http://stackoverflow.com/a/77268209
score: 0
answers question: http://stackoverflow.com/q/25079244
has body: You can pass arguments as follows: gradlew bootRun -Pargs=-Dspring.profiles.active=DEV,--POSTGRES_DB_HOST=jdbc:postgresql://localhost:5432/postgres,--POSTGRES_USR=postgres,--POSTGRES_PWD=postgres If you use build.gradle.kts: tasks.bootRun { if (project.hasProperty("args")) { args(project.properties["args"]?.toString()?.split(",")) } } If you use build.gradle: bootRun { if (project.hasProperty('args')) { args project.args.split(',') } }
type: Answer

http://stackoverflow.com/a/25126614
upvote count: 8
type: Answer
score: 8
answers question: http://stackoverflow.com/q/25122796
has comment: http://stackoverflow.com/comment/39110189
accepted answer of: http://stackoverflow.com/q/25122796
has body: Solutions If all you have to do is convert a LocalDate to a string respecting the pattern: "dd/MM/YYYY HH:mm:ss", then you can do it in a simpler way, using the overloaded toString() methods on LocalDate: a) the one which receives the format string directly: LocalDate date = lastCommunicationToDisplay.getDateOnLine(); System.out.println(date.toString("dd/MM/YYYY HH:mm:ss")); b) the one which receives a DateTimeFormatter initialized with the aforementioned string: DateTimeFormatter dtf = DateTimeFormat.forPattern("dd/MM/YYYY HH:mm:ss"); LocalDate date = lastCommunicationToDisplay.getDateOnLine(); System.out.println(date.toString(dtf)); What went wrong in your code The format string you are using is not compatible with the date string you are sending as input. The way you used DateTimeFormatter is used for parsing strings that are in that format to LocalDates, not the other way around. The format would be appropriate if your input string would look like the following: 04/08/2014 22:44:33 Since yours looks differently, the following value of the format is compatible (provided your timezone is always CEST): DATE_FORMAT = "E MMM dd HH:mm:ss 'CEST' YYYY"; So the entire code should look like this: String dateString = "Mon Aug 04 16:07:00 CEST 2014"; DateTimeFormatter dtf = DateTimeFormat.forPattern("E MMM dd HH:mm:ss 'CEST' YYYY"); LocalDate date = dtf.parseLocalDate(dateString); System.out.println(date.toString("MM/dd/yyyy")); // or use toString(DateTimeFormatter) and use your pattern with a small adjusment here (dd/MM/YYYY HH:mm:ss) However, I recommend one of the first 2 suggestions.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25134177
type: UnansweredQuestion
tagged with: maven
tagged with: ant
tagged with: java
tagged with: ivy
type: Question
has body: I'm wondering if it is possible (and how if yes) to customize Maven projects build path. Example: we are developing modules for a huge server. All the core build process is based on Ant and Ivy (custom ivy settings for resolving internal proprietary dependencies). But we are developing modules which are also quite big using Maven because its just much more comfortable for us. Then using Ants Maven plugin building all the stuff together - works like a charm. But this Ant(Ivy)+ Maven combo makes it impossible for me to use NetBeans. I love them, I want to use them but unfortunatelly NetBeans don't allow me to customize the build path when the project is based on pom.xml. It would be great just to have the possibility to add JAR files next to the dependencies resolved by Maven (like in basic Java Application ant based project. Messing with pom is not the way and I don't need exactly resolving ivy dependencies. Only for editor use. The whole build process is working -> so mvn install resolves ivy dependencies during the build but NetBeans dont see them. Idea and Eclipse are able to that, but would love to see it happen in NetBeans too.
score: 0
has title: Customizing build path for Maven based projects in NetBeans
tagged with: netbeans
has comment: http://stackoverflow.com/comment/39143180
answer count: 0
has comment: http://stackoverflow.com/comment/39142414

http://stackoverflow.com/comment/39112336
comment on: http://stackoverflow.com/q/25127021
score: 0
type: Comment
type: QuestionComment
has text: @SamYonnou now if only that was reversed.

http://stackoverflow.com/comment/39284076
has text: Can you please provide a code example of doing that?
score: 0
comment on: http://stackoverflow.com/q/25215280
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25226314
has answer: http://stackoverflow.com/a/30659238
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/25229882
has title: No mapping found for HTTP request with URI.... in DispatcherServlet with name 'main'
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25226458
has body: I am newly working on spring mvc,I am using "spring in practice" book and this is the first mvc programme which I tried and I am getting the below error WARN PageNotFound:1101 - No mapping found for HTTP request with URI [/MVC_BOOK_Annotation/main/list.do] in DispatcherServlet with name 'main' below is my code RosterController package com.web; import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import com.model.Member; @Controller public final class RosterController { private List<Member> members = new ArrayList<Member>(); public RosterController() { members.add(new Member("John", "Lennon")); members.add(new Member("Paul", "McCartney")); members.add(new Member("George", "Harrison")); members.add(new Member("Ringo", "Starr")); } @RequestMapping public void list(Model model) { model.addAttribute(members); } @RequestMapping public void member(@RequestParam("id") Integer id, Model model) { model.addAttribute(members.get(id)); } } Member.java package com.model; public class Member { private String firstName; private String lastName; public Member() { } public Member(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String toString() { return firstName + " " + lastName; } } main-servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.sp…
downvote count: 0
tagged with: jsp
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25229882
type: Question
possible better answer: http://stackoverflow.com/a/25230721
tagged with: spring
has answer: http://stackoverflow.com/a/25230721
tagged with: spring-mvc

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/25224295
type: Tag

http://stackoverflow.com/comment/39104691
type: QuestionComment
has text: okay..thanks..i'll make the required changes..
comment on: http://stackoverflow.com/q/25124551
score: 0
type: Comment

http://stackoverflow.com/comment/39055210
type: Comment
has text: yes I have it unchecked and the code you wrote would probably work in straight sql but in java just using 'NULL' takes it as a string so it won't work for some reason. Null is also a reserved java command and won't work without double quotes either. I'm stuck
comment on: http://stackoverflow.com/a/25097594
type: AnswerComment
score: 0

http://stackoverflow.com/comment/69657086
type: Comment
score: 7
type: AnswerComment
has text: Frameworks like AKKA & vert.x, support non-blocking features. People often confuse them to be non-blocking IO frameworks. These frameworks do a lot of things but not non-blocking IO. They only support asynchronous IO as described above.
comment on: http://stackoverflow.com/a/40049018

http://stackoverflow.com/a/38424639
answers question: http://stackoverflow.com/q/25087833
score: 32
type: Answer
has comment: http://stackoverflow.com/comment/87570167
has comment: http://stackoverflow.com/comment/82789040
downvote count: 0
has body: Go to Project Properties -> Project Facets and change the version of Dynamic Web Module. If it is set to 3.1 then change it to 3.0. In case it does not allow you to change the version, uncheck it and press apply. Then you can select the version, check it and apply-OK. Worked for me!
upvote count: 32

http://stackoverflow.com/a/25075244
type: Answer
has comment: http://stackoverflow.com/comment/39012776
has body: You can use Mysql Event Scheduler to periodically perform an action on the database side. You can also do it programmatically in java using a ScheduledThreadPoolExecutor: ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor(); // execute every 15 seconds ses.scheduleAtFixedRate(new Runnable() { @Override public void run() { // execute query to delete the proper data } }, 0, 15, TimeUnit.SECONDS);
has comment: http://stackoverflow.com/comment/39012386
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25075054
answers question: http://stackoverflow.com/q/25075054
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/q/25094229
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25094242
accepted answer: http://stackoverflow.com/a/25094242
has title: java - Why the thread execution was finished before the next line was executed
linked to: http://stackoverflow.com/q/2674174
has comment: http://stackoverflow.com/comment/39047766
has body: I am writing a simple algorithm in a new thread. I wonder why the code that follows waits until the thread is finished in order to run. Here is a simple program that does the same. public static void main(String[] args) { final String[] strings = new String[10]; new Thread(new Runnable() { @Override public void run() { for (int i = 0; i &lt; 10; i++) { strings[i] = String.valueOf(i); Thread.sleep(10000); // in real code this is wrapped in a simple try catch } } }).run(); for (String string : strings) { System.out.print(string); } } The thread sleeps 10 seconds and yet the last iteration was executed after the thread finished running. I can even extend the sleep time. but the next line (the final iteration) is not executed until the thread finished. Why is that? The result is 0 1 2 3 4 5 6 7 8 9
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/15841301
score: 2
type: AnsweredQuestion
upvote count: 3
tagged with: multithreading

http://stackoverflow.com/a/25216841
has body: try like this hope it will help you,
type: Answer
has comment: http://stackoverflow.com/comment/39276270
answers question: http://stackoverflow.com/q/25216817
score: 0

http://stackoverflow.com/comment/39053050
score: 0
comment on: http://stackoverflow.com/a/25097158
has text: So flush won't help ?
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25215280
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39274029
downvote count: 0
has body: My Broadcast Receiver listens for WiFi ssid change and if the ssid changes it return the boolean WifiChanged true.I check for this boolean in another activity which changes a list based on the value returned whether it was true or false.By default the boolean value is false. I intentionally change the wifi which should trigger the broadcast receiver to return the boolean value to true and set the list accordingly but what actually happens is that my list is changed based on the boolean value false as broadcast receiver takes a while to return the value. In the log below you can see the boolean value is false and after 0.58 seconds approximately the ssid changes. By that time its too late 08-08 16:43:54.487: D/PlayerManager(20733): Did Wi-Fi Changed: false | | | 08-08 16:43:55.047: V/ConnectionChangeReceiver(20733): onReceive(Context context, Intent intent) 08-08 16:43:55.077: D/ConnectionChangeReceiver(20733): ssid changed from s_ssid="Walter_Meth_Lab" to newSsid="Kings_Landing" Here is my OnReceive() public class ConnectionChangeReceiver extends BroadcastReceiver { private static final String TAG = "ConnectionChangeReceiver"; private static String s_ssid = null; private static String s_ipAddress = null; private static String mNetworkType; private static ConnectionChangeReceiver sInstance; private ConnectionChangeListener mConnectionChangeListener; private boolean mHasWifiChanged; public static ConnectionChangeReceiver getInstance() { Log.v(TAG, "getInstance()"); synchronized (ConnectionChangeReceiver.class) { if (sInstance == null) { sInstance = new ConnectionChangeReceiver(); } } return sInstance; } public boolean WifiChanged() { return mHasWifiChanged; } public void setConnectionChangeListener(final ConnectionChangeListener listener) { this.mConnectionChangeListener = listener; } @Override public void onReceive(final Context context, final Intent intent) { Log.v(TAG, "onReceive(Context context, Intent intent)"); mHasWifiChanged = false; String newSsid = null; Str…
has comment: http://stackoverflow.com/comment/39284076
has title: android broadcast receiver OnReceive() delay causing errors
tagged with: android
favorite count: 0
score: 2
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25255385
has answer: http://stackoverflow.com/a/25287018
tagged with: java
has comment: http://stackoverflow.com/comment/39273420

http://stackoverflow.com/q/25211906
has comment: http://stackoverflow.com/comment/39266906
has comment: http://stackoverflow.com/comment/39266725
accepted answer: http://stackoverflow.com/a/25212202
tagged with: regex
has comment: http://stackoverflow.com/comment/39266893
has comment: http://stackoverflow.com/comment/39266930
downvote count: 1
has comment: http://stackoverflow.com/comment/39266954
type: Question
has body: I'm trying to write a replaceAll in java that can replace json to be inside of an array instead of a object, Here's an example of what I mean: test:[{\"asdf\":\"asasdd\"}] my goal is to replace all the of } in test object to be in an array but not effect any other } (The json that I am using is valid(Unlike the json below) but I've been doing the tests with the string below because i expect it would have the same result and it is much shorter) String test = "[asdfasdf}test:{\"asdf\":\"asasdd\"}.sdfasdfsadfsdf, test:{\"asdf\":\"asasdd\"}sdfsdf } "; //Desired Outcome String test = "[asdfasdf}test:[{\"asdf\":\"asasdd\"}].sdfasdfsadfsdf, test:[{\"asdf\":\"asasdd\"}]sdfsdf } "; System.out.println(test.replaceAll("(?&lt;=[test:{])}", "}]")); // So As a side note I would like to point out why I found this question important it is because of a bad supplier that gives back json as an object, rather the an array, if it doesn't have more than one result. Because of this it broke my json class parser
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39266956
score: -1
has answer: http://stackoverflow.com/a/25212202
has comment: http://stackoverflow.com/comment/39266898
has comment: http://stackoverflow.com/comment/39266790
has comment: http://stackoverflow.com/comment/39266942
tagged with: regex-lookarounds
upvote count: 0
has title: Java Replace All Regular Expression
answer count: 1
favorite count: 0

http://stackoverflow.com/q/25152186
score: -1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25152265
has title: GCM Push Notification whereby Message is Push From Mobile To GCM Server
downvote count: 1
type: Question
has body: Can any of you all provide a code for GCM Push Notification where the message is pushed from mobile to GCM-Server. I already did from GCM server to Mobile and its working but I don't know how to do it vice versa.. Can anyone provide help? Thank you. I appreciate it.
tagged with: java
has answer: http://stackoverflow.com/a/25152265
upvote count: 0
answer count: 1
favorite count: 0
tagged with: android
tagged with: google-cloud-messaging

http://stackoverflow.com/comment/39261572
comment on: http://stackoverflow.com/a/25209192
score: 0
type: AnswerComment
type: Comment
has text: `Version version` should be declared outside and before the `if-else`. Check @rgamber post.

http://stackoverflow.com/comment/39123363
comment on: http://stackoverflow.com/a/25121660
has text: Can you upload somewhere your project? I've checked and your code is now working correctly
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25105623
has answer: http://stackoverflow.com/a/25107764
accepted answer: http://stackoverflow.com/a/25107764
tagged with: swing
type: AnsweredQuestion
score: 3
has title: A JPanel in JScrollPane, How to prevent Auto Scroll
possible better answer: http://stackoverflow.com/a/54724209
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/54724209
type: Question
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/39069094
tagged with: jscrollpane
favorite count: 0
linked to: http://stackoverflow.com/q/3972337
has body: I have a Auto Scroll Problem with JScrollPane. For example, in the following code, if we change the value of the Spinner, all TextAreas's value will be Changed. Then JScrollPane auto scroll to the latest changed JComponent. Can I prevent this kind of Auto Scroll? Some one marked that this question is "duplicate" but not at all. This question Java / Swing : JTextArea in a JScrollPane, how to prevent auto-scroll? is a JTextArea in a JScrollPane, so we can use DefaultCaret to solve this problem, because JTextArea has DefaultCaret. But in my question, it is a JPanel in a JScrollPane, a JPanel has not a DefaultCaret. So we cannot use the same way to solve this problem. import java.awt.BorderLayout import javafx.scene.layout.Pane; import javax.swing.BoxLayout; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSpinner; import javax.swing.JTextArea; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class ScrollControl { static JFrame main_frame = new JFrame(); static JScrollPane scroll_pane = new JScrollPane(); static JPanel pane = new JPanel(); static JSpinner spinner = new JSpinner(); static JTextArea text1 = new JTextArea(); static JTextArea text2 = new JTextArea(); static JTextArea text3 = new JTextArea(); static JTextArea text4 = new JTextArea(); static JTextArea text5 = new JTextArea(); static JTextArea text6 = new JTextArea(); static JTextArea text7 = new JTextArea(); public static void main(String args[]){ main_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); spinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { text1.setText(spinner.getValue().toString()); text2.setText(spinner.getValue().toString()); text3.setText(spinner.getValue().toString()); text4.setText(spinner.getValue().toString()); text5.setText(spinner.getValue().toString()); text6.setText(spinner.getValue…

http://stackoverflow.com/comment/39040937
type: Comment
score: 0
has text: This should usually give you a NullPointerException as ToolProvider.getSystemJavaCompiler() normally returns null. How did you solve this?
comment on: http://stackoverflow.com/q/25090434
type: QuestionComment

http://stackoverflow.com/q/25210516
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/25737935
accepted answer: http://stackoverflow.com/a/25737935
has title: Implementing LOD in OpenGL (Java)
has comment: http://stackoverflow.com/comment/39270987
upvote count: 1
tagged with: game-engine
answer count: 1
favorite count: 0
has body: While I understand the concept of LOD, I'm having a little trouble implementing it. Assume I have a number of models at different LODs and I want to store them in my Mesh class. What do I need to change (I already have a Mesh supporting one model). Do I have multiple VBOs (an array, with index dictating level perhaps?), buffer each model into it's VBO and bind the correct one when rendering? Or am I completely missing the idea?
type: AnsweredQuestion
downvote count: 0
tagged with: opengl
score: 1
tagged with: java

http://stackoverflow.com/q/25128185
type: Question
tagged with: java-native-interface
has answer: http://stackoverflow.com/a/25164969
score: 0
tagged with: snappy
answer count: 1
has title: java.library.path not honored with maven-shade-plugin
tagged with: hbase
type: UnansweredQuestion
has body: If I have code like this: Configuration conf = new Configuration(); LoadIncrementalHFiles lihf; lihf = new LoadIncrementalHFiles(conf); lihf.doBulkLoad(/*proper args*/) This works fine with -Djava.library.path=/usr/lib/hadoop/lib/native/ in the command line. The table is Snappy compressed I need a uber-jar and hence use maven-shade-plugin to create it. Now the same code doesn't work even if I specify -Djava.library.path=/usr/lib/hadoop/lib/native/ in the command line The error is: java.lang.IllegalStateException: java.lang.UnsatisfiedLinkError: org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy()Z at org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles.groupOrSplitPhase(LoadIncrementalHFiles.java:382) at org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles.doBulkLoad(LoadIncrementalHFiles.java:258) Caused by: java.lang.UnsatisfiedLinkError: org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy()Z at org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy(Native Method) at org.apache.hadoop.io.compress.SnappyCodec.checkNativeCodeLoaded(SnappyCodec.java:62) at org.apache.hadoop.io.compress.SnappyCodec.getDecompressorType(SnappyCodec.java:185) at org.apache.hadoop.io.compress.CodecPool.getDecompressor(CodecPool.java:131) at org.apache.hadoop.hbase.io.hfile.Compression$Algorithm.getDecompressor(Compression.java:331) at org.apache.hadoop.hbase.io.hfile.HFileBlock$AbstractFSReader.decompress(HFileBlock.java:1457) at org.apache.hadoop.hbase.io.hfile.HFileBlock$FSReaderV2.readBlockDataInternal(HFileBlock.java:1963) at org.apache.hadoop.hbase.io.hfile.HFileBlock$FSReaderV2.readBlockData(HFileBlock.java:1703) at org.apache.hadoop.hbase.io.hfile.HFileBlock$AbstractFSReader$1.nextBlock(HFileBlock.java:1350) at org.apache.hadoop.hbase.io.hfile.HFileBlock$AbstractFSReader$1.nextBlockWithBlockType(HFileBlock.java:1358) at org.apache.hadoop.hbase.io.hfile.HFileReaderV2.&lt;init&gt;(HFileReaderV2.java:127) at org.apache.hadoop.hbase.io.hfile.HFile.pickReader…
tagged with: maven
tagged with: java

http://stackoverflow.com/comment/39218541
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25185934
score: 0
has text: Actually the passed key is delimited information. If its not cached, then may be I should think of some alternative of passing this info.

http://stackoverflow.com/comment/39218982
type: AnswerComment
type: Comment
has text: @ChrisStratton so is there a way to save files on the external storage so that i can send them or should i just ave it internally and send it from there
comment on: http://stackoverflow.com/a/25184957
score: 0

http://stackoverflow.com/q/25204043
has comment: http://stackoverflow.com/comment/39251719
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25211972
has answer: http://stackoverflow.com/a/25204281
type: Question
has comment: http://stackoverflow.com/comment/39252174
tagged with: java
has body: I am using following code to calculate difference in seconds between two dates: long secondsBetween = (Seconds.secondsBetween(new LocalDate("1901-01-01"), new LocalDate()).getSeconds()); However I am getting the following exception: 08-08 18:21:27.345: E/AndroidRuntime(6972): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.testbdr/com.testbdr.MainActivity}: java.lang.ArithmeticException: Value cannot fit in an int: 3584908800 08-08 18:21:27.345: E/AndroidRuntime(6972): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2189) 08-08 18:21:27.345: E/AndroidRuntime(6972): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2216) 08-08 18:21:27.345: E/AndroidRuntime(6972): at android.app.ActivityThread.access$600(ActivityThread.java:149) 08-08 18:21:27.345: E/AndroidRuntime(6972): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1305) 08-08 18:21:27.345: E/AndroidRuntime(6972): at android.os.Handler.dispatchMessage(Handler.java:99) 08-08 18:21:27.345: E/AndroidRuntime(6972): at android.os.Looper.loop(Looper.java:153) 08-08 18:21:27.345: E/AndroidRuntime(6972): at android.app.ActivityThread.main(ActivityThread.java:5000) 08-08 18:21:27.345: E/AndroidRuntime(6972): at java.lang.reflect.Method.invokeNative(Native Method) 08-08 18:21:27.345: E/AndroidRuntime(6972): at java.lang.reflect.Method.invoke(Method.java:511) 08-08 18:21:27.345: E/AndroidRuntime(6972): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821) 08-08 18:21:27.345: E/AndroidRuntime(6972): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) 08-08 18:21:27.345: E/AndroidRuntime(6972): at dalvik.system.NativeStart.main(Native Method) 08-08 18:21:27.345: E/AndroidRuntime(6972): Caused by: java.lang.ArithmeticException: Value cannot fit in an int: 3584908800 08-08 18:21:27.345: E/AndroidRuntime(6972): at org.joda.time.field.FieldUtils.safeToInt(FieldUtils.java:206) 08-08 18:21:27.345: E/Android…
has title: Joda Time - Calculation of seconds between two dates throws an exception.
score: 4
has comment: http://stackoverflow.com/comment/39251987
upvote count: 4
tagged with: jodatime
has comment: http://stackoverflow.com/comment/39251761
possible better answer: http://stackoverflow.com/a/25204211
downvote count: 0
has answer: http://stackoverflow.com/a/25204211
has answer: http://stackoverflow.com/a/25204132
favorite count: 0
has answer: http://stackoverflow.com/a/25211972
has comment: http://stackoverflow.com/comment/39252035
answer count: 5
has answer: http://stackoverflow.com/a/25204121
tagged with: android
tagged with: datetime

http://stackoverflow.com/a/25157584
type: Answer
has body: Don't try to load another View in the current activity. Navigate to a new ExercisesActivity. Use: public void onClick(View v) { Intent intent = new Intent(ExercisesActivity.this, WcActivity.class); startActivity(intent); }
upvote count: 1
answers question: http://stackoverflow.com/q/25157463
score: 1
downvote count: 0

http://stackoverflow.com/comment/39259106
has text: `private CustomJPAContainer<Nucleo> datasource;`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25206119

http://stackoverflow.com/q/25069943
has answer: http://stackoverflow.com/a/25070104
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/39002993
possible better answer: http://stackoverflow.com/a/25070104
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/25070272
type: Question
answer count: 2
tagged with: automation
has body: I'm looking for an instrument, that could help me to solve the subject problem. I have an interval (say, an hour. 8 to 9). And I need to run a (java) program in a random minute in it. Cron looks like a proper tool, but I see no random function. I'm quite sure there's an instrument that smart people are using for this, so I'd like to learn it during this training project development. I'm also want to know, which one is better production practice: writing a custom schedule via (for example) ScheduledExecutorService or using external tools like cron?
has comment: http://stackoverflow.com/comment/39002565
tagged with: cron
downvote count: 0
has title: Running program in a random minute of an interval
accepted answer: http://stackoverflow.com/a/25070272
favorite count: 0
tagged with: time

http://stackoverflow.com/comment/39104915
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25124850
has text: this is not the the correct way to start a thread. It should be `new Thread(r1)`

http://stackoverflow.com/a/25074319
answers question: http://stackoverflow.com/q/25074291
type: Answer
upvote count: 4
downvote count: 0
score: 4
has body: Short answer is, you can't (do it automatically). What you can do is call JScrollPane#setColumnHeaderView and pass it null after you've set the JTable to the viewport... The column headers are applied to the JScrollPane by the JTable when the tables addNotify method is called. This is called in response to a container, which contains the table, been added to a displayable container (like a visible frame). This then calls configureEnclosingScrollPane Updated The above code assumes that the JScrollPane and JTable have already been added to a container that is already displayable, this may not always be the case. You could, alternatively, override the JTable#configureEnclosingScrollPane method and configure the headers when you want them to be... @Override protected void configureEnclosingScrollPane() { if (showHeaders) { super.configureEnclosingScrollPane(); } } Now personally, I would create my own custom JTable which had a showColumnHeaders property and which could used to toggle the headers on and off based on my needs...
has comment: http://stackoverflow.com/comment/39011146

http://stackoverflow.com/comment/43201445
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25203684
has text: I don't think that by method stated by you will work ,As you told it seems to be i m just accesing the branches to increase my test coverage but I m not checking the bussiness code inside !

http://stackoverflow.com/q/25203133
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39249899
has comment: http://stackoverflow.com/comment/39249803
has body: I want to include an interface Printable to this class but it is showing an error. error:Class file collision: A resource exists with a different case: '/example01/bin/com/example/test/test.class'. This is my code package com.example.test; import com.example.test.Printable; class A implements Printable { public void a() { System.out.println("a method"); } @Override public void b() { } } abstract class B implements Printable { public void b() { System.out.println("b method"); } } class Call { void invoke(Printable p) {// upcasting if (p instanceof A) { A a = (A) p;// Downcasting a.a(); } if (p instanceof B) { B b = (B) p;// Downcasting b.b(); } } }// end of Call class class Test { public static void main(String args[]) { Printable p = new A(); Call c = new Call(); c.invoke(p); } } This is my Printable interface class code public interface Printable { public void a (); public void b(); } So how can i import the interface Printable to this class any help would be appreciated. Thanks
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39249724
favorite count: 0
has comment: http://stackoverflow.com/comment/39250072
has answer: http://stackoverflow.com/a/25203591
has comment: http://stackoverflow.com/comment/39249788
type: Question
has comment: http://stackoverflow.com/comment/39249846
has comment: http://stackoverflow.com/comment/39249786
upvote count: 1
has comment: http://stackoverflow.com/comment/39249895
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/39249719
has title: how to include an interface in java class

http://stackoverflow.com/comment/39129859
type: Comment
comment on: http://stackoverflow.com/a/25138240
has text: My NetBeans 8.0 IDE, shows the `list` value as form validation issue as mentioned in question. (See the image,`list` value in RED)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39090158
comment on: http://stackoverflow.com/q/25117115
has text: I dunno, maybe it has something to do with you closing the writer after you've written the first line?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/39071795
has text: can u post logcat plz
type: Comment
score: 2
comment on: http://stackoverflow.com/q/25107273
type: QuestionComment

http://stackoverflow.com/comment/39230834
comment on: http://stackoverflow.com/a/25099502
has text: I only added this answer to emphasize that threads don't need code of their own, only execution context/stack. Sure, syscalls and lib calls in a multithreaded environment MUST work correctly, else chaos will reign over the land of nasal demons.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25215031
has comment: http://stackoverflow.com/comment/39272941
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39272838
has comment: http://stackoverflow.com/comment/39273002
type: Answer
has comment: http://stackoverflow.com/comment/39273146
has body: I'm not sure your main method actually calls setAge(..) at any point. So the reason getAge() is returning 0 is because 0 is the default value for ints. (Which you never change) Even if setAge(..) were called, the logic probably doesn't do exactly what you think it does. You have a very detailed if block that assigns varying values to age, depending on the person's type. After that though, whether or not the if block is executed, age is set to personsAge, making the entire if block useless. Perhaps that final statement was supposed to be in an else branch? The logic of your setAge() function isn't quite right: the else-if branch of personsType.equals("young adult") is paired with if(number &gt; 12 &amp; number &lt; 18), not if(personsType.equals("teen")). So I'm fairly confident that the first else-if branch will never be executed, because it is contained within if(personsType.equals("teen")), and without personType changing this will always be false within the if branch. Consider this revision of your setAge() function, which I believe achieves a closer logic to what you were hoping: Based on your comments, don't use the set convention, because you're setting to a random value, not a given value. Also, for debugging purposes, try this code, which has some print statements. public void setRandomAge(){ System.out.println(personsType); //The type of this person, for debugging purposes to //make sure it's valid at this point if(personsType.equals("teen")){ age = (int)(Math.random() * 4) + 13); //random number between [13,17], inclusive } else if(personsType.equals("young adult")){ age = (int)(Math.random() * 12) + 18; //random number between [18,30], inclusive } else if(personsType.equals("adult")){ age = (int)(Math.random() * 18) + 31; //random number between [31, 49], inclusive } else if(personsType.equals("elder")){ age = (int)(Math.random() * 50) + 50; //random number between [50, 100], inclusive } else{ age = 0; //Probably should have some default case for //if the…
score: 0
has comment: http://stackoverflow.com/comment/39272956
has comment: http://stackoverflow.com/comment/39273107
accepted answer of: http://stackoverflow.com/q/25215012
answers question: http://stackoverflow.com/q/25215012
has comment: http://stackoverflow.com/comment/39272835

http://stackoverflow.com/comment/39169373
type: Comment
type: QuestionComment
has text: its Kepler.. however .. thanks alot for your help .. regards :)
comment on: http://stackoverflow.com/q/25135335
score: 0

http://stackoverflow.com/a/25204252
downvote count: 0
type: Answer
has body: From the stack trace it appears that this was caught by the Thread.UncaughtExceptionHandler. You should be able to implement your own custom UncaughtExceptionHandler to capture the exception. Then use the Thread.setDefaultUncaughtExceptionHandler to install it. It does require the 'RuntimePermission ("setDefaultUncaughtExceptionHandler")' in order to install your custom UncaughtExceptionHandler.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25190825

http://stackoverflow.com/comment/39028545
comment on: http://stackoverflow.com/q/25083295
score: 0
has text: @gipinani I just updated the question with that info.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39292107
has text: "I think what I did is pretty simple" no. This is simple: a class called VideoMetaData which contains whatever you want, such as ID and Title ` while(iteraterThing.hasNext()){ if(some condition){ VideoMetaData videoData = New VideoMetaData(); videoData.setID(...); videoData.setTitle(....); listOfVideoData.add(videoData); } }` what you're doing is is essentially creating your own very crude data object which is extremely difficult to change, relies on unusual parameters (i and j), and runs very poorly (O(n^2)). For the sake of your future endevers, change it.
comment on: http://stackoverflow.com/q/25223297
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/31625799
score: 0
has body: I only get this: *Comment #3 on issue 367 by samuel.a...@gmail.com: No binaries for Android on ARMv5 devices (Samsung Galaxy Ace/Pop/Y, LG Optimus One, etc.) https://code.google.com/p/javacv/issues/detail?id=367 Issue 330 has been merged into this issue.* Not really solve the problem，but may be useful to others.
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25216010
answers question: http://stackoverflow.com/q/25216010

http://stackoverflow.com/q/25197197
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25201263
type: UnansweredQuestion
tagged with: code-generation
upvote count: 1
tagged with: jsonschema
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: generating POJOs from JSON Schema for non-object types
has body: I am trying to generate POJOs from the JSON Schema of XMBC. I do this with jsonschema2pojo. However, nothing gets generated. It doesn't even bring me an error. This is a reduced sample json schema I am trying to generate from: { "description": "JSON-RPC API of XBMC", "id": "http://xbmc.org/jsonrpc/ServiceDescription.json", "methods": { "Addons.ExecuteAddon": { "description": "Executes the given addon with the given parameters (if possible)", "params": [ { "name": "addonid", "required": true, "type": "string" }, { "default": "", "name": "params", "type": [ { "additionalProperties": { "default": "", "type": "string" }, "type": "object" }, { "items": { "type": "string" }, "type": "array" }, { "description": "URL path (must start with / or ?", "type": "string" } ] }, { "default": false, "name": "wait", "type": "boolean" } ], "returns": { "type": "string" }, "type": "method" } }, "notifications": { "Application.OnVolumeChanged": { "description": "The volume of the application has changed.", "params": [ { "name": "sender", "required": true, "type": "string" }, { "name": "data", "properties": { "muted": { "required": true, "type": "boolean" }, "volume": { "maximum": 100, "minimum": 0, "required": true, "type": "integer" } }, "required": true, "type": "object" } ], "returns": null, "type": "notification" } }, "types": { "Addon.Content": { "default": "unknown", "enums": [ "unknown", "video", "audio", "image", "executable" ], "id": "Addon.Content", "type": "string" } }, "version": "6.14.3" } I must admin that my knowledge of JSON is very terse, maybe it is just a simple fault of mine. But can anyone help me how I can generate Java objects from such a JSON Schema?
type: Question

http://stackoverflow.com/a/25214560
type: AcceptedAnswer
has body: You never initialized String name; in WriteConfig before trying to use it for e.appendChild(dom.createTextNode(name));. Initialize the name variable to fix the error.
accepted answer of: http://stackoverflow.com/q/25214433
type: Answer
answers question: http://stackoverflow.com/q/25214433
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39271868
has comment: http://stackoverflow.com/comment/39271846
upvote count: 1

http://stackoverflow.com/q/25085419
has body: I have been working on the hadoop-2.4.0, in order to run java based hadoop example, I have put the needed lib on the CLASSPATH export HADOOP_HOME= /root/hadoop-binaries/hadoop-2.4.0 CLASSPATH=/root/hadoop-binaries/hadoop-2.4.0/conf CLASSPATH=$CLASSPATH:$HADOOP_HOME/*:$HADOOP_HOME/lib/* CLASSPATH=$CLASSPATH:$HADOOP_HOME/../hadoop-mapreduce/* CLASSPATH=$CLASSPATH:$HADOOP_HOME/../hadoop-mapreduce/lib/* CLASSPATH=$CLASSPATH:$HADOOP_HOME/../hadoop-yarn/* CLASSPATH=$CLASSPATH:$HADOOP_HOME/../hadoop-yarn/lib/* CLASSPATH=$CLASSPATH:$HADOOP_HOME/../hadoop-hdfs/* CLASSPATH=$CLASSPATH:$HADOOP_HOME/../hadoop-hdfs/lib/* CLASSPATH=$CLASSPATH:$HADOOP_HOME/../common/* CLASSPATH=$CLASSPATH:$HADOOP_HOME/../common/lib/* CLASSPATH=$CLASSPATH:$HADOOP_HOME/../tools/lib/* I have added all the needed HADOOP libraries from the HADOOP_HOME into the CLASSPATH. However, when I tried to run the example javac -cp $CLASSPATH HelloWorld.java It reminds me a error HelloWorld.java:4: error: package org.apache.hadoop.conf does not exist import org.apache.hadoop.conf.Configuration; ^ 1 error I don't know where to find the lib for the org.apache.hadoop.conf.
type: UnansweredQuestion
tagged with: java
has title: can't find the lib for the org.apache.hadoop.conf in hadoop 2.4.0
type: Question
tagged with: hadoop2
tagged with: hadoop
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25085504

http://stackoverflow.com/a/25125499
has comment: http://stackoverflow.com/comment/39106391
has comment: http://stackoverflow.com/comment/39106296
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39106119
type: Answer
has body: You can use: String repl = "a/b/c/d/data/info".replaceFirst("^.*?data/([^/]+)$", "$1"); //=&gt; info
accepted answer of: http://stackoverflow.com/q/25125381
has comment: http://stackoverflow.com/comment/39106351
answers question: http://stackoverflow.com/q/25125381
upvote count: 1
has comment: http://stackoverflow.com/comment/39106307
has comment: http://stackoverflow.com/comment/39106279
has comment: http://stackoverflow.com/comment/39106141
score: 1

http://stackoverflow.com/a/25069727
answers question: http://stackoverflow.com/q/25069691
type: Answer
downvote count: 0
has body: I think you should replace failT =+ 1; with failT += 1;
score: 1
upvote count: 1

http://stackoverflow.com/comment/39078232
score: 0
type: Comment
type: QuestionComment
has text: Yep you are right not all deadlocks can be removed but this one can. I saw innodb status and two threads locked the same page. I think this particular query could be retried.
comment on: http://stackoverflow.com/q/25110544

http://stackoverflow.com/comment/39028966
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25070003
has text: When I start the consumer, I see Zookeeper display this output: [2014-08-01 15:56:38,045] INFO Accepted socket connection from /98.101.159.194:24218 (org.apache.zookeeper.server.NIOServerCnxn) [2014-08-01 15:56:38,049] INFO Client attempting to establish new session at /98.101.159.194:24218 (org.apache.zookeeper.server.NIOServerCnxn) [2014-08-01 15:56:38,053] INFO Established session 0x1478e963fb30008 with negotiated timeout 6000 for client /98.101.159.194:24218 (org.apache.zookeeper.server.NIOServerCnxn)

http://stackoverflow.com/q/25205894
has comment: http://stackoverflow.com/comment/39256534
tagged with: arraylist
linked to: http://stackoverflow.com/q/1035008
answer count: 1
has comment: http://stackoverflow.com/comment/39255392
has body: Consider a method that returns a Collection or a method that needs a Collection as one of its parameters. Which is the simplest concrete type I can/should use? ArrayList HashSet (something else) I know that some will say "it depends", but what I want is a hard and fast rule of thumb that doesn't require you to do much thinking/analysis.
accepted answer: http://stackoverflow.com/a/25206032
favorite count: 0
score: -4
has comment: http://stackoverflow.com/comment/39255251
tagged with: collections
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39255327
tagged with: java
has comment: http://stackoverflow.com/comment/39255382
has comment: http://stackoverflow.com/comment/39255305
has comment: http://stackoverflow.com/comment/39255367
has answer: http://stackoverflow.com/a/25206032
type: Question
downvote count: 4
upvote count: 0
tagged with: hashset
has title: ArrayList vs HashSet as the simplest Collection

http://stackoverflow.com/q/25117232
has answer: http://stackoverflow.com/a/25117271
tagged with: java
has answer: http://stackoverflow.com/a/25117492
has body: Could anyone help me find to check return type of a method is of specific type in JAVA. I tried this. But unfortunately it doesn't work. Please guide me. Field[] fields = LanguageTranslation.class.getFields(); for(Field f : fields ){ System.out.println("Type is:"+f.getType()+"\t Name:"+f.getName()); if(f.getType().equals(JLabel)) { System.out.println("Field is of type "+f.getType()); //other stuff } Here f.getType() returns an object, I want to check weather it is a JLabel or not. If it is, I have other stuff to do. I tried above code , error is JLabel cannot be resolved to a variable I have declared one JLabel in class as public JLabel testingText=null; please help me in this
has comment: http://stackoverflow.com/comment/39091404
score: 0
answer count: 2
has title: how to check return type of method is JLabel
has comment: http://stackoverflow.com/comment/39090703
tagged with: jlabel
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39090551
linked to: http://stackoverflow.com/q/8921165
tagged with: swing
has comment: http://stackoverflow.com/comment/39090552
type: Question

http://stackoverflow.com/comment/39117902
has text: Why do you need it? You already have the equivalent string.
score: 1
comment on: http://stackoverflow.com/q/25131922
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39188929
type: QuestionComment
has text: The best practice is having **one** texture file, and selecting TextureRegions from it (read up on TexturePacker and the TextureAtlas if you can't piece them together using Paint or something else). Although I personally only did 2D, not 3D, so no experience with the cubes and stuff. But the `render()` function runs every 50 ms at least, which means you're basically creating 20 texture files per second and Textures are native resources.
score: 0
comment on: http://stackoverflow.com/q/25169927
type: Comment

http://stackoverflow.com/comment/39282891
type: Comment
has text: No need to declare any function do this within on your onclick.
comment on: http://stackoverflow.com/a/25220301
type: AnswerComment
score: 0

http://stackoverflow.com/q/25118213
has title: Understanding Annonations in Eclipse Editor
tagged with: java
tagged with: markers
has answer: http://stackoverflow.com/a/25118315
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/25118315
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25118344
has comment: http://stackoverflow.com/comment/39092665
score: 0
answer count: 2
has body: I am trying to learn Eclipse editor annonations from this site: http://www.ibm.com/developerworks/opensource/tutorials/os-eclipse-plugin-guide It seems a preety good tutorial, but any code that I copied to my eclipse workspace, it shows always error "multiple marker in one line" For example, when I copy the following code: public static IMarker createMarker(IResource res) throws CoreException { IMarker marker = null; //note: you use the id that is defined in your plugin.xml marker = res.createMarker("com.ibm.mymarkers.mymarker"); marker.setAttribute("description," "this is one of my markers"); //note: you can also use attributes from your supertype marker.setAttribute(IMarker.MESSAGE, "My Marker"); return marker; } I will get the error that multiple markers in one line. Can you please help me regards this? I am really frustrated with it and already spent 2 hours after it.
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39092286
possible better answer: http://stackoverflow.com/a/25118344
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39092202

http://stackoverflow.com/q/25213432
tagged with: variables
has title: Variable types in Java?
has body: Sometimes I see methods that have a parameter like public method(ObjectName variable) Does that mean this method only accepts ClassName's objects? For example from another class? it might be a simple question but I am used to seeing only int's, Strings etc. as parameters. I guess some methods can accept instances of other classes? How does compiler know then that the class in the parameter is valid? Does it know it from imports?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25213516
tagged with: parameters
tagged with: object
tagged with: java
has answer: http://stackoverflow.com/a/25213460
type: Question
score: 0
answer count: 2

http://stackoverflow.com/comment/39291844
type: QuestionComment
comment on: http://stackoverflow.com/q/25174354
type: Comment
has text: the first two synchronize on the instance object, the last one on the class (which is equivalent to a `synchronized static` method). With a synchronized block instead of method you can be more selective. It is typically good to have smaller blocks. However when you need to lock the whole method some JVMs are a bit faster when the whole method is marked synchronized (less byte code).
score: 0

apache
tag name: apache
tags question: http://stackoverflow.com/q/25097791
tags question: http://stackoverflow.com/q/25076962
tags question: http://stackoverflow.com/q/25093512
tags question: http://stackoverflow.com/q/25202783
tags question: http://stackoverflow.com/q/25126112
tags question: http://stackoverflow.com/q/25072438
tags question: http://stackoverflow.com/q/25182090
tags question: http://stackoverflow.com/q/25103145
tags question: http://stackoverflow.com/q/25136075
tags question: http://stackoverflow.com/q/25136040
type: Tag
tags question: http://stackoverflow.com/q/25163969
tags question: http://stackoverflow.com/q/25138394
tags question: http://stackoverflow.com/q/25152625
tags question: http://stackoverflow.com/q/25209286
tags question: http://stackoverflow.com/q/25118727
tags question: http://stackoverflow.com/q/25110544

http://stackoverflow.com/q/25216217
has answer: http://stackoverflow.com/a/25216253
accepted answer: http://stackoverflow.com/a/25216253
tagged with: java
tagged with: multithreading
has title: Do all Swing components run on the EDT by default?
tagged with: swing
downvote count: 1
has body: I'm new to Java and after reading many articles about threads and swing I understood that all the invocations of Swing methods should be done on the EDT because Swing is not thread safe. however, I already wrote a couple of quite long Swing applications before reading about the EDT. and all of my applications ran quite fine. So my question is were my Swing applications running on the EDT by default or were they running on a different thread and i was just lucky not to have any issues with them? Like for example if I add a JButton to a JPanel or JFrame, or if I simply call a JTextField's Field.setText(), will these operations be running on the EDT by default or no? and if the answer is no, then do I have to explicitly send all my Swing component's methods implementations to run on the EDT by invoking SwingUtilities.invokeLater() Thanks
type: Question
upvote count: 5
possible better answer: http://stackoverflow.com/a/25216264
score: 4
answer count: 3
has answer: http://stackoverflow.com/a/25216264
linked to: http://stackoverflow.com/q/3014972
favorite count: 0
has comment: http://stackoverflow.com/comment/39279668
linked to: http://stackoverflow.com/q/11825281
has answer: http://stackoverflow.com/a/25216291
type: AnsweredQuestion

http://stackoverflow.com/comment/39009973
type: Comment
type: AnswerComment
has text: why downvotes? I think need some explanation here. This provide the correct answer to OP's question.
comment on: http://stackoverflow.com/a/25073617
score: 0

http://stackoverflow.com/comment/39185389
comment on: http://stackoverflow.com/q/25168024
type: Comment
type: QuestionComment
has text: @jhobbie - It may be that both `return` statements branch to the same location, near the `finally` code. It may be that there's a surrounding `try/finally` block that needs to be executed. It may be that the debugger just wants to drive you crazy. (Debuggers are like that, you know -- something evil in all of them.)
score: 0

http://stackoverflow.com/q/25170082
has comment: http://stackoverflow.com/comment/39189530
has comment: http://stackoverflow.com/comment/39189145
has comment: http://stackoverflow.com/comment/39189582
possible better answer: http://stackoverflow.com/a/25170402
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25170402
has body: So, granted I'm pushing the envelope of my limited Java knowledge. I would like to have an array of objects within a class. I thought this was as subclass but that's not what I want. I don't know what I want. Here is the java docs example. public class Bicycle { // the Bicycle class has three fields public int cadence; public int gear; public int speed; // the Bicycle class has one constructor public Bicycle(int startCadence, int startSpeed, int startGear) { gear = startGear; cadence = startCadence; speed = startSpeed; } // the Bicycle class has four methods (getters/setters removed) // here is my new thought - not sure if its right public class DriveChain { public int big-chainring public int little-chainring public int chain // and getters and setters } // here i want to create an array of this. ArrayList&lt;DriveChain&gt; dcArray ; // here i can add to the array public void addDriveChain(drivechain dc) { this.dcArray.add(dc); } } I want to add fields with getters and setters within this class and treat it as an array list. For example as above. Hope I am making sense.
has comment: http://stackoverflow.com/comment/39189619
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39189790
has answer: http://stackoverflow.com/a/25170455
accepted answer: http://stackoverflow.com/a/25170455
has title: How to construct a group of objects within a class in Java
type: Question

http://stackoverflow.com/q/25212405
favorite count: 0
has body: In my program, I get the following javascript alert I am able to switch to this alert. I am able to get the text and click the OK and Cancel buttons. The issue I am having is when using assertequals to verify the alert text. I am using the below code String Test = driver.switchTo().alert().getText(); System.out.println(Test); Assert.assertEquals(Test, "You are sharing your report with \"Limited Overall-10000 \".\n\nThis will share your report with \"179\" people. Continue?"); System.out.println correctly prints the text of the alert box. However, I get the below error when trying to use assertequals. Its strange because these same steps work for other javascript alerts on the page. org.openqa.selenium.WebDriverException: [JavaScript Error: "e is null" {file: "file:///C:/Users/IBM_AD~1/AppData/Local/Temp/anonymous2086351268768311654webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js" line: 7716}]
has answer: http://stackoverflow.com/a/26753574
upvote count: 2
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: selenium
downvote count: 1
has answer: http://stackoverflow.com/a/26756637
type: Question
has comment: http://stackoverflow.com/comment/39268056
has comment: http://stackoverflow.com/comment/39267776
has comment: http://stackoverflow.com/comment/39268020
tagged with: javascript
has comment: http://stackoverflow.com/comment/39267979
has title: Getting JavaScript Error: "e is null" when using assert to verify javascript alert text
answer count: 2

restful-architecture
type: Tag
tag name: restful-architecture
tags question: http://stackoverflow.com/q/25162352

http://stackoverflow.com/comment/39064503
type: QuestionComment
has text: I suggest you use your debugger to debug your code. If you step through the code line by line you will get a better understanding of why it does what it does and where it does something different to what you want.
comment on: http://stackoverflow.com/q/25103434
score: 1
type: Comment

http://stackoverflow.com/q/25195907
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/39236773
has comment: http://stackoverflow.com/comment/39236810
has comment: http://stackoverflow.com/comment/39237123
has comment: http://stackoverflow.com/comment/39236980
favorite count: 0
has comment: http://stackoverflow.com/comment/39237916
possible better answer: http://stackoverflow.com/a/25196861
has comment: http://stackoverflow.com/comment/39630392
has answer: http://stackoverflow.com/a/25509257
has comment: http://stackoverflow.com/comment/39579528
has answer: http://stackoverflow.com/a/25196861
has comment: http://stackoverflow.com/comment/39237216
has comment: http://stackoverflow.com/comment/39236840
tagged with: servlet-filters
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39237157
has comment: http://stackoverflow.com/comment/39237106
has body: hi I am working on one web application and facing issue while invoking servelets mentioned in web.xml. Here is my web.xml <?xml version="1.0" encoding="UTF-8"?> FileServlet com.tpg.fileserver.FileServlet FileServlet /* AuthorizationFilter com.tpg.fileserver.AuthorizationFilter AuthorizationFilter /* The issue is that when i m trying to run my application I want the Authroization Filter to run first and then The File Servelet. Right now what is happening is the reverse of what i want. I also tried using 0 for File Servelet but that didnt helped.Below mentioned is my Filter Class code. public class AuthorizationFilter implements Filter { private static final String kNotAuthorizedUrl = "/NotAuthorized.html"; private static final String kTrustedHostsFileName = "trusted_hosts.txt"; private static final String kPublicFilesFileName = "public_files.txt"; private static final String TRUSTED_HOSTS = "TRUSTED_HOSTS"; private static final String PUBLIC_FILES = "PUBLIC_FILES"; private static Properties itsProperties = null; public static final String kPropertySingleSignOnURL = "sso-url"; private static final String kPropertiesFileName = "metadata.properties"; private static boolean itsInitialized = false; private static synchronized void initialize() { if (!itsInitialized) { try { ProductMetadataAPI.setProduct(Version.kProductName, Version.kPhysical); System.out.println("Inside Initialize"); PersistenceAPI.isDebugging = true; JNDIConnectionFactory connFactory = new JNDIConnectionFactory("DataSource"); // IDB SingleSignOnAuthenticator.setAuthenticationUrl(ConfigurationUtils.getProperties().getProperty(kPropertySingleSignOnURL)); SecurityAPI.setSecurity( SecurityAPI.makeSecurity( new StandardFactory(), new PersistenceRepository(connFactory), new CommonsBase64Codec(), new SingleSignOnAuthenticator())); itsInitialized = true; } catch (Throwable e) { LoggerClass.logErr(e); } } } private void requestAuthentication(HttpServletResponse response) { response.setStatus(HttpServletResponse.…
tagged with: java
has comment: http://stackoverflow.com/comment/39237581
has comment: http://stackoverflow.com/comment/39236922
downvote count: 1
accepted answer: http://stackoverflow.com/a/25509257
type: Question
tagged with: jakarta-ee
score: 3
has comment: http://stackoverflow.com/comment/39237281
has comment: http://stackoverflow.com/comment/39236775
has title: How to Invoke Servlet and Filter in sequence
linked to: http://stackoverflow.com/q/1323009
has comment: http://stackoverflow.com/comment/39630359
tagged with: servlets
has comment: http://stackoverflow.com/comment/39237553

http://stackoverflow.com/comment/39142581
score: 0
has text: @tzimnoch Before saying it doesn't work did you try the above solution?
type: Comment
comment on: http://stackoverflow.com/a/25135691
type: AnswerComment

http://stackoverflow.com/q/25208727
type: Question
tagged with: mocking
has answer: http://stackoverflow.com/a/25208874
accepted answer: http://stackoverflow.com/a/25208874
tagged with: mockito
answer count: 1
score: 0
has title: How can I stub a method that takes a Generic class as a param?
has body: I have a class under test that needs to stub out a call on a dependent class. The code that needs to be stubbed looks like this: public class A { ... public void methodThatNeedsToBeStubbed(GenericClass genericClass){ ... } } This doesn't compile: when(mockA.methodThatNeedsToBeStubbed(any(GenericClass&lt;SomeDifferentClass&gt;)) I'm not sure how to get this to work with a generic class as a param?
tagged with: junit
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/25220523
has body: Random number functions depend on an initial value from which they generate a sequence of random numbers (read up on PRNG - Pseudo Random Number Generation). The next functions will return the next number generated from that initial value (the seed). generateSeed() will generate a new initial value for a PRNG to use.
type: Answer
has comment: http://stackoverflow.com/comment/39283480
upvote count: 3
has comment: http://stackoverflow.com/comment/39283448
answers question: http://stackoverflow.com/q/25220492
has comment: http://stackoverflow.com/comment/39283424
score: 3
downvote count: 0

http://stackoverflow.com/a/25155187
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25155067
answers question: http://stackoverflow.com/q/25155067
type: Answer
has body: Yes, Quartz supports different JobStores and Misfires to sustain server shutdown and crashes. See: http://quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-09

http://stackoverflow.com/a/25081814
answers question: http://stackoverflow.com/q/25081475
has body: You have picked it right, semantics of these methods sometimes cause confusion. Here is practical use of two methods: You can use load in cases where you have to set a foreign key relationship, you can set a object without actually loading it. Load only ensures that object with that id exists and thats why you find it throwing ObjectNotFoundException Car c = new Car(); Engine e = (Stock)session.load(Engine.class, new Integer(1)); c.setEngine(e); session.save(c); Note you only need to set engine in car you don't need actually any of the properties of engine. Use get when you actually need that object. Engine e = (Stock)session.get(Engine.class, new Integer(1)); System.out.println(e.getYear(); Hope this clarifies. Also refer Whats the advantage of load() vs get() in Hibernate? Hibernate: Difference between session.get and session.load Cheers !!
score: 0
type: Answer

http://stackoverflow.com/a/25132917
has comment: http://stackoverflow.com/comment/39120352
downvote count: 0
has comment: http://stackoverflow.com/comment/39119665
has comment: http://stackoverflow.com/comment/39121217
has comment: http://stackoverflow.com/comment/39121080
type: Answer
has comment: http://stackoverflow.com/comment/39120749
upvote count: 6
has comment: http://stackoverflow.com/comment/39119718
has body: Just use single ${...} surrounding all the conditions as value of test attribute. sample code: &lt;c:forEach items="${result}" var="item"&gt; &lt;c:if test="${item.key !='update' &amp;&amp; item.key !='error' &amp;&amp; item.key !='create' &amp;&amp; item.key !='number' &amp;&amp; item.key !='fileName'}"&gt; ... &lt;/c:if&gt; &lt;/c:forEach&gt; &amp;&amp; can only be executed inside ${...}. Learn more...
score: 6
answers question: http://stackoverflow.com/q/25132680

http://stackoverflow.com/q/25187161
has comment: http://stackoverflow.com/comment/39220078
has comment: http://stackoverflow.com/comment/39221671
has comment: http://stackoverflow.com/comment/39220286
has comment: http://stackoverflow.com/comment/39220130
type: AnsweredQuestion
has title: Error: Could not find or load main class JDBCExample
downvote count: 0
tagged with: cmd
score: 1
has comment: http://stackoverflow.com/comment/39220967
favorite count: 0
has comment: http://stackoverflow.com/comment/39220067
has answer: http://stackoverflow.com/a/25347872
tagged with: postgresql
has body: Hello I am trying to run a java file in cmd (Windows) with this: C:\test>java -cp c:\test\postgresql-9.3-1102.jdbc41.jar;c:\test JDBCExample where postgresql-9.3-1102.jdbc41.jar &amp; JDBCExample are already in the folder "test". and JDBCExample.java is: import java.sql.DriverManager; import java.sql.Connection; import java.sql.SQLException; public class JDBCExample { public static void main(String[] args) { System.out.println("-------- PostgreSQL " + "JDBC Connection Testing ------------"); try { Class.forName("org.postgresql.Driver"); } catch (ClassNotFoundException e) { System.out.println("Where is your PostgreSQL JDBC Driver? " + "Include in your library path!"); e.printStackTrace(); return; } System.out.println("PostgreSQL JDBC Driver Registered!"); Connection connection = null; try { connection = DriverManager.getConnection( "jdbc:postgresql://127.0.0.1:5432/testdb", "java_postgres", "4scoreand7yearsago"); } catch (SQLException e) { System.out.println("Connection Failed! Check output console"); e.printStackTrace(); return; } if (connection != null) { System.out.println("You made it, take control your database now!"); } else { System.out.println("Failed to make connection!"); } } } I have tried to run a simple "Hello World" java file in the same "test" folder yet it also says the same error. And next, I also tried changing directory to a source folder of a .java file which I am REALLY SURE that it works perfect in Netbeans or Eclipse, (sorting algo and etc), yet still in the cmd it says the same error when compiling. :( Any help? Also, I already added in the Path of my computer's Environment Variables a "C:\Program Files\Java\jdk1.7.0_45\bin;" and added a new one named CLASSPATH where it points to a "C:\Program Files\Java\jdk1.7.0_45\bin;C:\Program Files\Java\jre7\bin" but to no avail, still the same error. OR COULD ANY OF YOU JUST HELP ME FIND ANOTHER WAY OF SETTING UP THE JDBC DRIVE. THAT'S ALL THANK YOU. T_T
has comment: http://stackoverflow.com/comment/39221364
type: Question
has comment: http://stackoverflow.com/comment/39220354
has comment: http://stackoverflow.com/comment/39220126
has comment: http://stackoverflow.com/comment/39220426
tagged with: java
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/25347872
has comment: http://stackoverflow.com/comment/39220185

http://stackoverflow.com/q/25222325
tagged with: java
linked to: http://stackoverflow.com/q/6157020
type: Question
duplicate of: http://stackoverflow.com/q/6157020
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/25222843
score: 2
has answer: http://stackoverflow.com/a/25223315
favorite count: 0
has body: I have an int[image.height][image.width] array of the image. Now I'm trying to turn it back to image file but I've failed. This is what I have done: private void intToImg(int[][] pxls,String path){ BufferedImage image = new BufferedImage(pxls[0].length, pxls.length, BufferedImage.TYPE_INT_ARGB); WritableRaster raster = (WritableRaster)image.getData(); int[] pxlsr=new int[pxls[0].length*pxls.length]; int k=0; for(int i=0;i&lt;pxls.length;i++)for(int j=0;j&lt;pxls[0].length;j++)pxlsr[k++]=pxls[i][j]; raster.setPixels(0,0,pxls[0].length-10,pxls.length-10,pxlsr);//index out of bounds error here... File f = new File(path); try{ImageIO.write(image, "JPG", f);} catch (IOException x){x.printStackTrace();} } However I always have the same error java.lang.ArrayIndexOutOfBoundsException. What did I do wrong and what is the right way to transform array of pixels into real image? I've just increased array length in 4 and java.lang.ArrayIndexOutOfBoundsException has finally disapeared. But I'm still can't create real image. Instead I have image filled with #000009 no matter what value of array. This is what i was doing: for(int i=0;i&lt;pxls.length;i++)for(int j=0;j&lt;pxls[0].length;j++){ pxlsr[k++]=pxls[i][j]; pxlsr[k++]=pxls[i][j]; pxlsr[k++]=pxls[i][j]; pxlsr[k++]=pxls[i][j]; } raster.setPixels(0,0,pxls[0].length,pxls.length,pxlsr); and for(int i=0;i&lt;pxls.length;i++)for(int j=0;j&lt;pxls[0].length;j++){ pxlsr[k++]=111; pxlsr[k++]=111; pxlsr[k++]=111; pxlsr[k++]=111; } raster.setPixels(0,0,pxls[0].length,pxls.length,pxlsr); and many other thing but the result is allways the same - image filled with black color!
has title: how do I create image from int[][] array of pixels
upvote count: 2
has answer: http://stackoverflow.com/a/25222414
type: UnansweredQuestion

http://stackoverflow.com/a/25201476
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25201142
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25201142
has body: All methods in the action class that have get prefix comply to the JavaBeans convention and could be used as properties of the action bean. This is also called a getter. The action configuration doesn't have any restrictions to map an action to a method with such name. When the action is called the method is executed, and you have mistaken thinking that the action is called twice. Methods used as a getter in the action class could be called to access the property. It can be OGNL, JSON or any other code using BeanInfo to access properties and call a getter method. Better not to name methods mapped to the action with a getter to not confuse developers.

http://stackoverflow.com/comment/39266490
type: Comment
type: QuestionComment
has text: Can you than check if you're using the same classloader policy as your other teammates? Also are you using the same JDK version as they are and also the same O.S? It is indeed very strange that it runs on WebSphere with no errors for your teammates and it doesn't work for you.
comment on: http://stackoverflow.com/q/25183955
score: 0

http://stackoverflow.com/comment/39043907
score: 1
type: AnswerComment
has text: -1 don't brag about bad habits...
type: Comment
comment on: http://stackoverflow.com/a/25092157

http://stackoverflow.com/comment/39090892
has text: Then post the handler
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25116597
type: QuestionComment

http://stackoverflow.com/comment/39048041
type: Comment
comment on: http://stackoverflow.com/a/25092697
score: 0
type: AnswerComment
has text: Try two different inserts rather than union all, if it helps.

http://stackoverflow.com/q/25132547
upvote count: 7
has body: How to mock a void method which is non-static, non-finalThe signature of method is as below. I'm using Powermockito. public class Name{ public void methodName{ ... ... } } @RunWith(PowerMockRunner.class) @PrepareForTest({Name.class}) public class TestClass{ @Test public void testMethodName(){ PowerMockito.doNothing().when(Name.class, methodName); //some when calls after this and assert later on } I want to DO Nothing when methodName is called. the above code is not working. it says methodName cannot be resolved.
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/25133632
has answer: http://stackoverflow.com/a/58182795
answer count: 3
downvote count: 0
score: 7
has answer: http://stackoverflow.com/a/25132999
favorite count: 0
tagged with: powermock
type: UnansweredQuestion
has title: how to mock a void method in powermock
tagged with: junit4
tagged with: java

http://stackoverflow.com/comment/39195208
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25173305
has text: Why the downvote, with no comment? This answer appears to me to be correct.

http://stackoverflow.com/q/25147435
answer count: 1
has title: Java SSLHandshakeException on one server but not another?
favorite count: 0
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25147961
type: Question
accepted answer: http://stackoverflow.com/a/25147961
has body: In an attempt to debug this SSL issue that came up on one of our servers recently I wrote a very simple program to connect to an SSL site in our intranet. URL authURL = null; BufferedReader br = null; String url = "https://our.server:443"; try { authURL = new URL(url); HttpURLConnection conn = (HttpURLConnection) authURL.openConnection(); conn.setDoOutput(false); conn.setDoInput(true); conn.setAllowUserInteraction(false); conn.setUseCaches(false); conn.connect(); } catch (MalformedURLException urlEx) { urlEx.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) {} }//if }//finally This code fails with SSLHandshakeException on one of our servers, but the same exact code works without issue on another server. I ran the programs with SSL debugging enabled and here are results of each server WORKING SERVER - SLES 11.3, Java IBM 1.6.0 64-bit ... no IV used for this cipher main, WRITE: SSLv3 Change Cipher Spec, length = 1 JsseJCE: Using cipher RC4 from provider TBD via init CipherBox: Using cipher RC4 from provider from init IBMJCE version 1.2 JsseJCE: Using MAC SslMacSHA1 from provider TBD via init MAC: Using MessageDigest SslMacSHA1 from provider IBMJCE version 1.2 *** Finished verify_data: { 101, 62, 81, 35, 13, 178, 124, 13, 43, 0, 5, 248, 32, 15, 39, 244, 97, 96, 98, 227, 1 8, 172, 226, 53, 71, 218, 210, 21, 72, 85, 44, 130, 175, 194, 228, 34 } *** main, WRITE: SSLv3 Handshake, length = 60 main, READ: SSLv3 Change Cipher Spec, length = 1 JsseJCE: Using cipher RC4 from provider TBD via init CipherBox: Using cipher RC4 from provider from init IBMJCE version 1.2 JsseJCE: Using MAC SslMacSHA1 from provider TBD via init MAC: Using MessageDigest SslMacSHA1 from provider IBMJCE version 1.2 main, READ: SSLv3 Handshake, length = 60 *** Finished verify_data: { 160, 27, 2, 24, 10, 15, 205, 204, 241, 225, 183, 150, 243, 244, 43, 107, 40, 112, 173 42, 122, 139, 225, 16, 33, 168, 255, 184, 23, 18…
score: 1
tagged with: java
tagged with: ssl
has comment: http://stackoverflow.com/comment/39147806
upvote count: 1

http://stackoverflow.com/comment/39242608
type: Comment
has text: Please share what have you tried. Edit it in your actual question. How are you passing the object?
comment on: http://stackoverflow.com/a/25198818
score: 0
type: AnswerComment

http://stackoverflow.com/q/25183209
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39212425
accepted answer: http://stackoverflow.com/a/25183234
type: Question
linked to: http://stackoverflow.com/q/218384
tagged with: arrays
downvote count: 0
answer count: 1
has title: NullPointerException on array with length one initializing
favorite count: 0
has answer: http://stackoverflow.com/a/25183234
has body: This is my method to updateHighScoreRecords(): public GameRecord[] updateHighScoreRecords(GameRecord[] highScoreRecords, String name, int level, int score) { GameRecord[] gameRecord = null; if (highScoreRecords.length == 0) { // Rule one gameRecord = new GameRecord[1]; gameRecord[0].setName(name); gameRecord[0].setLevel(level); gameRecord[0].setScore(score); System.out.println("Role one Done"); } return gameRecord; } And this is my GameRecord class: public class GameRecord { private String name; private int level; private int score; public GameRecord(String name, int level, int score) { this.name = name; this.level = level; this.score = score; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getLevel() { return level; } public void setLevel(int level) { this.level = level; } public int getScore() { return score; } public void setScore(int score) { this.score = score; } } But there is a nullPointer exception on this line: gameRecord[0].setName(name); Why? I want to return an array of GameRecord type when highScoreRecords length is zero.
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39212371

http://stackoverflow.com/a/25199869
score: 0
type: Answer
has body: The possible way is is to set in the session like something below, session.setAttribute("varName", "value"); response.sendRedirect("/resultPage"); This will redirect to the result page and you can get the value from session as, session.getAttribute("varName"); the session object will be available through out the application till you invalidate it manually. The reason why RequestDispatcher forward() method holds the request object is that it forwards the same request and sendRedirect() doesnt do that because it creates new request each time Learn More ..
answers question: http://stackoverflow.com/q/25199107

null
tags question: http://stackoverflow.com/q/25159785
tag name: null
tags question: http://stackoverflow.com/q/25104346
tags question: http://stackoverflow.com/q/25117839
tags question: http://stackoverflow.com/q/25185650
type: Tag
tags question: http://stackoverflow.com/q/25077997
tags question: http://stackoverflow.com/q/25184447
tags question: http://stackoverflow.com/q/25213625

http://stackoverflow.com/comment/39034389
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25085569
has text: You may want to look at this SO posting: http://stackoverflow.com/questions/7019912/using-the-rjava-package-on-win7-64-bit-with-r
type: Comment

http://stackoverflow.com/a/25200667
type: Answer
answers question: http://stackoverflow.com/q/25200511
has comment: http://stackoverflow.com/comment/39245394
has comment: http://stackoverflow.com/comment/39246943
score: 0
has body: I don't think you need to add any extra repository tag to fetch spring-ldap artifact. You only need to specify the repository when the artifact doesn't belong to the default maven repo for e.g., Jboss Repository https://repository.jboss.org/, you need to add this in your pom to fetch any artifact of this repository. you simple add below dependency in your pom and it should work. org.springframework.ldap spring-ldap 1.3.1.RELEASE Are you having any problem in downloading artifact without specifying repository?

http://stackoverflow.com/comment/39089759
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25116916
has text: It seems like your views might not have been initialized.
type: Comment

http://stackoverflow.com/comment/39296948
type: Comment
type: QuestionComment
has text: i would like "Europe/Berlin" to return GERMAN and "Europe/Paris" to return FRENCH . it might be that two countries sharing the the same hours in their timezone might have different definitions regarding first day of the week etc ..
comment on: http://stackoverflow.com/q/25226881
score: 0

http://stackoverflow.com/q/25117896
answer count: 1
has comment: http://stackoverflow.com/comment/39100225
has comment: http://stackoverflow.com/comment/39096563
has title: GXT 3 XTemplate: Custom Formatter - ClassNotFoundException
has comment: http://stackoverflow.com/comment/39150158
score: 0
has body: I am trying to use a custom formatter to turn a boolean into "Yes" or "No" and have run into a roadblock. My IDE (Eclipse) does not indicate any errors but when I try to compile I receive [ERROR] Annotation error: cannot resolve foobar.client.formatter.YesNoFormatter - exception: ClassNotFoundException followed by a few other exceptions that appear to stem from this exception. I understand what a ClassNotFoundException indicates however I cannot figure out why I would be getting it since, as my code shows, the YesNoFormatter class is located in foobar.client.formatter and I can access it through GWT.log("True: " + YesNoFactory.getFormat().format(Boolean.TRUE); I am using GXT 3.1.0 and GWT 2.6.1. Could anybody have an idea of why I am getting this exception? The example given at http://docs.sencha.com/gxt-guides/3/utility/xtemplates/XTemplates.html doesn't mention anything (as far as I can see) about these classes needing to be in specific locations so I am at a loss. EntryPoint: package foobar.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.safehtml.shared.SafeHtml; import com.sencha.gxt.core.client.XTemplates.FormatterFactories; import com.sencha.gxt.core.client.XTemplates.FormatterFactory; public class TestClass implements EntryPoint { @FormatterFactories(@FormatterFactory(factory=YesNoFactory.class, name="yesNo")) public interface Renderer extends XTemplates { @XTemplate(source="yesNo.html") SafeHtml render(Boolean b); } @Override public void onModuledLoad() { GWT.log("True: " + YesNoFactory.getFormat().format(Boolean.TRUE); Renderer r = GWT.create(Renderer.class); Window.alert(r.render(true).asString()); } } YesNo: package foobar.client.formatter; import com.sencha.gxt.core.client.XTemplates.Formatter; public class YesNo implements Formatter&lt;Boolean&gt; { @Override public String format(Boolean data) { if (data == null) { return null; } return (data) ? "Yes" : "No"; } } YesNoFactory: package fo…
has comment: http://stackoverflow.com/comment/39103199
has comment: http://stackoverflow.com/comment/39096692
accepted answer: http://stackoverflow.com/a/25309703
has comment: http://stackoverflow.com/comment/39112954
has comment: http://stackoverflow.com/comment/39149950
has comment: http://stackoverflow.com/comment/39096986
tagged with: gwt
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39092220
tagged with: gxt
has comment: http://stackoverflow.com/comment/39112976
type: Question
has answer: http://stackoverflow.com/a/25309703

http://stackoverflow.com/q/25153865
tagged with: xpath
has title: XML Datasource in report is not working
has answer: http://stackoverflow.com/a/25183417
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jasper-reports
accepted answer: http://stackoverflow.com/a/25183417
has comment: http://stackoverflow.com/comment/39169563
answer count: 1
downvote count: 0
has body: I want to compile a .JRXML file with an XML Datasource in Java. It works perfectly within iReport. In Java, it does not work. When I set the main query language to 'xpath', the report is generated, but with no xml data in it. With 'xpath2' as the main query language, I get an error "No query executer factory registered for the 'xpath2' language" and the report is not being generated. It doesn't even work with the simplest report you can think of. What I've tried so far: Checked for the following line in jasperreports.properties: net.sf.jasperreports.query.executer.factory.xpath2=com.jaspersoft.jrx.query.JRXPathQueryExecuterFactory Checked for the .jar file "jasperreports-extensions-3.5.3.jar" in my applications classpath Added this line to my Java code: jasperReport.setProperty("net.sf.jasperreports.query.executer.factory.xpath2", "com.jaspersoft.jrx.query.JRXPathQueryExecuterFactory"); Set the XML Datasource in Java: org.w3c.dom.Document document = JRXmlUtils.parse(JRLoader.getLocationInputStream(args[2])); params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document); My report generation code: JasperReport jasperReport = JasperCompileManager.compileReport(args[0]); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, new JREmptyDataSource()); JasperExportManager.exportReportToPdfFile(jasperPrint, args[1]); After adding jasper-compiler-jdt-5.5.23.jar to my Java Build Path, I got rid of the xpath2 error. The report is generated, but with no data source.
favorite count: 0

http://stackoverflow.com/q/25104555
has body: I have jsonparser class to read the page line by line and convert it to json.But in my jsonparser class when i try to read the page line by line reader.readLine() returns null. This is my JsonParser.java final String TAG = "JsonParser.java"; static InputStream is = null; static JSONObject jObj = null; static String json = ""; public JSONObject getJSONFromUrl(String url) { // make HTTP request try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { if(line.contains(";")) { line=line.replace(";", ""); } if(line.contains("info = ")) { line.replace("info = ",""); } sb.append(line + "\n"); } is.close(); Log.e(TAG, "Control5"); json=sb.toString(); }catch(IOException e) { Log.e(TAG, "IOException occurred!!"); } catch (Exception e) { Log.e(TAG, "Error converting result " + e.toString()); } // try parse the string to a JSON object try { Log.e(TAG,json); jObj = new JSONObject(json); } catch (JSONException e) { Log.e(TAG, "Error parsing data " + e.toString()); } // return JSON String return jObj; } And i use this class in my MainActivity.java in Asynctask like this. String videoid="mAQln4dgR24"; long currenttime=System.currentTimeMillis() / 1000; yourJsonStringUrl="http://www.youtube-mp3.org/a/itemInfo/?video_id="+videoid+"&amp;ac=www&amp;t=grp&amp;r="+currenttime; /* //if you want to see the page use browserintent. Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(yourJsonStringUrl)); startActivity(browserIntent); */ J…
has comment: http://stackoverflow.com/comment/39068399
type: UnansweredQuestion
tagged with: android
answer count: 0
has title: BufferedReader reader.readLine() returns null
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/59968747
type: Question
has comment: http://stackoverflow.com/comment/39067071
has comment: http://stackoverflow.com/comment/39067093
duplicate of: http://stackoverflow.com/q/10202515
tagged with: bufferedreader
linked to: http://stackoverflow.com/q/10202515
score: 0

http://stackoverflow.com/a/25110933
accepted answer of: http://stackoverflow.com/q/25110926
downvote count: 0
answers question: http://stackoverflow.com/q/25110926
has comment: http://stackoverflow.com/comment/39078880
score: 5
has comment: http://stackoverflow.com/comment/39078921
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39079136
upvote count: 5
type: Answer
has body: you need to loop all the grades for(int i=0;i&lt;grades.length;i++){ total+=grades[i]; } average=total/x; your new code would be double average; double total = 0; for (int index = 0; index &lt; grades.length; index++) { System.out.println("Enter student " + (index + 1) + "'s " + "grade"); grades[index] = input.nextInt(); total += grades[index]; } System.out.println("The average grade is"); average = total / X; System.out.println(average); or double average; double total = 0; for (int index = 0; index &lt; x; index++) { System.out.println("Enter student " + (index + 1) + "'s " + "grade"); total += input.nextInt(); } System.out.println("The average grade is"); average = total / X; System.out.println(average);

http://stackoverflow.com/q/25215610
has body: I am having a problem with using facebook login for android app. I am using Facebook sdk 3.0.1 for this. I am running on Samsung galaxy y and emulators it works fine. But on samsung note, intex aqua and nexus 5 it doesn't work. I tried building and cleaning the project again but still the problem persists. I am attaching the log of the intex aqua device: 08-09 11:01:56.850: W/com.facebook.Session(11390): Should not pass a read permission (offline_access) to a request for publish or manage authorization 08-09 11:01:56.850: W/com.facebook.Session(11390): Should not pass a read permission (email) to a request for publish or manage authorization 08-09 11:01:56.851: W/com.facebook.Session(11390): Should not pass a read permission (user_photos) to a request for publish or manage authorization 08-09 11:01:56.851: W/com.facebook.Session(11390): Should not pass a read permission (photo_upload) to a request for publish or manage authorization 08-09 11:01:56.851: W/com.facebook.Session(11390): Should not pass a read permission (read_stream) to a request for publish or manage authorization 08-09 11:02:32.603: W/Insideeee(11494): Insideeee 08-09 11:02:32.651: D/JpgDecHal(11494): JpgDecHal::JpgDecHal 08-09 11:02:32.651: D/JpgDecHal(11494): JpgDecHal::~JpgDecHal 08-09 11:02:32.652: D/JpgDecHal(11494): JpgDecHal::JpgDecHal 08-09 11:02:32.652: D/JpgDecHal(11494): JpgDecHal::start -&gt; config jpeg path 08-09 11:02:32.652: D/JpgDecHal(11494): Decoder Src Addr:0x4501f008, width/height:[264, 65] 08-09 11:02:32.652: D/JpgDecHal(11494): Decoder Dst Addr:0x45030000, width/height:[264, 65], format:3 08-09 11:02:32.653: D/JpgDecHal(11494): Decoder Dither:0, RangeDecode:0 [1868771184 1882089569 1702440557 1818456179] 08-09 11:02:32.654: D/JpgDecHal(11494): jpeg decoder result:0 08-09 11:02:32.655: D/JpgDecHal(11494): JpgDecHal::~JpgDecHal 08-09 11:02:32.682: D/JpgDecHal(11494): JpgDecHal::JpgDecHal 08-09 11:02:32.682: D/JpgDecHal(11494): JpgDecHal::~JpgDecHal 08-09 11:02:32.683: D/JpgDecHal(…
has answer: http://stackoverflow.com/a/25262681
has comment: http://stackoverflow.com/comment/39315509
tagged with: android
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/39315833
tagged with: facebook
has title: Facebook Login in android with different devices
accepted answer: http://stackoverflow.com/a/25262681
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39277767
tagged with: java
tagged with: authentication
tagged with: facebook-login
type: Question
has comment: http://stackoverflow.com/comment/39312069
has comment: http://stackoverflow.com/comment/39311947

http://stackoverflow.com/q/25192135
type: Question
has comment: http://stackoverflow.com/comment/39230863
has title: Resizing JPanel containing a JscrollPane having a JTable
type: AnsweredQuestion
tagged with: jtable
score: 0
possible better answer: http://stackoverflow.com/a/25210124
answer count: 3
tagged with: jscrollpane
has answer: http://stackoverflow.com/a/25210124
has comment: http://stackoverflow.com/comment/39239157
has body: I have a JPanel(named mainJP) which has a few buttons and labels (uses BorderLayout). Next it adds another JPanel (named JP1) and inside it a ScrollPane with a JTable. I want to be able to resize JP2 and in turn all its child components (ScrollPane and JTable). So that I can see few more rows of the JTable without having to scroll. Also inorder to resize JP1, other siblings of JP1 should adjust themselves. Not sure how to achieve that. As the image shows I already have a few features implemented - to entirely delete JP1, to expand/collapse JP1 view, to delete and add rows in the JTable. So basically I want to be able to drag the mouse at bottom border of JP1 to vertically increase the size of JP1 and its child components (ScrollPane and JTable). As described in a few of the below solutions, I am still confused at which level should I incorporate a JSpiltPane - as it allows only adding 2 components. I think all the JP1 should be in the JSplitPane. However there can be more than one JP1 components and they are dynamically added.
has answer: http://stackoverflow.com/a/25248007
accepted answer: http://stackoverflow.com/a/25248007
has answer: http://stackoverflow.com/a/25210588
tagged with: java
has comment: http://stackoverflow.com/comment/39261653
tagged with: swing

http://stackoverflow.com/q/25171211
has comment: http://stackoverflow.com/comment/39191303
tagged with: java
has comment: http://stackoverflow.com/comment/39191502
has comment: http://stackoverflow.com/comment/39191383
type: Question
has title: Deserialize Serialized Object after Refactoring
tagged with: deserialization
tagged with: serialization
score: 0
has comment: http://stackoverflow.com/comment/39191441
has comment: http://stackoverflow.com/comment/39191815
has body: Suppose I have the following class: public class Foo implements Serializable { private static final long serialVersionUID = 1L; private String someName; public void setName(String name) { this.someName = name; } public String getName() { return this.someName; } } I serialize many objects of this class, and save them to disk. Later, I realize that it would be beneficial to abstract this structure out to an abstract class, leaving me with the following two classes: public abstract class AbstractFoo implements Serializable { private static final long serialVersionUID = 1L; private String someName; public void setName(String name) { this.someName = name; } public String getName() { return this.someName; } } and public class Foo extends AbstractFoo implements Serializable { private static final long serialVersionUID = 1L; } Is it possible to deserialize the files from earlier? Attempting to do so in my tests does not cause an error, but does result in the properties being null.
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39191561

http://stackoverflow.com/comment/39295150
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25227045
has text: 1) Swing GUIs might have to work on different platforms, using different PLAFs, on different screen sizes and resolutions with different default settings for font size. As such, they are not conducive to exact placement of components. Instead use layout managers, or [combinations of layout managers](http://stackoverflow.com/a/5630271/418556) as well as [layout padding and borders](http://stackoverflow.com/q/17874717/418556) for white space. 2) For Swing, we typically use [key bindings](http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html) over the lower level `KeyListener`.
score: 0

http://stackoverflow.com/q/25136116
score: -1
has title: java.lang.UnsatisfiedLinkError: onCreate in android
has comment: http://stackoverflow.com/comment/39125397
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39125450
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/20341707
upvote count: 0
tagged with: java
type: Question
has body: i update ADT to latest version, i integrate Google maps in my project . MapActivity: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.maps); // fetch the map view from the layout MapView mapView = (MapView) findViewById(R.id.mapview); // make available zoom controls mapView.setBuiltInZoomControls(true); } @Override protected boolean isRouteDisplayed() { return false; } xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;com.google.android.maps.MapView android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="AIzaSyBOhdOOMI_ZMYlvSyi7DVeRe_bo9ckxehM" android:clickable="true" /&gt; My question when i run this on my device it was giving me error java.lang.noclassdeffounderror after that i tried to fix it through "Android Tools > Fix Project Properties" . now its giving me error 08-05 15:02:21.387: E/AndroidRuntime(20647): FATAL EXCEPTION: main 08-05 15:02:21.387: E/AndroidRuntime(20647): java.lang.UnsatisfiedLinkError: onCreate 08-05 15:02:21.387: E/AndroidRuntime(20647): at com.google.android.maps.MapActivity.onCreate(Native Method) 08-05 15:02:21.387: E/AndroidRuntime(20647): at com.example.careandcure.MapsViewActivity.onCreate(MapsViewActivity.java:12) how to solve this..
has answer: http://stackoverflow.com/a/25136179
tagged with: google-maps
has comment: http://stackoverflow.com/comment/39125459

http://stackoverflow.com/comment/39015835
has text: `ABCSmelterEntity instance = (ABCSmelterEntity) sessionFactory.getCurrentSession() .createCriteria(ABCSmelterEntity.class) .add(Restrictions.eq("smelterId", smelter_id)).uniqueResult(); if (instance != null){ instance.setName(smelter_name); sessionFactory.getCurrentSession().saveOrUpdate(instance); }else{ logger.error("get failed", obj.toString()); sessionFactory.getCurrentSession().save(obj); } `
comment on: http://stackoverflow.com/a/25074499
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25119282
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/39102517
type: Question
score: 0
answer count: 1
has body: in testng.xml I call only class (not individual methods), so all three executes fine. Now i have one set of data for method 1 &amp; 3 and for 2nd method I have two set of data. Now with my framework I call method2 for 2nd time using simple Java code. But since @Test for method 2 is not being called so report shows only one entry for method 2. So is there any way to handle this (so that entry is shown twice in TestNg report) package scenarios; public class L5_Miscellaneous { @AfterMethod public void catchscreenshot(ITestResult result) throws IOException, HeadlessException, AWTException{ } @Test public static void method1() { } @Test public static void method2() { } @Test public static void method3() { } }
tagged with: testng
has answer: http://stackoverflow.com/a/25140363
has title: Can I call @Test method programmatically when TestNG.xml has list of classes only not methods?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39095034

http://stackoverflow.com/a/25203684
score: 0
has body: Are you calling setTom directly from your test? If so, you don't assert that all branches are covered, you just test all branches via your knowledge of the code. Call setTom twice, once with tom==null and once with tom != null. Branches covered.
type: Answer
has comment: http://stackoverflow.com/comment/43201445
answers question: http://stackoverflow.com/q/25201015

http://stackoverflow.com/q/25113350
has answer: http://stackoverflow.com/a/25113446
tagged with: java
linked to: http://stackoverflow.com/q/2422468
has title: Upload Download xlsx file in spring mvc
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39083699
upvote count: 1
favorite count: 0
has body: I am trying to upload xlsx file and read it's content to insert into database. I completed download xlsx but facing issue in upload and reading the content Here is the jsp: &lt;div align="center" style="margin-bottom: 10px;" &gt; &lt;input style="width:200px" class="admin_search_btn" type=file name="uploadxls" value="" /&gt; &lt;/div&gt; &lt;div align="center" style="margin-bottom: 10px;" &gt; &lt;button type="submit" class="admin_search_btn"&gt;Submit&lt;/button&gt;&amp;nbsp; &lt;button type="submit" class="admin_search_btn"&gt;Cancel&lt;/button&gt; &lt;/div&gt; How should I map this to controller to upload the file on server and read it's content?
has answer: http://stackoverflow.com/a/25113458
has comment: http://stackoverflow.com/comment/39083219
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/q/25208912
has body: We update to spring 4 for a couple of reasons, but needed to remain on jdk 7 for the time being (too close to release!). All was fine and good until I started using PropertySource. This class uses the Repeatable annotation which is a java 8 class... and suddenly we fail to compile, missing class. We use -Werror as part of our compiling process and could turn that off, but that seems like the nuclear option. Is there any other mechanism to get javac working again without killing off all warnings-as-compilation-failures?
tagged with: java
has comment: http://stackoverflow.com/comment/39262174
type: Question
has comment: http://stackoverflow.com/comment/39262210
has comment: http://stackoverflow.com/comment/39261529
has title: Spring 4 and compiling with jdk 7
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39261989
has answer: http://stackoverflow.com/a/25214485
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/a/25092870
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25092787
accepted answer of: http://stackoverflow.com/q/25092787
has comment: http://stackoverflow.com/comment/39045301
score: 27
has body: It's defined in the interface so that they can attach RunnableFuture-specific JavaDoc to it. There's no technical significance.
upvote count: 27

http://stackoverflow.com/comment/39296056
comment on: http://stackoverflow.com/q/25227580
has text: That tutorial is specifically for Eclipse RCP apps - that is apps that use the Eclipse plugin architecture. Since it seems to be based on Eclipse 3.6 it is likely to be a bit out of date as well.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25202780
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25202596
answers question: http://stackoverflow.com/q/25202596
has comment: http://stackoverflow.com/comment/39249908
type: AcceptedAnswer
has body: pom is container of sub-modules, I see a lot of sub-directories in the project. Somewhere, nested within the project structure you will find artifacts (modules) with jar packaging. Maven generally builds everything into /target subdirectories of each module. So after mvn install look into target subdirectory in a module with jar packaging.

http://stackoverflow.com/comment/39166501
comment on: http://stackoverflow.com/a/25158110
score: 0
type: AnswerComment
has text: Oh my, you're right! I can't even think with mutable objects anymore... +1 :)
type: Comment

http://stackoverflow.com/q/25229499
has comment: http://stackoverflow.com/comment/39300761
score: 2
has title: Using empty gridLayout, but will hold ImageIcon and store information later. Can i modify the size?
upvote count: 2
tagged with: swing
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25229565
has body: Below is my code, which is meant to create a grid on the left hand side, which is does, however the two grids are made very long and thin, and even when later on i add the image to it it remains the same size! I dont know whether there's some way of changing it, and i tried to use the gridBagLayout but I've never used it before and i wasn't sure how i could apply my current code to it! I'm not quite sure how to explain it, as i'm a beginner in java and have only just been learning it at uni for a short while. If you need more information I'm happy to provide it. I know that the grid means everything is the same size, but is there any way of actually setting that size of controlling the size of it? public static int ROWS = 3; public static int ROWS1 = 1; public static int COLUMNS = 4; pnlLorry = new JPanel(); pnlLorry.setLayout(new GridLayout(ROWS1, COLUMNS)); pnlLorry.setSize(100, 400); pnlLorry.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); pnlLorry.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); for (int row = 0; row &lt; largeVehicle.length; row++) { for (int column = 0; column &lt; largeVehicle[row].length; column++) { ImagePanel pnlLorryImage = new ImagePanel(); pnlLorryImage.addMouseListener(new MyMouseListener(row, column)); pnlLorryImage.setBorder(BorderFactory.createLineBorder(Color.BLACK)); pnlLorry.add(pnlLorryImage, row * (largeVehicle.length - 1) + column); } } pnlCars = new JPanel(); pnlCars.setSize(400, 400); pnlCars.setLayout(new GridLayout(ROWS, COLUMNS)); pnlCars.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); pnlCars.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); for (int row = 0; row &lt; carVehicle.length; row++) { for (int column = 0; column &lt; carVehicle[row].length; column++) { ImagePanel pnlCarImage = new ImagePanel(); pnlCarImage.addMouseListener(new MyMouseListener(row, column)); pnlCarImage.setBorder(BorderFactory.createLineBorder(Color.BLACK)); pnlCars.add(pnlCarImage, row * (carVehicle.l…
tagged with: grid-layout
has comment: http://stackoverflow.com/comment/39300035
tagged with: user-interface
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25229565

http://stackoverflow.com/a/25157972
upvote count: 0
has comment: http://stackoverflow.com/comment/39240489
answers question: http://stackoverflow.com/q/25157198
score: -1
downvote count: 1
has comment: http://stackoverflow.com/comment/39217070
type: Answer
has body: Imloca returns null.Problem is this.

http://stackoverflow.com/q/25161586
has comment: http://stackoverflow.com/comment/39173391
favorite count: 0
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25161603
has body: let's say I have a site with 10 pages. Every page is called by a servlet. For example, I have the servlet "index" that makes a forward() to "index.jsp". In my index.jsp i have 2 includes for the header and the footer ... &lt;jsp:include page="header.jsp" &gt; home page text &lt;jsp:include page="footer.jsp" &gt; ... Now I have 10 pages similar to the index page, I mean I have 10 pages that include a header and a footer. Let's say I decide to delete the footer: I should edit 10 pages. What im wondering is if there's something that allow me to use just one page, and show, dinamically, just the "content" of the page (home page, contacts, ecc), keeping in mind that i use a servlet to get every page content (with a forward()).
tagged with: java
has title: how to create a template with jsp and servlet
type: Question
tagged with: jstl
tagged with: jsp
linked to: http://stackoverflow.com/q/9965544
tagged with: servlets
accepted answer: http://stackoverflow.com/a/25161603
score: 2
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/39257225
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25205942
has text: *"Set the maximum size for the centered JPanel.."* See [Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Swing?](http://stackoverflow.com/q/7229226/418556) (Yes.)
score: 1

http://stackoverflow.com/q/25163330
tagged with: boolean
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25163387
has title: Set boolean argument as the opposite of another boolean?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39176197
has body: This is kind of hard to phrase. I have a method (let's call it method1) that takes a boolean as argument. It calls another method (method2), which also takes a boolean as argument. I would like method1 to call method2(true) if its argument is false, and method2(false) if its argument is true. I know I could use a simple if(){...}else{...}, but is there a way to set a boolean to the opposite of another boolean? Something like this: boolean b2=!b1; So I could code my methods like this: public void method1(boolean c){ this.method2(!c); }
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/39176252
has answer: http://stackoverflow.com/a/25163387

http://stackoverflow.com/q/25180467
tagged with: active-directory
score: 0
tagged with: remember-me
tagged with: spring-security
has comment: http://stackoverflow.com/comment/39214008
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39242563
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
has title: Remember-me don't work(with Spring security 3.1, LDAP, ActiveDirectory)
type: Question
has body: I'm trying to cofigure "remember-me" in my web app. I use Spring security 3.1, LDAP and ActiveDirectory. This is applicationcontext-security.xml: <authentication-manager> <authentication-provider ref="ldapActiveDirectoryAuthProvider" /> </authentication-manager> <beans:bean id="grantedAuthoritiesMapper" class="xxcutxx.spring.security.ActiveDirectoryGrantedAuthoritiesMapper"/> <beans:bean id="ldapActiveDirectoryAuthProvider" class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider"> <beans:constructor-arg value="xxcutxx" /> <beans:constructor-arg value="xxcutxx" /> <beans:property name="authoritiesMapper" ref="grantedAuthoritiesMapper" /> <beans:property name="useAuthenticationRequestCredentials" value="true" /> <beans:property name="convertSubErrorCodesToExceptions" value="true" /> </beans:bean> <beans:bean id="successHandler" class="xxcutxx.spring.security.CustomAuthenticationSuccessHandler"/> <beans:bean class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/> <form-login login-page="/index.jsp" default-target-url="xxcutxx" authentication-success-handler-ref="successHandler" login-processing-url="/j_spring_security_check" authentication-failure-url="/index.jsp?loginerr=1" /> <logout logout-success-url="/index.jsp"/> <access-denied-handler error-page="/index.jsp?loginerr=3"/> <intercept-url pattern="/*.do" access="READER" /> <remember-me key="MY_REMEMBER_ME_KEY" services-ref="rememberMeServices"/> And this is applicationcontext.xml: <property name="key" value="MY_REMEMBER_ME_KEY" /> <property name="cookieName" value="MY_REMEMBER_ME_COOKIE" /> <property name="parameter" value="remember" /> <property name="tokenValiditySeconds" value="1209600" /> <property name="userDetailsService" ref="MyUserDetailsService" /> <property name="alwaysRemember" value="false" /> xxcutxx <property name="url" value="xxcutxx"/> <property name="pooled" value="false"/> The web app starts but don't create the …
tagged with: java

http://stackoverflow.com/comment/133656105
has text: @Phil No: you have fundamentally misunderstood the documentation. The `Task` is not interacting with the UI. The event handler is.
comment on: http://stackoverflow.com/a/25171938
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39285680
type: Comment
score: 0
type: AnswerComment
has text: The column name annotations are the same though.
comment on: http://stackoverflow.com/a/25221996

http://stackoverflow.com/comment/39253124
comment on: http://stackoverflow.com/q/25204619
has text: If all you need to do is to print out the number of trailing 0's, why calculate the factorial at all?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39030216
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25084314
has text: No, you should call `repaint()` in your timer's listener, for [example](http://stackoverflow.com/q/9849950/230513).
score: 1

http://stackoverflow.com/comment/39226137
has text: [Don't use `setPreferredSize()` when you really mean to override `getPreferredSize()`](http://stackoverflow.com/q/7229226/230513).
comment on: http://stackoverflow.com/a/25189098
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/25226343
upvote count: 3
tagged with: java
tagged with: servlets
type: Question
downvote count: 0
tagged with: jsp
possible better answer: http://stackoverflow.com/a/25226417
answer count: 3
has answer: http://stackoverflow.com/a/25226417
has answer: http://stackoverflow.com/a/25226385
has title: Why we can see change made on jsp on refreshing the page? why not for servlet?
has comment: http://stackoverflow.com/comment/39293544
favorite count: 0
has answer: http://stackoverflow.com/a/29612757
has body: Why we can see change made on jsp on refreshing the page? why we have to restart the server in case of any changes made in servlet? what is the difference between both?
tagged with: jakarta-ee
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/25226385

http://stackoverflow.com/comment/39084756
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25113987
has text: @Scheintod added Comparator class
type: QuestionComment

http://stackoverflow.com/q/25105194
has body: I have an activity inside my android app that lists some information inside ListView , in the top left corner of each Item there is a more information icon, when user touches this icon application should change the content of this list item to some useful information , and also the icon should change to another icon , for example a close icon , again when user touchs close icon application should show list item contents. For changing the Icon i used this code, but first time that i click icon nothing happens , second time it changes, and sometimes when i click one of the icons the icon of another list item changes. ListActivity.java list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View viewCliced, int position, long id) { img = (ImageView)viewCliced.findViewById(R.id.img_icon); img.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { img.setImageResource(R.drawable.setting); } }); } }); this code changes the icon but user should touch icon twice and sometimes change another list item's icon :| this is the XML of ListView Item listitem.xml <?xml version="1.0" encoding="utf-8"?> <ImageView android:id="@+id/img_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:src="@drawable/bookabout" /> <TextView android:id="@+id/txt_subject" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="15dp" android:text="نام فصل" android:textColor="#000000" /> <TextView android:id="@+id/txt_explanation" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="15dp" android:text="توضیحات فصل درسی" android:textColor="#000000" /> How i should develop this feature ? toggling between two kind of contents for a ListView item when user touches an Icon inside the ListView Item I read a lot of article about list views but i couldn't find a way to do that, Than…
accepted answer: http://stackoverflow.com/a/25106821
type: Question
type: AnsweredQuestion
has title: Click Event for an element inside list view items to toggle contents of ListItem
tagged with: java
tagged with: listview
answer count: 1
has answer: http://stackoverflow.com/a/25106821
score: 0
tagged with: android-listview
tagged with: android
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/39228679
comment on: http://stackoverflow.com/a/25190884
has text: Can you upload this project to github? Currently it looks that you dont know what you re doing. Why do you include mysql driver.? Where is derby dependency, etc
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/52510599
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25165567
type: Comment
has text: You could do one Maven build step that runs mvn clean install and then as a separate step mvn deploy. That way if they first one fails, nothing will be deployed.

http://stackoverflow.com/a/25184813
has comment: http://stackoverflow.com/comment/39215739
type: Answer
has comment: http://stackoverflow.com/comment/39216419
answers question: http://stackoverflow.com/q/25183635
score: 0
has body: Based on the comments and the situation (homework) I suspect that TestClass is a course-provided class. Perhaps there is an option to submit only letters or only numbers with TestClass.testMethod(letters) and TestClass.testMethod(numbers). In that case you should probably only call that method with the single argument, it appears that it will fail when an empty List is provided.

http://stackoverflow.com/q/25102513
type: AnsweredQuestion
type: Question
has title: Camera camera=Camera.open(); Why it is wrong to write separately?
has answer: http://stackoverflow.com/a/25102529
tagged with: android
has comment: http://stackoverflow.com/comment/39062902
answer count: 1
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39092985
accepted answer: http://stackoverflow.com/a/25102529
tagged with: camera
has body: Camera camera=Camera.open(); //that's Right,but if you write separately, it's wrong Camera camera; camera=Camera.open(); //reason: Syntax error on token ";", , expected Button btn1; btn1.setOnClickListener(new OnClickListener(){ boolean sum=true; Camera camera; //Syntax error on token ";", , expected camera=Camera.open(); Parameters parameter; public void onClick(View V) { if(sum) { camera.startPreview(); parameter=camera.getParameters(); parameter.setFlashMode(Parameters.FLASH_MODE_TORCH); camera.setParameters(parameter); } else { //camera.stopPreview(); parameter=camera.getParameters(); parameter.setFlashMode(Parameters.FLASH_MODE_OFF); camera.setParameters(parameter); } sum=!sum; } });

database
tags question: http://stackoverflow.com/q/25229224
tags question: http://stackoverflow.com/q/25102726
tags question: http://stackoverflow.com/q/25214353
tags question: http://stackoverflow.com/q/25077665
tags question: http://stackoverflow.com/q/25119480
tags question: http://stackoverflow.com/q/25185650
tags question: http://stackoverflow.com/q/25130110
tags question: http://stackoverflow.com/q/25188970
tags question: http://stackoverflow.com/q/25135285
tags question: http://stackoverflow.com/q/25177034
type: Tag
tags question: http://stackoverflow.com/q/25075054
tags question: http://stackoverflow.com/q/25132986
tags question: http://stackoverflow.com/q/25195586
tags question: http://stackoverflow.com/q/25156395
tags question: http://stackoverflow.com/q/25177256
tags question: http://stackoverflow.com/q/25125800
tags question: http://stackoverflow.com/q/25158936
tags question: http://stackoverflow.com/q/25088818
tags question: http://stackoverflow.com/q/25125019
tags question: http://stackoverflow.com/q/25220053
tags question: http://stackoverflow.com/q/25206749
tags question: http://stackoverflow.com/q/25129846
tags question: http://stackoverflow.com/q/25134920
tag name: database
tags question: http://stackoverflow.com/q/25201291
tags question: http://stackoverflow.com/q/25089580
tags question: http://stackoverflow.com/q/25199846
tags question: http://stackoverflow.com/q/25149441
tags question: http://stackoverflow.com/q/25097851
tags question: http://stackoverflow.com/q/25120583
tags question: http://stackoverflow.com/q/25137180
tags question: http://stackoverflow.com/q/25215100
tags question: http://stackoverflow.com/q/25145190
tags question: http://stackoverflow.com/q/25229247
tags question: http://stackoverflow.com/q/25186231
tags question: http://stackoverflow.com/q/25184571
tags question: http://stackoverflow.com/q/25121910
tags question: http://stackoverflow.com/q/25109744
tags question: http://stackoverflow.com/q/25095943
tags question: http://stackoverflow.com/q/25141733

http://stackoverflow.com/a/25103713
accepted answer of: http://stackoverflow.com/q/25103538
has comment: http://stackoverflow.com/comment/39065350
score: 1
type: AcceptedAnswer
has body: You can't add a Jframe to a tabbed pane. if each of your application was a JPanel you could just add them to your JTabbedPane. each one of your JFrame classes uses a JFrame, and in the frame, each class creates its content. You can re-arrange your code so that each of your JFrame creates a panel which creates its content just like the Jframe. then the panel is added to the JFrame. your first two applications should still work. for your third class, use a Jframe, add the JTabbedPane to the Jframe, and then add the two panels created above (one from each of your first two) to your tabbed pane. the easiest way is probably to accomplish the 3rd class is to just change the first two classes to extend JPanel instead of Jframe. Then create a class which extends from JFrame, and adds a JTabbedPane which adds the two panels.
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/25103538
downvote count: 1

http://stackoverflow.com/q/25074851
possible better answer: http://stackoverflow.com/a/25077872
upvote count: 8
has body: In web applications you have to store somewhere passwords used to for example connect to a database. This is mostly done in a configuration file in plain text. I've been searching to make this more secure and saw Jasypt (www.jasypt.org) which makes it possible to encrypt these passwords. But you still need a key to decrypt these, which just moves the problem. Then I moved this key to a system environment variable so it's at least outside of the application. But I still think this doesn't really change a lot? How do other people solve this problem?
has answer: http://stackoverflow.com/a/25075171
has answer: http://stackoverflow.com/a/25077872
answer count: 4
has title: Secure plain text passwords in configuration
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25075171
has answer: http://stackoverflow.com/a/25076250
downvote count: 0
tagged with: security
has answer: http://stackoverflow.com/a/25080763
score: 8
favorite count: 0

http://stackoverflow.com/a/25220755
upvote count: 12
has body: generateSeed() does not use any bytes generated by the random number generator. Instead, it is just a pass through to the entropy source that the SecureRandom implementation uses to seed itself when and if it is seeding itself. So for instance calling the following code on an Oracle provided Java SE: // initSeed is just zero valued bytes byte[] initSeed = new byte[16]; SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); secureRandom.setSeed(initSeed); byte[] seed = secureRandom.generateSeed(16); byte[] data = new byte[16]; secureRandom.nextBytes(data); System.out.printf("Seed: %s%n", Hex.toHexString(seed)); System.out.printf("Data: %s%n", Hex.toHexString(data)); Will actually give back different values for seed, and always the same value for data. In other words, the generateSeed uses the operating system to ask for 16 bytes of entropy, while the random number generator is only seeded with the initSeed and thus will always generate the same stream of pseudo random numbers. Warning: this is just to illustrate the point; you should not rely on any SecureRandom instance to return anything but random bytes. The behavior with regards to setSeed differs per implementation. The Oracle "SHA1PRNG" provider uses it as the only seed, others may choose to mix it into the state of the PRNG (for instance later Android implementations will always generate random data).
score: 12
accepted answer of: http://stackoverflow.com/q/25220492
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25220492

http://stackoverflow.com/q/25168922
accepted answer: http://stackoverflow.com/a/25171869
tagged with: eclipse
type: Question
upvote count: 4
possible better answer: http://stackoverflow.com/a/26402132
score: 4
has answer: http://stackoverflow.com/a/26402132
has comment: http://stackoverflow.com/comment/39188496
answer count: 2
has comment: http://stackoverflow.com/comment/39186951
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25171869
has title: Scala plug-in for Eclipse Luna
tagged with: scala
has body: Do I understand correctly that the only version of Scala IDE compatible with Eclipse Luna is Scala IDE 4.0.0 Milestone 3? I'm not familiar with this Milestone terminology. It seems to be something between stable version and nightly builds. Is it the same as Release Candidate? In old waterfall terminology would it be alpha or beta? In other words: How safe is it? If I already have Eclipse Luna and JDK 1.8, and want Scala support, do I really have a choice? If someone already uses this combination, please share your experience. And what is really confusing is that when I open Marketplace in Luna it offers 3.0x version. Go figure...
tagged with: java-8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39203245
tagged with: eclipse-luna
tagged with: java

http://stackoverflow.com/comment/39267485
comment on: http://stackoverflow.com/a/25212197
type: AnswerComment
type: Comment
has text: @HovercraftFullOfEels (Edit: and others, but Hovercraft Full Of Eels was first :P) Thanks for the `@Override` tip!
score: 1

http://stackoverflow.com/comment/39005225
has text: Didn't we already fix this problem? Isolate your functionality in single units of work, this is known as encapsulation...it's why you use an OO language in the first place and I'm sure I've said this at least 3 times...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25071464
type: Comment

http://stackoverflow.com/comment/39079005
type: AnswerComment
comment on: http://stackoverflow.com/a/25108760
score: 0
has text: This is wrong. In Scala, functions do *not* have names. Methods are also a kind of subroutines, but they are *not* functions. Functions are objects, they are instances of a class (an anomyous subclass of one of the `FunctionN` traits), meaning they can be stored in fields, returned from methods, passed to methods or constructors. Methods aren't objects, so you cannot do any of that.
type: Comment

http://stackoverflow.com/a/25209266
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/39262738
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25209026
accepted answer of: http://stackoverflow.com/q/25209026
downvote count: 0
has body: I would start by giving meaningful names to each sub-expression and assign the results to variables and then do an &amp;&amp; check between the variables. This will greatly increase readability. Also your conditions all seem to have the form (X != null &amp;&amp; X == value) || X == null which can be simplified using short-circuit evaluation to just X == null || X == value since if X == null evaluates true then it doesn't need to check the right side, or if X == null evaluates false and it needs to check the right side you already know its not null so you don't need to check for null in the expression on the right side. Combining the two you would get something like this: public boolean isValid() { validate = false; boolean fooCond = (foo == 0) || (foo == myfoo); boolean barCond = (bar == 0) || (bar == mybar); boolean foobarCond = (foobar == 0) || (foobar == myfoobar); boolean foofooCond = (foofoo == null) || foofoo.equals(myfoofoo); boolean barbarCond = (barbar == null) || mybarbarlist.contains(barbar); boolean foobarfoobarCond = (foobarfoobar == null) || foobarfoobar.equals(myfoobarfoobar); if (fooCond &amp;&amp; barCond &amp;&amp; foobarCond &amp;&amp; foofooCond; &amp;&amp; barbarCond &amp;&amp; foobarfoobarCond) { validate = true; } return validate; } EDIT This doesn't quite work for your expressions where you are checking ((foo &gt; 0) &amp;&amp; (foo == myfoo)) || (foo == 0) since if foo &lt; 0 it returns false. If you really meant ((foo &gt; 0) &amp;&amp; (foo == myfoo)) || (foo &lt;= 0) then this method works as written.

http://stackoverflow.com/comment/39058402
has text: Thanks! I will surely try this.
comment on: http://stackoverflow.com/a/25100009
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25074017
answer count: 13
has answer: http://stackoverflow.com/a/25074296
has comment: http://stackoverflow.com/comment/39009801
has answer: http://stackoverflow.com/a/69598679
has comment: http://stackoverflow.com/comment/136890293
has answer: http://stackoverflow.com/a/50968509
upvote count: 51
has answer: http://stackoverflow.com/a/67517418
downvote count: 0
has answer: http://stackoverflow.com/a/55482621
has answer: http://stackoverflow.com/a/73799264
has answer: http://stackoverflow.com/a/63568790
has answer: http://stackoverflow.com/a/54352127
favorite count: 0
has title: java -version and javac -version showing different versions
has answer: http://stackoverflow.com/a/64924756
score: 51
has comment: http://stackoverflow.com/comment/39010175
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39009617
has comment: http://stackoverflow.com/comment/39009877
has answer: http://stackoverflow.com/a/25074160
has comment: http://stackoverflow.com/comment/39009895
has comment: http://stackoverflow.com/comment/39009984
linked to: http://stackoverflow.com/q/304319
has body: I have java 7 and java 8 both installed on my windows system under C:\Program Files\Java In the environment's path I specified the path of java 7 like this. %JAVA_HOME%/bin where JAVA_HOME = C:\Program Files\Java\jdk1.7.0_17 But when I type javac -version it shows javac 1.7.0_17 which makes sense but when I do java -version it shows java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode) Any idea what may be the problem here? Edit The installed folder : And one more thing echo %PATH% has only one occurence of JDK that is for java 7 and no occurence for JRE found in it.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/77341190
has comment: http://stackoverflow.com/comment/39009611
has answer: http://stackoverflow.com/a/25074358
has answer: http://stackoverflow.com/a/25074076
has comment: http://stackoverflow.com/comment/39009822

http://stackoverflow.com/a/25118714
type: Answer
has comment: http://stackoverflow.com/comment/39094495
has comment: http://stackoverflow.com/comment/39102661
answers question: http://stackoverflow.com/q/25117098
has body: you're using 2 different root element in your activity_main.xml but every xml document should have only one ROOT ELEMENT delete second RelativeLayout: and add your all other xml tags into first tags and then try again
score: 0

http://stackoverflow.com/comment/39008748
type: Comment
type: QuestionComment
score: 2
has text: Always better to have less number of network communications between Java and SQL...
comment on: http://stackoverflow.com/q/25073541

http://stackoverflow.com/a/25153824
score: 0
answers question: http://stackoverflow.com/q/25153208
type: Answer
has body: You can do something like this: List&lt;String&gt; allWords = new ArrayList&lt;String&gt;(); allWords.add("book"); allWords.add("pen"); allWords.add("pencil"); List&lt;String&gt; subsetStrring = new ArrayList&lt;String&gt;(); subsetStrring.add("book pen"); subsetStrring.add("book pencil"); subsetStrring.add("pen pencil"); for (String string : subsetStrring) { List&lt;String&gt; subsetStr = Arrays.asList(string.split(" ")); for (String word : allWords) { if(!subsetStr.contains(word)) { System.out.println(string + " =&gt; " + word); break; } } }

http://stackoverflow.com/comment/39025238
comment on: http://stackoverflow.com/q/25082244
has text: UUID duplication is extremely rare.. Read this http://stackoverflow.com/questions/1155008/how-unique-is-uuid
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39100554
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25122367
type: AnswerComment
has text: The `strplit` stage would need to be tweaked to account for a different sysmbol, other than `<`. But if they are equal what do you want to happen?

http://stackoverflow.com/comment/39155164
has text: It's not going to store anything if it failed to compile.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25151917
score: 5

http://stackoverflow.com/comment/39242571
type: Comment
type: QuestionComment
has text: What does it show, opening it in your **NotePad** (not an advanced text editor, such as Notepad++ or UltraEdit) - just the plain NotePad?
comment on: http://stackoverflow.com/q/25198890
score: 0

http://stackoverflow.com/a/25174825
type: Answer
score: 52
upvote count: 52
has body: You can use File.mkdir() or File.mkdirs() to create a directory. Between the two, the latter method is more tolerant and will create all intermediate directories as needed. Also, since I see that you use "\\" in your question, I would suggest using File.separator for a portable path separator string.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25174784
answers question: http://stackoverflow.com/q/25174784

http://stackoverflow.com/q/25076718
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39014915
accepted answer: http://stackoverflow.com/a/25083505
has body: The Spring docs do a fantastic job of describing transactional propagation properties. However, I was wondering if there are any well-known, real-world examples available which describe each of these properties more thoroughly in layman's terms?
tagged with: propagation
score: 27
has title: Spring Propagation examples in layman's terms
upvote count: 27
tagged with: transactional
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39019010
linked to: http://stackoverflow.com/q/1079114
favorite count: 0
has comment: http://stackoverflow.com/comment/39022144
tagged with: spring
linked to: http://stackoverflow.com/q/7287201
tagged with: java
tagged with: annotations
linked to: http://stackoverflow.com/q/10740021
has answer: http://stackoverflow.com/a/25083505
type: Question

http://stackoverflow.com/a/25211034
type: AcceptedAnswer
type: Answer
has body: D in SimpleDateformat stands for day in year where as d stands for day in month so replace DD with dd. similary replace YYYY with yyyy
score: 0
answers question: http://stackoverflow.com/q/25210882
accepted answer of: http://stackoverflow.com/q/25210882

http://stackoverflow.com/a/25169531
answers question: http://stackoverflow.com/q/25167378
score: 0
type: Answer
has body: Alright it looks like it's the line where the context menu is assigned that was the problem. I did menu.show(this.table.getScene().getWindow(), event.getScreenX(), event.getScreenY()); and this made everything work. I'm guessing that what was causing the problem was a lower level working of whatever is assigned to the owner variable.

http://stackoverflow.com/q/25149579
has comment: http://stackoverflow.com/comment/39151075
has title: How do i replace a double line with a single line in a string in Android?
tagged with: replace
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39151067
tagged with: string
tagged with: android
possible better answer: http://stackoverflow.com/a/25149734
has answer: http://stackoverflow.com/a/25149635
has comment: http://stackoverflow.com/comment/39150979
has answer: http://stackoverflow.com/a/25149734
tagged with: line-breaks
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39151077
type: Question
linked to: http://stackoverflow.com/q/12124859
has body: I have a string: This is a test sentence 1. This is a test sentence 2. This is a test sentence 3. This is a test sentence 4. This is a test sentence 5. I would like to replace the double line gap with a single line instead. Such as: This is a test sentence 1. This is a test sentence 2. This is a test sentence 3. This is a test sentence 4. This is a test sentence 5. However, I do not know how to detect the double line break, "\n" works when replacing a single line break but i have tried "\n\n" in a replace function with no success. textView.setText(string.replaceAll("\n\n","\n"));
accepted answer: http://stackoverflow.com/a/25149635

http://stackoverflow.com/q/25155330
tagged with: groovy
tagged with: geb
has title: Geb select element that contains something
has comment: http://stackoverflow.com/comment/39170539
has comment: http://stackoverflow.com/comment/39164891
accepted answer: http://stackoverflow.com/a/25172151
has answer: http://stackoverflow.com/a/25172151
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: testing
has body: How do I select the value of a form select field when it has random numbers in its name? I have tried: formValidity {$("form").(contains('validity')) = "1 year"} which fails.
answer count: 1
score: 0

http://stackoverflow.com/q/25174034
score: 3
has comment: http://stackoverflow.com/comment/39197153
has comment: http://stackoverflow.com/comment/39316412
has title: maven: Adding classes in war/web-inf/classes as dependency to a Jar module
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39196375
favorite count: 0
has body: The task is to create customization to the core project. The core project can not be modified by my team. The requirement is to change the control flow to the core and implement controller and services extending or using the core classes. Here the customization will be delivered as Jar and Core product will be war. That means the classes that i am going to extend are in web-inf/classes folder of a war. Both customization and core product uses maven. The problem I am facing here is that, I am not sure how to add war as dependency to my jar (customization) Any thought please. Also please let me know if there is a good design to do.
has comment: http://stackoverflow.com/comment/39221871
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/69025525
tagged with: spring
has comment: http://stackoverflow.com/comment/39199620
linked to: http://stackoverflow.com/q/1769586
upvote count: 3
tagged with: java
type: Question

http://stackoverflow.com/a/25205790
upvote count: 4
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/25205749
has body: It compiles, since it's valid Java syntax. It's equivalent to : recsFinished = true; while (recsFinished) { .... recsFinished = true; } Which is equivalent to recsFinished = true; while (true) { .... recsFinished = true; } which would give you an infinite loop.

class
tags question: http://stackoverflow.com/q/25121294
tags question: http://stackoverflow.com/q/25110081
tags question: http://stackoverflow.com/q/25168771
tags question: http://stackoverflow.com/q/25152312
tags question: http://stackoverflow.com/q/25225581
tags question: http://stackoverflow.com/q/25202223
tags question: http://stackoverflow.com/q/25139423
tags question: http://stackoverflow.com/q/25071871
tags question: http://stackoverflow.com/q/25215575
tags question: http://stackoverflow.com/q/25110438
tags question: http://stackoverflow.com/q/25153370
tags question: http://stackoverflow.com/q/25089908
tags question: http://stackoverflow.com/q/25078578
tags question: http://stackoverflow.com/q/25077892
tags question: http://stackoverflow.com/q/25162685
type: Tag
tags question: http://stackoverflow.com/q/25100965
tags question: http://stackoverflow.com/q/25070447
tags question: http://stackoverflow.com/q/25130764
tags question: http://stackoverflow.com/q/25081630
tags question: http://stackoverflow.com/q/25136042
tags question: http://stackoverflow.com/q/25077997
tag name: class
tags question: http://stackoverflow.com/q/25090245
tags question: http://stackoverflow.com/q/25145672
tags question: http://stackoverflow.com/q/25227931
tags question: http://stackoverflow.com/q/25090687
tags question: http://stackoverflow.com/q/25176932

http://stackoverflow.com/comment/39193594
type: AnswerComment
type: Comment
has text: Added an example which repeats 10 times. You can set the cycle count to `Animation.INDEFINITE` to repeat indefinitely. And @TomasMikula no doubt has a one-liner from ReactFX for the same thing ;).
comment on: http://stackoverflow.com/a/25171938
score: 0

http://stackoverflow.com/q/25093596
downvote count: 1
has answer: http://stackoverflow.com/a/25093886
tagged with: matching
tagged with: java
score: -1
has title: Checking through an arraylist and return a boolean result
type: Question
tagged with: boolean
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/39046648
tagged with: arraylist
favorite count: 0
has answer: http://stackoverflow.com/a/25093639
has body: I'm facing a problem whereby retrieveLoginData() is always returning false How do I make it so that it returns the value of my if-else-statement? Thanks a lot! private ArrayList&lt;String&gt; login = new ArrayList&lt;String&gt;(); public boolean retrieveLoginData(LoginRecord lr) { for (int i = 0; i &lt; login.size(); i++) { if (lr.getLoginName().equals(login.get(i))) return true;}// There's a duplicate in the arraylist return false; // Returns false if there are no duplicates }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39046578

http://stackoverflow.com/comment/39065390
score: 0
type: Comment
has text: Thanks Vlad. I changed the code. But i have the same problem.
comment on: http://stackoverflow.com/a/25099277
type: AnswerComment

http://stackoverflow.com/comment/39160427
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25133788
type: AnswerComment
has text: @flyingmouse wow) account is great, but can you just send the same message to the mail shown in my StackOverflow profile (see personal info section, near avatar). I think it's easier

http://stackoverflow.com/comment/39285927
has text: same warning with cast. i will ignore the warning:)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25221885

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

http://stackoverflow.com/comment/71349948
type: AnswerComment
has text: The max-age value you fill in here, is this millisecond or second? regards
type: Comment
comment on: http://stackoverflow.com/a/25191536
score: 0

http://stackoverflow.com/comment/39167501
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25158936
has text: Can you add your code please?
score: 0

http://stackoverflow.com/comment/39056146
type: Comment
comment on: http://stackoverflow.com/q/25090447
score: 0
type: QuestionComment
has text: You are incorrect. A ClassCastException is raised. I just tested it.

http://stackoverflow.com/comment/39794226
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25411657
type: AnswerComment
has text: @misterbiscuit HC can be customized to read from and write to arbitrary streams, but those streams need to be bound to a system resource of some sort.

http://stackoverflow.com/a/25098744
type: Answer
score: 2
downvote count: 0
has body: First, byte is not the same as Byte. They are different types. Your ArrayList expects a Byte[] but you are handing it a byte[]. Second, this error message bArrayList cannot be resolved to a type seems to indicate that you are invoking bArrayList.add(onekVideofile); in the class body. You cannot put statements (method invocations and the like) directly in a class body, you can only put declarations. Put it in a constructor or method body.
answers question: http://stackoverflow.com/q/25098722
upvote count: 2
has comment: http://stackoverflow.com/comment/39056124

http://stackoverflow.com/a/25105913
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25080414
type: AcceptedAnswer
type: Answer
has body: I'll ignore the question of why you would ever want to do this... As pointed out in the comments, you need to start the FX Application Thread in order to access the JavaFX clipboard. However, you don't actually need to show a Stage at any point. The following compiles and runs: import javafx.application.Application; import javafx.application.Platform; import javafx.scene.input.Clipboard; import javafx.scene.input.ClipboardContent; import javafx.stage.Stage; public class ClipboardTest extends Application { @Override public void start(Stage primaryStage) { final Clipboard clipboard = Clipboard.getSystemClipboard(); final ClipboardContent content = new ClipboardContent(); content.putHtml("Some bold html"); clipboard.setContent(content); Platform.exit(); } public static void main(String[] args) { launch(args); } }
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25080414

http://stackoverflow.com/comment/39254887
has text: Roman, did you also tried to scan table in `hbase shell`?
comment on: http://stackoverflow.com/q/25201517
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39060170
has text: what is the reader that you are using?
comment on: http://stackoverflow.com/q/25100958
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25148504
type: UnansweredQuestion
tagged with: swing
tagged with: java
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/9554636
answer count: 2
has title: Open multiple instances of one frame and keep track of the source opening the instance
upvote count: 0
has body: I have a Main window (JFrame) which contains many components including a button. The button, when pressed, opens another Window (JFrame), let's call it customers window, for the user to search details and present those details back in the Main window. There are many windows similar to the Main window and all those main windows have their own customers window for searching and presenting the details. Now, my question is I want to have only 1 class of the customers window for all main windows instead of having it for each main window. This is because everything inside the customers window is same for all the main windows, except each customers window open the details for that specific main window i.e. set texts for fields and insert data into table and so on.. The problem here is when I have to modify something... I have to code all the rest of the customers window as well which is time wasting and also increases the size of the application/repeated code.. So, I would like know of some way that I could have 1 class of customers window for all the main windows and keep track of the main window which opens the customers window so I can open the details in that main window. Please note that user will open multiple main windows at the same time and thus, require opening multiple instances of customers window. Below is some code to give an idea of how I am doing it currently... Cash_sale_customer_window: ..... get all the data from database..... CashSaleInvoice.customerNumberTextField.setText(rs.getString(1)); CashSaleInvoice.customerNameTextField.setText(rs.getString(2)); ....and so on.... Credit_sale_customer_window: .....get all the data from database..... CreditSaleInvoice.customerNumberTextField.setText(rs.getString(1)); CreditSaleInvoice.customerNameTextField.setText(rs.getString(2)); ....and so on.... Screenshot of the program: Main Window: http://postimg.org/image/adrdmrli5/ Cash Sale Invoice: http://postimg.org/image/6bcdynwhd/ Any help will be greatly appreciated…
tagged with: multiple-instances
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/25149501
has answer: http://stackoverflow.com/a/25148575
tagged with: jframe

http://stackoverflow.com/a/25187406
answers question: http://stackoverflow.com/q/25185521
score: 0
type: Answer
has body: Not a solution to your problem but, this does not do what you think it does: Thread t = new Thread(new MyRunnableTask()); t.start(); t = null; The t.start() call creates the new thread. NOTE: I said "thread", not "Thread". A (big T) Thread is an object that can be used to create and manage a (little t) thread. Once the (little t) thread is started, it has a life of its own. When you set the local variable t to null, all you are doing is erasing your reference to the (big T) Thread object that manages the (little t) thread. The (big T) Thread object is unaffected: It will continue to exist as long as the (little t) thread is running. The (little t) thread is unaffected: It will continue to do whatever it does. The only thing that changes when you set t to null, is that you no longer have any control over the new thread.

http://stackoverflow.com/q/25205448
has comment: http://stackoverflow.com/comment/39256490
has title: Programmatically adding text to the editor eclipse plugin
has answer: http://stackoverflow.com/a/25208232
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25208232
tagged with: java
has comment: http://stackoverflow.com/comment/39259576
tagged with: eclipse
answer count: 1
tagged with: eclipse-plugin
has body: I'm developing an eclipse plugin , and at some point in my plugin , a jframe is opened , and inside the jframe, there is a button . I have added a mouselistener to the button , and when pressed , I want some code to be added to the editor at caret point . but, I get null pointer exception here: IWorkbenchPage page = PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage();
score: 0

http://stackoverflow.com/comment/39857348
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25161361
has text: Is it somehow possible to avoid having the object classes that I put in the map on both sides (i.e. server and client)? For example is there a generic serialization magic that I could apply on the server somehow? Or could I provide the object in JSON or text form to avoid that? I would like to increase separation.

http://stackoverflow.com/q/25123335
tagged with: java
has body: My ServerEndpoint have some functions and values which I need use in webpage, can I use @ServerEndpoint as SessionScoped ManagedBean? I want use in 1 class @ServerEndpoint, @ManagedBean and @SessionScoped
has comment: http://stackoverflow.com/comment/39102000
tagged with: websocket
downvote count: 0
has comment: http://stackoverflow.com/comment/39116468
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39102093
tagged with: managed-bean
has title: Can I use @ServerEndpoint as @ManagedBean?
score: 2
tagged with: jsf
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/39102067
tagged with: session-scope
type: Question

http://stackoverflow.com/a/28038142
answers question: http://stackoverflow.com/q/25089866
has comment: http://stackoverflow.com/comment/57355250
has body: Open your file SlidingTabLayout.java (the default one from Google IO) and find the function populateTabStrip() , then after this code mTabStrip.addView(tabView); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } add the following line: int color = ContextCompat.getColor(tabView.getContext(), R.color.grey); tabTitleView.setTextColor(color); Replace R.color.grey with your preferred color.
score: 15
type: Answer
upvote count: 15
downvote count: 0

http://stackoverflow.com/comment/39230646
type: AnswerComment
has text: This still does not help me. I have no problem with cancelling the activity. I need everything outside my popup not to be clickable.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25192607

http://stackoverflow.com/q/25072857
tagged with: maven
has comment: http://stackoverflow.com/comment/39007559
has answer: http://stackoverflow.com/a/46756192
has comment: http://stackoverflow.com/comment/39015220
tagged with: java
has comment: http://stackoverflow.com/comment/39015093
has body: I have two java (maven) projects, A (with module a1, a2, a3) and B (with module b1,b2,b3,b4). Both these two projects are packaged as jar file and deployed in jboss server. There are some API invocation between these two projects (using REST and EJB invocation). I am able to remote debugging these projects individually (say I am debugging project A first then after A is completely over, I can start debugging the other) using intellij. Now, my question is – Can I do remote debugging of two different java projects at the same time using intellij? Please note that I have imported the projects into intellij as maven projects.
tagged with: eclipse
type: Question
score: 5
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/25088382
upvote count: 5
has comment: http://stackoverflow.com/comment/39007799
has comment: http://stackoverflow.com/comment/39008122
answer count: 3
has title: Can I do remote debug of two different projects at the same time using intellij
downvote count: 0
has answer: http://stackoverflow.com/a/33555154
favorite count: 0
has comment: http://stackoverflow.com/comment/39007718
type: UnansweredQuestion

http://stackoverflow.com/comment/39178936
comment on: http://stackoverflow.com/a/25164710
has text: Thank you kocko for the comment... I think it works in my case but the problem I am embedding an 'expect' code into my machine and there are certain commands when I use, it just keeps the console running for example when I try to 'exit' or 'logout' a machine, the program keeps running till I have to press the red button or simply force the thread to be killed using your command.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25129416
upvote count: 8
type: Answer
score: 8
has body: Put the errorCode into a field that the DefaultException has and then when you catch a DefaultException, call getters to retrieve it. public class DefaultException extends RuntimeException { private String errorCode; public DefaultException(String message, String errorCode) { super(message); this.errorCode = errorCode; } public String getErrorCode() { return errorCode; } // ... } Then when you catch it you can go like this: try { //something that will error } catch (DefaultException e) { String errorCode = e.getErrorCode(); // ... }
accepted answer of: http://stackoverflow.com/q/25129339
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25129339

http://stackoverflow.com/q/25079439
has comment: http://stackoverflow.com/comment/39020225
has title: How does JPS tool get the name of the main class or jar it is executing
type: Question
upvote count: 2
answer count: 1
tagged with: jvm
favorite count: 0
accepted answer: http://stackoverflow.com/a/25088276
tagged with: linux
has comment: http://stackoverflow.com/comment/39134121
has body: I am wondering, how does JPS tool get the name of the main class it is executed within jvm process. It is jps -l 123 package.MainClass 456 /path/example.jar I am talking specifically about Linux (I am not interested in Windows, and I have no Win machine to experiment on). I could think of 2 ways Connecting to the JVM in question which in turn tells it From /proc file system Regarding the first alternative, is it using local JMX connection? Still, it must go to /proc for the pids. There is PID, so it must ask OS anyway jps lists also itself Regarding the second alternative, I feel this could be the correct one, because On the command line, there is either -jar or MainClass /proc knows wery well the PID Before jps starts doind something, it has own folder in /proc But, I am facing little problem here. When java command is very long (e.g. there is extremely long -classpath parameter), the information about the command line does not fit into space reserved for it in /proc. My system has 4kB for it, and what I learned elsewhere, this is hardwired in OS code (changing it requires kernel compilation). However, even in this case jps is still able to get that main class somewhere. How? I need to find quicker way to get JVM process than calling jps. When system is quite loaded (e.g. when number of JVMs start), jps got stuck for several seconds (I have seen it waiting for ~30s).
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25088276
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/199130

task
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/25077792

http://stackoverflow.com/a/25194711
has body: I would make the method public and call it from your main activity from a static variable. So to call the method you would write... &lt;AnyOtherClass.java&gt; int level = MainActivity.getInstance().helloTable(yourValue); &lt;AnyOtherClass.java&gt; The code would look something like this... &lt;Activity1.java&gt; private static MainActivity mInstance; public static MainActivity getInstance() { return mInstance; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mInstance = this; } public int helloTable ( int INDEX ) { int output; if(INDEX&lt;5) { output=0; } else { output=1; } return output; } &lt;Activity1.java&gt;
answers question: http://stackoverflow.com/q/25193919
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25193919
score: 0
has comment: http://stackoverflow.com/comment/39277278
has comment: http://stackoverflow.com/comment/39278751
type: Answer

http://stackoverflow.com/a/25191325
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39264899
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25189721
has body: What happens when a few clients try to change the same value at the same time? Server crashes? Or only acces time increased (server makes request queue?) ? Neither. The RMI Specification carefully states that there are no guarantees about server-side threading. That means that all the calls can execute concurrently. It is up to you to provide any required synchronization.
accepted answer of: http://stackoverflow.com/q/25189721
upvote count: 1
score: 1

http://stackoverflow.com/q/25229342
has comment: http://stackoverflow.com/comment/39299890
favorite count: 0
has title: How to make an xml field non editable in JAXB
has body: Is there any annotation to disable updating one attribute? I want to update all other fields in the xml file except one attribute. I want to make it readonly field. is it possible through jaxb?
has comment: http://stackoverflow.com/comment/39304916
has answer: http://stackoverflow.com/a/25234348
answer count: 3
has comment: http://stackoverflow.com/comment/39299359
has comment: http://stackoverflow.com/comment/39305263
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25232283
has comment: http://stackoverflow.com/comment/39305290
has comment: http://stackoverflow.com/comment/39299421
has comment: http://stackoverflow.com/comment/39299185
has comment: http://stackoverflow.com/comment/39299445
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39299395
tagged with: java
has comment: http://stackoverflow.com/comment/39300054
tagged with: jaxb
has comment: http://stackoverflow.com/comment/39299439
has comment: http://stackoverflow.com/comment/39305106
accepted answer: http://stackoverflow.com/a/25232283
possible better answer: http://stackoverflow.com/a/25233605
has comment: http://stackoverflow.com/comment/39299375
has comment: http://stackoverflow.com/comment/39299401
has comment: http://stackoverflow.com/comment/39305215
has answer: http://stackoverflow.com/a/25233605
downvote count: 0
has comment: http://stackoverflow.com/comment/39299430
score: 1

http://stackoverflow.com/comment/39094425
type: QuestionComment
comment on: http://stackoverflow.com/q/25118771
type: Comment
has text: @RuchiraGayanRanweera - I tried splitting the string with delimiter '?', the code snippet for which is : String[] parts = isbn.split("\\?"); String part1 = parts[0]; String part2 = parts[1];
score: 0

http://stackoverflow.com/a/25141582
score: 3
answers question: http://stackoverflow.com/q/25141461
downvote count: 0
has comment: http://stackoverflow.com/comment/39142121
type: Answer
has comment: http://stackoverflow.com/comment/39147053
has body: Well this is probably the first problem: InputStreamReader reader1 = new InputStreamReader(in); That's loading the file using the platform default encoding, which may or may not be appropriate for the file in question. Likewise later: fstream = new FileWriter(fileName); Again, that will use the platform default encoding. Always be explicit about your encoding - UTF-8 is usually a good choice, if you're in a position to choose. Next, work out where issues are actually coming up. Log the exact UTF-16 code units in your strings, as integers, and try to spot when they go from "good" to "bad" (if they're ever good in the first place). See my blog post on diagnosing this sort of issue for more details. Something like this is useful: public static void dumpString(String text) { for (int i = 0; i &lt; text.length(); i++) { int codeUnit = text.charAt(i); System.out.printf("%d: %c %04x%n", i, (char) codeUnit, codeUnit); } } (Adjust to your logging infrastructure etc, of course.)
upvote count: 3

http://stackoverflow.com/comment/39007006
comment on: http://stackoverflow.com/q/25072442
has text: @alfasin he said **ip prefixes** in the post
score: 0
type: QuestionComment
type: Comment

dicom
tag name: dicom
type: Tag
tags question: http://stackoverflow.com/q/25167256

http://stackoverflow.com/comment/39222900
type: AnswerComment
score: 0
type: Comment
has text: the threads are created in the javascript file using something like this... (new Thread(function() {...})).start(); I could potentially make a big array of all of the spawned threads if that would help.
comment on: http://stackoverflow.com/a/25188587

http://stackoverflow.com/comment/39044693
type: QuestionComment
has text: do you know about javaFX and its application on a swing
type: Comment
comment on: http://stackoverflow.com/q/25092306
score: 0

http://stackoverflow.com/q/25087630
has title: Neither BindingResult nor plain target object for bean name 'newCase' available as request attribute
tagged with: spring-mvc
duplicate of: http://stackoverflow.com/q/22414921
has comment: http://stackoverflow.com/comment/39036532
tagged with: java
has comment: http://stackoverflow.com/comment/39037096
has comment: http://stackoverflow.com/comment/39037101
has comment: http://stackoverflow.com/comment/39036700
type: Question
has comment: http://stackoverflow.com/comment/39036573
has comment: http://stackoverflow.com/comment/39037046
has comment: http://stackoverflow.com/comment/39037128
linked to: http://stackoverflow.com/q/22414921
linked to: http://stackoverflow.com/q/18944627
score: 0
has comment: http://stackoverflow.com/comment/39036585
has comment: http://stackoverflow.com/comment/39036734
answer count: 0
has body: I have been reading through every page I can find about this error, and I just can't figure it out. What I'm doing is creating a form-backing object for a rather large form I have. The purpose of this form (implemented as a Bootstrap modal) is to allow users to enter new entries into a database table. The form itself resides on the /main page. A user clicks on the add button, which makes the modal appear. They then enter all the fields, click on Save, and then an AJAX POST is made to /add, and that's where the controller should grab the data and populate a SpecialClaimsCase object with the data from the form. The form is defined as: &lt;form:form commandName="newCase" method="post"&gt; The controller method that renders the page the form resides on: @RequestMapping(value="/main", method=RequestMethod.GET) public ModelAndView view() { return new ModelAndView("application"); } And the controller method that handles submission of the form: @RequestMapping(value="/add", method=RequestMethod.POST) public void addRow(@ModelAttribute("newCase") SpecialClaimsCase newCase) { caseManager.addNewSpecialClaimsCase(newCase); } As soon as I go to load the page that the form is on, I get the following error: [8/1/14 14:32:17:866 CDT] 0000001f webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[dispatcher]: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'newCase' available as request attribute at org.springframework.web.servlet.support.BindStatus.(BindStatus.java:141) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:168) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:188) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:154) at org.springframework.web.servlet.tags.form…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39037055
has comment: http://stackoverflow.com/comment/39036785
tagged with: spring

http://stackoverflow.com/q/25182993
has comment: http://stackoverflow.com/comment/39212677
type: Question
has answer: http://stackoverflow.com/a/25183282
has body: I am trying to parse the following JSON object: { "key1": "value1", "key2": "value2", "key3": { "subkey1": { "subsubkey1": "value", "subsubkey2": "value" }, "subkey2": { "subsubkey1": "value", "subsubkey2": "value" } ...........other dynamic subkeys.............. } } I tried the following: public class MyObject{ String key1, key2; KEY3 key3; public class KEY3{ public class SUBKEY{ String subsubkey1; String subsubkey2; //getters and setters } } //getters and setters } and then did the following: MyObject mObject = gson.fromJson(jsonMessage, MyObject.class); where jsonMessage is the JSON string above and subkeys are dynamic so i do not know how many of them are there.. But key3 becomes null. So, my problem is, how can I get key3 and its subkeys and subvalues using gson.fromJson? I do not want to do it like the following: JSONObject jObject= new JSONObject(jsonMessage); JSONObject key3Object = jObject.getJsonObject("key3"); I want to use gson.fromJson(); directly.
has comment: http://stackoverflow.com/comment/39211938
has answer: http://stackoverflow.com/a/25183244
score: 0
has comment: http://stackoverflow.com/comment/39212244
has answer: http://stackoverflow.com/a/25184316
answer count: 4
possible better answer: http://stackoverflow.com/a/25183049
has answer: http://stackoverflow.com/a/25183049
accepted answer: http://stackoverflow.com/a/25183282
has title: How to write the necessary java class to use gson.fromJson() for the following json object?
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson

http://stackoverflow.com/comment/39121147
comment on: http://stackoverflow.com/a/25133325
type: AnswerComment
score: 0
type: Comment
has text: For the sake of honesty; I did downvote this answer, not because of the `valueOf(long)` thing or documentation, but solely because you missed the `l2d` in your explanation, which is key to the analysis of your experiment results.

http://stackoverflow.com/comment/39145033
comment on: http://stackoverflow.com/q/25145494
type: Comment
type: QuestionComment
score: 0
has text: @ZoltánNémeth Then you may be a candidate for Renderscript or NDK. Renderscript will give you easy/cheap parallelism. NDK will give you control/performance for a different price. As always profile your app and see what works.

http://stackoverflow.com/comment/39295376
has text: Why only integers? This solution can find any rational number IMO.
type: AnswerComment
comment on: http://stackoverflow.com/a/25226725
type: Comment
score: 0

http://stackoverflow.com/a/25108398
has comment: http://stackoverflow.com/comment/39142905
answers question: http://stackoverflow.com/q/25104238
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39146799
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25104238
has body: This is very easy to do with JMockit. Simply declare a mock field or mock parameter of the desired type, and pass it to the code under test. For example: @Test public void myTest(@Injectable SomeClass dummy) { new ObjectWithUnusedDependency(dummy).doSomething(); } Works for any reference type, including final classes, abstract classes, interfaces, enums, etc. If, in addition, you want the test to fail in case any methods get called on the dummy object, a "full verification" needs to be added: @Test public void myTest(@Injectable SomeClass dummy) { new ObjectWithUnusedDependency(dummy).doSomething(); new FullVerifications(dummy) {}; }
score: 1
has comment: http://stackoverflow.com/comment/39809889
has comment: http://stackoverflow.com/comment/39099688
has comment: http://stackoverflow.com/comment/39080412
has comment: http://stackoverflow.com/comment/39132189
has comment: http://stackoverflow.com/comment/39137563

http://stackoverflow.com/q/25178810
favorite count: 0
has comment: http://stackoverflow.com/comment/39204789
linked to: http://stackoverflow.com/q/9094620
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39204523
downvote count: 0
tagged with: java
tagged with: image-processing
has comment: http://stackoverflow.com/comment/39204963
has answer: http://stackoverflow.com/a/37454739
type: Question
has answer: http://stackoverflow.com/a/25184537
has answer: http://stackoverflow.com/a/25179123
tagged with: raster
score: 4
has comment: http://stackoverflow.com/comment/39204758
answer count: 3
has title: Create a WritableRaster based on int array
upvote count: 4
has body: I need to take an int array and turn it into BufferImage. I really don't have any background on this subject and I learn it all from the internet so here's what I'm trying to do: Create an array from BufferedImage(done), turn this array into IntBuffer(done) - (Later i'll need to do some opertions on the image through the IntBuffer), put the changed values from the IntBuffer in new array(done), and turn this array into WritableRaster. (If something isn't right in my understading of the process please tell me) Here's the line where I deal with the WritableRaster: WritableRaster newRaster= newRaster.setPixels(0, 0, width, height, matrix); Eclipse marks this as a mistake and says ''Type mismatch:Cannot convert from void to WritableRaster" Please help! I'm a bit lost. Also sorry for bad english. EDIT: The matrix: int height=img.getHeight(); int width=img.getWidth(); int[]matrix=new int[width*height]; The part of the code where I try to insert values to the Raster: BufferedImage finalImg = new BufferedImage(width,height, BufferedImage.TYPE_INT_RGB); WritableRaster newRaster= (WritableRaster)finalImg.getData(); newRaster.setPixels(0, 0, width, height, matrix); The error message: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10769 at java.awt.image.SinglePixelPackedSampleModel.setPixels(Unknown Source) at java.awt.image.WritableRaster.setPixels(Unknown Source)

http://stackoverflow.com/comment/39255060
type: QuestionComment
comment on: http://stackoverflow.com/q/25205749
score: 6
has text: Stop comparing boolean to true (or false), and you won't be hit again: `while (recsFinished)`
type: Comment

http://stackoverflow.com/q/25106390
has body: I want to access value of gender variable from onClick(View v). value of gender produce in onCheckedChanged(RadioGroup arg0, int selectedId) and I dont know how can access this value MAIN ACTIVITY package com.dietandroidproject; import Databasedata.Person; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final RadioGroup genderselected = (RadioGroup) findViewById(R.id.selectgender); genderselected.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener(){ @Override public void onCheckedChanged(RadioGroup arg0, int selectedId) { selectedId=genderselected.getCheckedRadioButtonId(); RadioButton genderchoosed = (RadioButton) findViewById(selectedId); gender = genderchoosed.getText().toString(); } }); Button saveinformation = (Button) findViewById(R.id.saveinformation); saveinformation.setOnClickListener(new View.OnClickListener() { EditText weighttext = (EditText) findViewById(R.id.weighttext); EditText heighttext = (EditText) findViewById(R.id.heighttext); EditText usernametext = (EditText) findViewById(R.id.usernametext); EditText agetext = (EditText) findViewById(R.id.agetext); //RadioGroup genderselected = (RadioGroup) findViewById(R.id.selectgender); Spinner activitytext = (Spinner) findViewById(R.id.chooseactivity); Button saveinformation = (Button) findViewById(R.id.saveinformation); //TextView genderchoosed = (TextView) findViewById(genderselected //.getCheckedRadioButtonId()); //String gender = genderchoosed.getText().toString(); String pa = activitytext.getSelectedItem().toString(); @Override public void onClick(View v)…
tagged with: variables
has comment: http://stackoverflow.com/comment/39071941
possible better answer: http://stackoverflow.com/a/25106624
has answer: http://stackoverflow.com/a/25106624
answer count: 3
tagged with: android
accepted answer: http://stackoverflow.com/a/25106622
score: -1
favorite count: 0
has title: how can access the value of variable in setOnCheckedChangeListener listener from onclick
has comment: http://stackoverflow.com/comment/39071225
has answer: http://stackoverflow.com/a/25106978
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25106622
upvote count: 0

http://stackoverflow.com/a/25078467
answers question: http://stackoverflow.com/q/25078259
downvote count: 0
has comment: http://stackoverflow.com/comment/39017612
type: Answer
has body: But despite of pattern ##,##,###.### I am getting output as 2,564,484.125 while I think I should get it as 25,64,484.125. Why? You can supply multiple grouping characters, but only one is used. From the Javadoc: If you supply a pattern with multiple grouping characters, the interval between the last one and the end of the integer is the one that is used. So &quot;#,##,###,####&quot; == &quot;######,####&quot; == &quot;##,####,####&quot; It seems that formatting the Lakh format is not possible with standard Java mechanisms, see Number formatting in java to use Lakh format instead of million format for a solution.
score: 2
upvote count: 2

http://stackoverflow.com/q/25106005
has answer: http://stackoverflow.com/a/25106060
tagged with: division
upvote count: 1
downvote count: 1
type: Question
has body: In a recent game I'm developing, I've made shops. When you buy an item and try to sell it, the selling price drops to 75% of what the buying price is. After buying an item for 154 gold pieces, It says the shop will buy for 115.5 gold pieces, but you get 115 gold pieces from selling. I wish to remove the ".5" from "115.5" Any help is appreciated. int ShopValue = (int)Math.floor(getItemShopValue(removeId, 1, removeSlot)); String ShopAdd = ""; if (ShopValue &gt;= 1000 &amp;&amp; ShopValue &lt; 1000000) { ShopAdd = " (" + (ShopValue*.75 / 1000) + "k)"; } else if (ShopValue &gt;= 100) { ShopAdd = " (" + (ShopValue*.75 / 1) + " coins)"; } else if (ShopValue &gt;= 1000000) { ShopAdd = " (" + (ShopValue*.75 / 1000000) + " million)"; } else if (ShopValue &gt;= 1000000000) { ShopAdd = " (" + (ShopValue*.75 / 1000000000) + " billion)"; } c.sM(c.getItems().getItemName(removeId)+": shop will buy for &lt;col=255&gt;"+ShopAdd+"&lt;/col&gt; coins"); } }
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25106038
possible better answer: http://stackoverflow.com/a/25107154
has answer: http://stackoverflow.com/a/25107154
tagged with: decimal
has comment: http://stackoverflow.com/comment/39069385
has title: Removing decimals from dividing
score: 0
has answer: http://stackoverflow.com/a/25106170
has answer: http://stackoverflow.com/a/25106038
favorite count: 0
has answer: http://stackoverflow.com/a/25106985
answer count: 5
has comment: http://stackoverflow.com/comment/39071169

http://stackoverflow.com/q/25205694
possible better answer: http://stackoverflow.com/a/25205765
has body: I'm having some problems with deserializing a JSON object to a Java Class object, the JSON objects contain many invalid characters like "-" and "," that cannot be variable names in Java. example: { "Sugar, Total": 100, "Vitamin-A": 50, } I also have a class with private variables example: public class Food { private int sugarTotal; private int vitaminA; //Getters and Setters } now as I understand it GSON only fills in the variables with 100% matching names, I cant make the names that are given to me in the JSON object. does anyone know how to solve my predicament.
has answer: http://stackoverflow.com/a/25205758
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25205758
score: -1
answer count: 2
has answer: http://stackoverflow.com/a/25205765
has title: Converting JSON to Java Class using GSON
upvote count: 0
tagged with: deserialization
favorite count: 0

closest-points
tags question: http://stackoverflow.com/q/25077948
tag name: closest-points
type: Tag

http://stackoverflow.com/comment/39107322
comment on: http://stackoverflow.com/q/25126037
type: Comment
type: QuestionComment
has text: have you compiled your stub/skeleton using RMIC?
score: 0

http://stackoverflow.com/q/25180785
has comment: http://stackoverflow.com/comment/39208089
tagged with: spring
has title: Hibernate sorting entities increases version number of parent entity
has comment: http://stackoverflow.com/comment/39210702
answer count: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39209248
has body: I came across hibernate behaviour which I find hard to understand and it would be great if someone can explain what is going on. First of all I'm using spring with hibernate. I have some code like below, The reference "a" is an entity loaded from db, List&lt;C&gt; cs = a.getB().getCs(); Collections.sort(cs); The entity "C" implements Comparable. There's a @Transactional spring annotation on the method which calls this code. What I'm not really sure about is, when this sort happens I see an increase in version number of entity "B" if I comment out Collections.sort(cs) then it doesn't. It would make sense if it really changed the order of Cs in the list. However it doesn't really change the order because they are already sorted in the table and I get same result when I remove Collections.sort(cs). So what is causing the increase in version number? Am I missing something obvious? It would be good to know what causes this behaviour. I'll be happy to cook some code up if you want more details.
type: Question
has comment: http://stackoverflow.com/comment/39212463
has comment: http://stackoverflow.com/comment/39212451
tagged with: sorting
has comment: http://stackoverflow.com/comment/39208947
has comment: http://stackoverflow.com/comment/39213397
score: 0
has comment: http://stackoverflow.com/comment/39211234
tagged with: version
type: UnansweredQuestion

http://stackoverflow.com/q/25203211
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: restlet-2.0
type: UnansweredQuestion
upvote count: 1
has body: I have a web application deployed on Tomcat, which uses Tomcat's form authentication. When writing a new servlet, this allows me to find a request's user via HttpServletRequest#getUserPrincipal. I would like to use Restlet in this app, and I was able to do so using Restlet's ServerServlet adaptor. However, it looks like I no longer have access to the user principal when receiving a new request in my resource classes. That is, the user prinicpal information is not carried through from Tomcat to Restlet. Is there any way of obtaining the principal?
tagged with: java
has answer: http://stackoverflow.com/a/30319694
has title: Getting the user principal in Restlet over Tomcat
type: Question
tagged with: restlet
tagged with: tomcat
has comment: http://stackoverflow.com/comment/39250638

http://stackoverflow.com/a/25084537
has body: Your threads need to use the same lock. In your code each of your two threads has its own lock, because the two threads are separate objects that are each using synchronized(this). That means they don't wait to take turns and they don't get notified when a thread calls notify or notifyAll (because only threads waiting on the same lock received the notification). Add a lock object to your TestPrint class like this: public static final Object LOCK = new Object(); and have your threads use that as their lock by changing their synchronized blocks to synchronized(LOCK) { Also the way you're calling notify right after calling wait doesn't make sense. You need to use notify after having written an entry, and wait while you're waiting to get an opportunity to write. You need to have some flag (for instance a volatile variable in the TestPrint class) that the threads use to decide when they can act, it's not safe to rely solely on notifications when figuring out when to act (because a thread can return from wait without having been notified). Say you added another field to TestPrint, to hold the next value to be printed: public static int nextValue = 1; then the OddThread could have code like: try { synchronized(TestPrint.LOCK) { // wait for nextValue to become odd while (TestPrint.nextValue % 2 == 0) { TestPrint.LOCK.wait(); } // at this point oddthread has the lock, // and nextValue is odd System.out.println(TestPrint.nextValue); TestPrint.nextValue += 1; // tell the other thread it can proceed TestPrint.LOCK.notify(); } } catch (InterruptedException e) { // won't happen (no one is calling interrupt // on this thread) } See the section of the Oracle tutorial that discusses guarded blocks for examples of using wait and notify.
answers question: http://stackoverflow.com/q/25082706
score: 1
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/39275084
has text: What do you mean by "the same name"? Do you mean the same **class** name? Or do you mean the same **variable** name? Please show some code that illustrates what you are doing now?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25216281

http://stackoverflow.com/a/25077826
has body: Your current mappings doesn't set an owner of the Registration/Institution association. If you want the Registration to control the association (most common) then this is your mapping: @Entity public class Registration{ @NotNull @ManyToOne(optional=false) private Institution institution; } @Entity public class Institution{ @OneToMany(cascade={CascadeType.REMOVE, CascadeType.MERGE}, fetch=FetchType.EAGER, mappedBy="institution", orphanRemoval=true) private Set&lt;Registration&gt; registrations; } If you want the Institution to control the association (not that common) then your mapping becomes: @Entity public class Registration{ @NotNull @ManyToOne(optional=false) @JoinColumn(updatable=false, insertable=false) private Institution institution; } @Entity public class Institution{ @OneToMany(cascade={CascadeType.REMOVE, CascadeType.MERGE}, fetch=FetchType.EAGER, orphanRemoval=true) private Set&lt;Registration&gt; registrations; } You cannot set both (updatable=false, insertable=false) and mappedBy because then neither of this association ends can control the association, telling Hibernate which side to investigate when synchronizing the object state with the database.
type: Answer
answers question: http://stackoverflow.com/q/25072653
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/39323829
score: 0
comment on: http://stackoverflow.com/a/25202623
type: Comment
has text: i think the problem is that eclipse don't accept httpclient.execute() and httpresponde.getentity() without surrinding with try and catch , and then the problems begins and it crashes again
type: AnswerComment

http://stackoverflow.com/comment/39181371
comment on: http://stackoverflow.com/a/25105724
has text: @ChristophWintersteiger:Thank you so much for the profiling information. I will test it in my current system and get back to you shortly.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39203331
type: AnswerComment
type: Comment
has text: yes, because a method annotated with @BeforeClass should be static
score: 0
comment on: http://stackoverflow.com/a/25176696

http://stackoverflow.com/comment/39202554
type: Comment
type: QuestionComment
has text: When you say remove, can I just delete them from the libs folder or do I have to go into the Java build path as well?
comment on: http://stackoverflow.com/q/25177428
score: 0

http://stackoverflow.com/q/25187942
tagged with: java
tagged with: image-processing
downvote count: 1
has comment: http://stackoverflow.com/comment/39224017
type: Question
score: 6
has comment: http://stackoverflow.com/comment/39223134
has title: Java 8 ImageIO reads JPEG incorrectly in Linux
has answer: http://stackoverflow.com/a/25191286
has body: I'm trying to read user-uploaded JPEG image (arbitrary) to create thumbnail in server app. System works just fine in Windows7 / Oracle Java 8u11 but I have problem with color model under CentOS on server: original image is: http://studio-st.ru/media/portfolio/image/45 resulting thumbnail on development workstation under Windows is absolutely correct result under Linux is color-shifted (reddish on Java 8u05, color-shifted on Java 8u11). Not presented here because original example was on site, which is fixed now. Deeper investigation shown that problem is in reading image - ImageIO.read(inputStream) on Windows and Linux return image objects with exactly the same parameters, however color probe getRGB(x,y) for the same image (just read) returns different values. Colors treating in Linux differ on Java 8u05 &amp; 8u11, 8u05 was "reddish", 8u11 is as shown above. This has nothing to do with alpha channels - this particular source image is JPEG Type 5 (TYPE_3BYTE_BGR), exported from Adobe Lightroom with conversion to sRGB, without any other tricks. This also affects all images exported that time (all images on this site, in fact). Can anyone provide some advice on how to make it work (except for waiting for fix for JDK)? Maybe recommend alternate library, which can be used here (EJB, data stored in MongoDB, so data is fetched using InputStreams - no filesystem access). Thanks! UPD: issue appears to be with Java8's new Color Management Module - it doesn't understand this image format. Switching to legacy CMM fixed the issue. Please see details in correct comment below.
answer count: 1
favorite count: 0
upvote count: 7
tagged with: java-8
linked to: http://stackoverflow.com/q/2999528
accepted answer: http://stackoverflow.com/a/25191286
tagged with: javax.imageio
type: AnsweredQuestion

http://stackoverflow.com/a/25126462
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25126423
answers question: http://stackoverflow.com/q/25126423
downvote count: 0
has body: 79-70 is not treated as range but rather as simple subtraction and its value is 9. Because you also wrote 89-80 and the value of that is also 9, the compiler thinks you want to specify 9 twice. To better structure this use if and else if rather than using a switch for this matter: if (Grade_Average &gt; 100) { System.out.println("Not possible, you got more than 100 points you cheater!"); } else if (Grade_Average &gt;= 90) { System.out.println( " Your average test score is " + Grade_Average ); System.out.println( "Your letter grade is an A." ); } else if (Grade_Average &gt;= 80) { // do stuff } // moar stuff!!11!one! else if (Grade_Average &gt;= 0) { System.out.println( " Your average test score is " + Grade_Average ); System.out.println( "Your letter grade is a F." ); } else { System.out.println("Error! I cannot grade your score!"); } This approach first checks if Grade_Average is greater than the first threshold, and if it is it prints the respective sentences. Next it checks the next threshold and if if is greater than it it blah blah blah. Finally if no match is found it returns an error. It also returns an error if the test score is greater than 100. This method I presented is what I personally would do as I think it is more readable than a case statement. However if you still insist on using a case statement, you could try something like this: public static boolean isBetween(int x, int lower, int upper) { return lower &lt;= x &amp;&amp; x &lt;= upper; } switch(Grade_Average) { case isBetween(90, 100): System.out.println( " Your average test score is " + Grade_Average ); System.out.println( "Your letter grade is an A." ); break; case isBetween(80, 89): System.out.println( " Your average test score is " + Grade_Average ); System.out.println( "Your letter grade is a B." ); break; case isBetween(70, 79): System.out.println( " Your average test score is " + Grade_Average ); System.out.println( "Your letter grade is a C." ); break; case isBetween(65, 69): System.out.…
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39108261
score: 4
has comment: http://stackoverflow.com/comment/39108198
type: Answer

http://stackoverflow.com/q/25145697
upvote count: 1
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
tagged with: jpa
downvote count: 0
score: 1
has title: InheritanceType.JOINED, @PrimaryKeyJoinColumn and nested subclasses
favorite count: 0
has answer: http://stackoverflow.com/a/35826402
has answer: http://stackoverflow.com/a/25167734
has body: I am getting started with Hibernate have a question about InheritanceType.JOINED and @PrimaryKeyJoinColumn. Given the below database tables where employee references person and manager references employee: create table person (person_id int(10) auto_increment, name varchar(100), primary key (person_id)); create table employee (employee_id int(10) auto_increment, person_id int(10), salary int(10), primary key (employee_id)); create table manager (manager_id int(10) auto_increment, employee_id int(10), shares int(10), primary key (manager_id)); I can create the first two classes for Person and Employee as follows: @Entity @Table(name="person") @Inheritance(strategy=InheritanceType.JOINED) public class Person { @Id @GeneratedValue @Column(name="person_id") private int personId; @Column(name="name") private String name; } @Entity @Table(name="employee") @PrimaryKeyJoinColumn(name="person_id") public class Employee extends Person { @GeneratedValue @Column(name="employee_id") private int employeeId; @Column(name="salary") private int salary; } When it comes to the Manager class I am not sure which value to use for the @PrimaryKeyJoinColumn. From reading the JPA spec I should be using only one id throughout the superclass/subclass/subclass hierarchy, which I suspect should be person_id. Should I remove the employee_id column from the manager table and replace it with person_id? The reason I ask is that it seems natural to have "cascading" primary keys in the database (i.e. manager does not directly refer to person) but I believe Hibernate requires that all child subclasses (however "deep") contain a foreign key back to the superclass. Some confirmation on my assertions would be really useful.
type: UnansweredQuestion

http://stackoverflow.com/comment/39248282
type: Comment
type: QuestionComment
has text: As an aside, best practice suggests that you should use the globalMap for passing data around a job and only use context variables to pass data to another job.
comment on: http://stackoverflow.com/q/25201202
score: 0

http://stackoverflow.com/a/25124738
type: Answer
has comment: http://stackoverflow.com/comment/39106422
has comment: http://stackoverflow.com/comment/39106842
has body: There's a trick to getting rmi working behind a firewall. rmi uses two ports, and if you don't specify both ports, it doesn't work through a firewall. the nice part is that you can use the same port for both ports. the annoying part is that this is not the default functionality. even worse, until jdk 7, there was no way to configure jmx to do this using the command line. assuming you are running on jdk 7+, you need to add this argument: -Dcom.sun.management.jmxremote.rmi.port=9999 More details here http://realjenius.com/2012/11/21/java7-jmx-tunneling-freedom/ .
score: 6
has comment: http://stackoverflow.com/comment/39106769
has comment: http://stackoverflow.com/comment/39107143
downvote count: 0
has comment: http://stackoverflow.com/comment/39107270
has comment: http://stackoverflow.com/comment/39109298
answers question: http://stackoverflow.com/q/25124148
has comment: http://stackoverflow.com/comment/39107395
has comment: http://stackoverflow.com/comment/39106974
has comment: http://stackoverflow.com/comment/39105997
upvote count: 6
has comment: http://stackoverflow.com/comment/39107396
has comment: http://stackoverflow.com/comment/39124981

http://stackoverflow.com/comment/39156778
comment on: http://stackoverflow.com/a/25104891
has text: Execute `DBCC FREEPROCCACHE DBCC DROPCLEANBUFFERS GO` at SQL Server then execute any `select` query in hibernate and after that execute `SELECT usecounts, size_in_bytes, cacheobjtype, text FROM sys.dm_exec_cached_plans CROSS APPLY sys.dm_exec_sql_text(plan_handle) WHERE cacheobjtype != 'Parse Tree'` in SQL server.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39062435
score: 0
type: Comment
type: QuestionComment
has text: ok got it. please remove your androi:onclick from xml.
comment on: http://stackoverflow.com/q/25102156

http://stackoverflow.com/a/25152053
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25151917
upvote count: 1
has body: What you have here byte b = 123134235; is a constant expression where a narrowing primitive conversion would be attempted. The Java Language Specification states A narrowing primitive conversion may be used if the type of the variable is byte, short, or char, and the value of the constant expression is representable in the type of the variable. The value, the integer literal 123134235 is not representable by the type byte and so compilation fails.

http://stackoverflow.com/a/25146048
has comment: http://stackoverflow.com/comment/39144776
answers question: http://stackoverflow.com/q/25129245
score: 0
has body: The syntax Roman provides is correct, but there is a caveat, perhaps a bug. In further debugging, I changed getRemoveButtons to public Map&lt;String, String&gt; getRemoveButtons() { log.debug("Call to 'RemoveButtons'"); return removeButtons; } I got the appropriate log message when using Long, but when I converted to Map, no syntax I've tried would get this function called until I discovered that white space in the string breaks the functionality. i.e. 'GN 00501.013' would not work, but 'GN00501.013' does. I'll enquire on the Struts2 mailing lists if this is by design or some other issue unrelated to Struts that cannot be overcome.
type: Answer

http://stackoverflow.com/comment/39138201
score: 2
has text: `[^</post>]*` don't do what you think it does..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25142957

http://stackoverflow.com/comment/39223575
comment on: http://stackoverflow.com/q/25176612
score: 0
type: Comment
has text: Line # 56: the for-each loop. Line # 56: Invokes the service class.
type: QuestionComment

http://stackoverflow.com/comment/39236810
has text: @SotiriosDelimanolis: Authroization fileter is taking request and authenticating the user. Thats the first step I want to be in my application. It is also setting the servlet context which I would be needing in File Servlet.Therefore I need File Servlet to be invoked after AuthorizationFilter.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25195907

http://stackoverflow.com/comment/39115494
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25130557
has text: This is extremely strange. I don't understand how code can't know why it couldn't complete.
type: Comment

http://stackoverflow.com/comment/39102956
type: AnswerComment
has text: alright thanks bro...please dont be annoyed i am just frustrated :(
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25120768

http://stackoverflow.com/q/25154754
possible better answer: http://stackoverflow.com/a/25154811
has answer: http://stackoverflow.com/a/25154842
has title: how to increment epoch time by 5 minutes in Scala or Java
has answer: http://stackoverflow.com/a/25154811
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/41599546
has answer: http://stackoverflow.com/a/25154864
answer count: 5
tagged with: scala
tagged with: datetime
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25154842
type: Question
has body: val df = new SimpleDateFormat("MMM dd yyyy HH:mm:ss.SSS zzz") var date1 = new Date() println(date1.getTime) Result: 1407309964324 how can i increment it by 5 minutes?
has answer: http://stackoverflow.com/a/25159079

http://stackoverflow.com/q/25104828
tagged with: java
accepted answer: http://stackoverflow.com/a/25104840
type: Question
has body: Since we cant return value from constructor in C++ or JAVA, if there is some error while initialising a new object then how can we possibly know it and handle accordingly?
has comment: http://stackoverflow.com/comment/39067129
has comment: http://stackoverflow.com/comment/39067230
score: 0
has answer: http://stackoverflow.com/a/25104843
has answer: http://stackoverflow.com/a/25106344
has answer: http://stackoverflow.com/a/25104840
answer count: 4
has title: How to handle initialization error occurred in constructor with no return allowed in constructor
tagged with: c++
has comment: http://stackoverflow.com/comment/39067133
possible better answer: http://stackoverflow.com/a/25104857
has comment: http://stackoverflow.com/comment/39067119
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25104857

http://stackoverflow.com/comment/39025011
comment on: http://stackoverflow.com/a/25082137
score: 0
type: AnswerComment
has text: @user3276091 sujithvm just fixed the bug, not introduced the new way to run, what's the problem then?
type: Comment

atomic
type: Tag
tags question: http://stackoverflow.com/q/25198713
tag name: atomic

glassfish-4
tags question: http://stackoverflow.com/q/25193763
type: Tag
tags question: http://stackoverflow.com/q/25170278
tags question: http://stackoverflow.com/q/25227794
tag name: glassfish-4

http://stackoverflow.com/q/25168036
tagged with: java
has comment: http://stackoverflow.com/comment/39186072
has comment: http://stackoverflow.com/comment/39191937
type: Question
has comment: http://stackoverflow.com/comment/39185625
has body: I am trying to use the SQLDatabase as a of objects of class Todo(int id, String name, String date, String note). After creating helper by following piece of code: package com.example.todoistodo; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class TodoSQLiteHelper extends SQLiteOpenHelper { public TodoSQLiteHelper(Context context) { // Databse: todos_db, Version: 1 super(context, "todos_db", null, 1); } // todos // _id - key // todo - todo text // date - todo date // note - todo note @Override public void onCreate(SQLiteDatabase db) { // Execute create table SQL db.execSQL("CREATE TABLE todos (_id INTEGER PRIMARY KEY AUTOINCREMENT , todo TEXT NOT NULL , date TEXT NOT NULL , note TEXT NOT NULL);"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVer, int newVer) { db.execSQL("DROP TABLE IF EXISTS todos"); onCreate(db); } } ..and creating object to query database: package com.example.todoistodo; import java.util.ArrayList; import java.util.List; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class TodoDAO { private SQLiteDatabase db; private TodoSQLiteHelper dbHelper; public TodoDAO(Context context) { dbHelper = new TodoSQLiteHelper(context); db = dbHelper.getWritableDatabase(); } public void close() { db.close(); } public void createTodo(String todoName, String todoDate, String todoNote) { ContentValues contentValues = new ContentValues(); contentValues.put("todo", todoName); contentValues.put("date", todoDate); contentValues.put("note", todoNote); db.insert("todos", null, contentValues); //lane 30 } public void deleteTodo(int todoId) { db.delete("todos", "_id = " + todoId, null); } //get every single Todo public List&lt;Todo&gt; getTodos() { List&lt;Todo&gt; todoList = new ArrayList&lt;Todo&gt;(); String[] tableColumns = new String[] {"_id","todo","date","note"…
has title: SQLiteException: table X has no column named Y
has comment: http://stackoverflow.com/comment/39185862
has comment: http://stackoverflow.com/comment/39185101
has answer: http://stackoverflow.com/a/25168374
score: 0
tagged with: sql
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39195613
tagged with: android

http://stackoverflow.com/comment/39162085
type: Comment
has text: I want to get the Mac Id while starting the Tomcat
comment on: http://stackoverflow.com/a/25155864
type: AnswerComment
score: 0

http://stackoverflow.com/q/25209339
type: Question
type: AnsweredQuestion
has title: Spring + AspectJ weaving for java 8 using aspectj-maven-plugin
has answer: http://stackoverflow.com/a/25248763
accepted answer: http://stackoverflow.com/a/25248763
tagged with: java
score: 18
has body: I'm migrating my project from java 7 to java 8 and the problem I have is related to aspectj weaving using aspectj-maven-plugin. I could configure successfuly the weaving using this plugin running on Java 6 and 7 according to Haus documentation. But the problem is that I haven't found any way to use (and find) plugin version 7 that supports java 8. I saw here that plugin 7 adds java 8 support but couldn't find a way to use it. This is the configuration plugin I need: org.codehaus.mojo aspectj-maven-plugin 1.7 1.8 1.8 1.8 compile test-compile I confirmed that above code using version 1.6 works fine for Java 7, but had no luck trying to use version 1.7. Do you know how to run the weaver for spring+aspectj running on Java 8?
tagged with: aspectj-maven-plugin
tagged with: aspectj
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/49675009
has comment: http://stackoverflow.com/comment/39415535
upvote count: 18
downvote count: 0
has comment: http://stackoverflow.com/comment/49675154
tagged with: spring
tagged with: java-8

http://stackoverflow.com/comment/39168313
type: QuestionComment
comment on: http://stackoverflow.com/q/25159249
has text: "I am quite new to java" and to programming in general, it seems. Although you might get an answer to your question here, the short and specific answers we expect here are not really suitable for teaching novices the basics. Explaining them *properly* requires too much explanation. You might be better asking elsewhere. If you have a teacher, ask them. Or read a good book.
type: Comment
score: 0

http://stackoverflow.com/q/25076155
tagged with: multithreading
has answer: http://stackoverflow.com/a/25078122
has comment: http://stackoverflow.com/comment/39014117
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/39016195
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39020048
has body: I have some multithreaded Java code. I know that I spawn three threads. I have six cores, so I expect to see my CPU usage jump between 0% and 50%. However, after adding some new, memory-intensive operations, I'm seeing the CPU usage jump up to 100% -- using all six cores of my machine. What's going on here? Is this the garbage collector at work?
possible better answer: http://stackoverflow.com/a/25078122
accepted answer: http://stackoverflow.com/a/25107040
score: 0
has comment: http://stackoverflow.com/comment/39013846
has comment: http://stackoverflow.com/comment/39013980
has answer: http://stackoverflow.com/a/25107040
has title: Why is Java using more cores than I asked it to?

http://stackoverflow.com/comment/39026612
score: 0
type: QuestionComment
type: Comment
has text: If you can, in all your threads that access the DB sooner or later, identify a point that is before the first such access: then this point would be the one to block on the lock.
comment on: http://stackoverflow.com/q/25082815

http://stackoverflow.com/comment/39008656
comment on: http://stackoverflow.com/a/25073325
score: 0
type: AnswerComment
has text: I agree with @alfasin, but make sure the size of your ArrayList isn't too big - or this will take a long time. Came across similar code 2 days ago, where the array could literally be any size. It just so happened that my data was n=15,000, which meant the inner loop executed n*(n-1)/2 times - ie approx 112,492,500. PS. The whole code ended up being redundant anyway.
type: Comment

http://stackoverflow.com/a/25362461
upvote count: 0
answers question: http://stackoverflow.com/q/25228911
score: -1
has body: Try to use ocpsoft rewrite. Follow an instruction to install it and then add config class with your entry point and urls. @RewriteConfiguration public class RewriteUrlConfigurationProvider extends HttpConfigurationProvider { @Override public Configuration getConfiguration(ServletContext servletContext) { return ConfigurationBuilder.begin() .addRule(Join.path("/registration").to("/index.html")) .addRule(Join.path("/department/{id}").to("/index.html")).where("id").matches("[0-9]+"); } @Override public int priority() { return 10; } }
type: Answer
downvote count: 1

http://stackoverflow.com/comment/39225842
type: Comment
comment on: http://stackoverflow.com/a/25189794
has text: This solved the problem, thank you! I was able to apply this fix and add new threads from other classes and it worked just fine!
type: AnswerComment
score: 0

http://stackoverflow.com/a/25156125
score: 0
has body: I found the way, it's something like this: Manifest manifest = new Manifest(); Attributes attr = manifest.getMainAttributes(); attr.put(Attributes.Name.MANIFEST_VERSION, "1.0"); // More attributes FileOutputStream manifestFile = null; try { manifestFile = new FileOutputStream(filepath); manifest.write(manifestFile); manifestFile.close(); } catch (IOException e) { log.print(e); }
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25136932
type: Answer
accepted answer of: http://stackoverflow.com/q/25136932

http://stackoverflow.com/q/25207533
favorite count: 0
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has body: MongoClient mongoClient = new MongoClient() DB db = mongoClient.getDB("mydb") DBCollection recordsColl = db.getCollection("records") BasicDBObject mongoRecord = new BasicDBObject() //put some things in mongoRecord recordsColl.insert(mongoRecord) How can I tell if the insert went successfully? Doing WriteResult writeResult = recordsColl.insert(mongoRecord) writeResult.getLastError() Seems getLastError() has depreciated. Any suggestions? Thanks!
type: Question
tagged with: mongodb
has answer: http://stackoverflow.com/a/25207965
accepted answer: http://stackoverflow.com/a/25207965
has title: mongodb java check if insert succeeded
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/39286035
comment on: http://stackoverflow.com/a/25221586
type: Comment
has text: Glad i could help. I strongly suggest to use import feature only for DEVELOPMENT purposes.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39094721
comment on: http://stackoverflow.com/q/25119484
score: 0
type: Comment
type: QuestionComment
has text: Try - Help > Install new Software

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/25139740
type: Tag

http://stackoverflow.com/comment/65806523
score: 0
type: Comment
has text: OP faced error because of some other reason. He already has used this code in his/her answer! A -1.
comment on: http://stackoverflow.com/a/39234675
type: AnswerComment

http://stackoverflow.com/a/25119629
accepted answer of: http://stackoverflow.com/q/25093693
type: Answer
has body: I would not use servlet context to store data for a cluster. The common pattern is to use a database for data that must be shared across different servers. For your use case, it is no need persisting the values between different runs, so the database is not necessarily a nice solution, even if it is easy to setup. IMHO what you need it just a shared data cache or better a memory data grid. hazelcast should be easy to use for your requirements. If I correctly understand them, what you need is a distributed map, with a concatenation of node_id, session_id as key (or maybe simply session_id), and a user object as value.
answers question: http://stackoverflow.com/q/25093693
has comment: http://stackoverflow.com/comment/39160529
downvote count: 0
has comment: http://stackoverflow.com/comment/39160846
score: 1
has comment: http://stackoverflow.com/comment/39167917
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39169336

http://stackoverflow.com/a/25186309
upvote count: 25
has comment: http://stackoverflow.com/comment/62264630
downvote count: 1
has body: Maven Surefire finds test classes by their name. Either change the class name to ATest, or reconfigure the name pattern used by Surefire. The POM for the spock-example project demonstrates how to do the latter.
score: 24
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25186004
type: Answer
has comment: http://stackoverflow.com/comment/78526349
accepted answer of: http://stackoverflow.com/q/25186004

http://stackoverflow.com/comment/39423250
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25103604
type: Comment
has text: Shortcut works. What is not working well, that I have to invoke the shortcut in editor view (it's not working from package explorer view). I have a problem with default package and there is also warning that "There is no package in /src/main/java /src". Test is also not created currently, but I believe this is what I asked for.

http://stackoverflow.com/comment/39115230
score: 0
comment on: http://stackoverflow.com/q/25086110
type: Comment
type: QuestionComment
has text: That's exactly what I'm doing. I just can't believe I have to get the same object twice... ATG is that bad?

http://stackoverflow.com/q/25087694
tagged with: maven
has title: Synchronize with repository + Maven update + clean server in one step
has comment: http://stackoverflow.com/comment/39048835
tagged with: svn
tagged with: java
tagged with: eclipse
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/26176207
score: 0
tagged with: build-automation
has body: I have to perform the following actions using Eclipse: Synchronize the project with SVN repository. If there are conflicts, update all non-conflicting files and stop; continue otherwise. Update all incoming changes. Do Maven Update on project. Clean my server in Servers view. Is there any way to do it all (or at least some actions) in one step? Can I script it somehow?
type: UnansweredQuestion

http://stackoverflow.com/comment/74913424
comment on: http://stackoverflow.com/a/29329228
has text: What is the nonpublic API? I mean I would think all APIs would be public. I searched google for "private API" but not sure what I found is the same thing.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25102491
has body: First of all, I will point out this is probably better asked at Programmers than at Stack Overflow. It depends on the individual libraries. Libraries are normally provided under one or more licenses, which explain what permissions, restrictions and requirements are conferred to you. The JXGrabKey page you linked says it's licensed under the GNU Library or Lesser General Public License version 3.0 (LGPLv3), which is good news for you. Check that LGPLv3 link out, read the license, and look it up on Wikipedia (or ask about it on Programmers SE) if you need help understanding your rights and requirements under the LGPL. Agynamix doesn't seem to have a license listed on the page you linked, and in any situation where you aren't told what license the content is available under, I would suggest that you are not licensed to use it at all (n.b. I am not a lawyer). You may want to look through the sources, as distribution-quality source code generally have a license boilerplate in a comment at the start of each file. JIntellitype's page shows that it is provided under the Apache License 2.0. Again, read the license and make sure you understand it before you distribute any software that includes this library.
score: 1
answers question: http://stackoverflow.com/q/25102473
type: AcceptedAnswer
upvote count: 1
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25102473

http://stackoverflow.com/q/25077694
has answer: http://stackoverflow.com/a/25129969
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25129969
has title: JasperReports not work on Grails 2.4: Could not initialize class net.sf.jasperreports.engine.xml.JRXmlDigesterFactory
has answer: http://stackoverflow.com/a/25098292
type: Question
tagged with: jasper-reports
tagged with: java
has body: I'm using grails version 2.4.0 and JasperReports plugin: 1.9.0 (also tried version jasper-1.10.0-SNAPSHOT) but when I export to pdf I got errors. When I first start project, I run export report and got this message org.apache.commons.collections.map.ReferenceMap After that when I try again and it shows this error. Could not initialize class net.sf.jasperreports.engine.xml.JRXmlDigesterFactory It seems to be in competitive with version 2.4.0 because it works on 2.2.4 Here my code In controller def results = new ArrayList() def reportFolder = "${grailsApplication.parentContext.getResource('reports').file.absolutePath}" def sep = System.getProperty('file.separator') def app = Applicant.get(2) results.add( first: app.firstName, middle: app?.middleInitial, last: app.lastName, ssn: app.ssn, workPhone: app.workPhone, homePhone: app.homePhone ) reportService.exportPDFReport("${reportFolder}${sep}aaa.jrxml", results, params, response) In service (note that service named: reportService) def exportPDFReport(String reportPath, results, params, response) { def temp_file = File.createTempFile("jasperReport", ".pdf") def jrDataSource = new JRMapCollectionDataSource(results) JasperReport jReport = JasperCompileManager.compileReport(reportPath) JasperPrint print = JasperFillManager.fillReport(jReport, params, jrDataSource) JasperExportManager.exportReportToPdfFile(print, temp_file.absolutePath) response.setContentType("application/force-download") response.setHeader("Content-Transfer-Encoding", "binary") response.setHeader("Content-disposition", "attachment; filename=${jReport.name}.pdf") response.outputStream &lt;&lt; temp_file.newInputStream() temp_file.deleteOnExit() } Any ideas?
tagged with: jasper-plugin
possible better answer: http://stackoverflow.com/a/25098292
tagged with: grails
score: 0
answer count: 2
tagged with: groovy

http://stackoverflow.com/comment/39100084
score: 0
has text: SQLiteOpenHelper itself creates a transaction to run the callbacks.
type: Comment
comment on: http://stackoverflow.com/a/25102539
type: AnswerComment

http://stackoverflow.com/comment/39098754
type: Comment
comment on: http://stackoverflow.com/a/25121390
type: AnswerComment
score: 0
has text: ActiveMQ. The main method will call some internal services that will do some processing with data from the message payload.

http://stackoverflow.com/q/25218419
has title: NoOutputStreamException during image upload in vaadin
tagged with: image-uploading
type: AnsweredQuestion
tagged with: java
tagged with: vaadin
type: Question
accepted answer: http://stackoverflow.com/a/26431969
has body: Trying to upload only images. The problem is that I don't know how to handle this situation. @Override public OutputStream receiveUpload(String filename, String mimeType) { FileOutputStream fos = null; if(mimeType.startsWith("image")) { picture = new Picture(); picture.filename = filename; picture.mimeType = mimeType; picture = HibernateUtils.save(picture); product.pictures.add(picture); File dirs = new File(IMAGE_LOCATION); File file = new File(IMAGE_LOCATION + picture.id); if (!dirs.exists()) { dirs.mkdirs(); } try { fos = new FileOutputStream(file); } catch (FileNotFoundException e) { throw new RuntimeException(e); } } else { Notification.show("", Notification.Type.ERROR_MESSAGE); } return fos; } The problem is that the fos variable will be null if I try to upload different type of files than image. The question is that, how should I handle it?
has answer: http://stackoverflow.com/a/26431969
score: 0
answer count: 1

http://stackoverflow.com/comment/39212149
type: Comment
score: 0
has text: My idea was to have one thread.. So you may have many clients that may try and wake this single thread. This thread is responsible for querying the other site for you and committing the query results to your local database. Your client threads will be polling your database for that result.. As I mentioned in my edit, the approach may be redundant if you cannot batch the query.. Your a bit limited for options really.
type: AnswerComment
comment on: http://stackoverflow.com/a/25136694

http://stackoverflow.com/q/25225401
has comment: http://stackoverflow.com/comment/39291913
tagged with: jfilechooser
tagged with: jbutton
type: Question
has answer: http://stackoverflow.com/a/25225494
has comment: http://stackoverflow.com/comment/39291759
has title: How do I assign JFileChooser to a JButton in Netbeans?
score: -2
accepted answer: http://stackoverflow.com/a/25225494
has comment: http://stackoverflow.com/comment/39291725
upvote count: 0
has comment: http://stackoverflow.com/comment/39291968
answer count: 1
favorite count: 0
has body: I'd prefer it from Property editor -> Customize Code. I need to select a folder in one instance and a file in another. The function will be: On pressing jButton1, jFileChooser1 opens and on confirmation of selection, returns the folder/file path selected to a String strFolderPath/strFilePath. Thanks in advance for any help.
type: AnsweredQuestion
tagged with: netbeans
tagged with: java
downvote count: 2
tagged with: swing

http://stackoverflow.com/comment/39013980
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25076155
has text: I have to cores with 2 threads each. I did some calculations in just one thread and saw two of my four threads being at a usage of about 40%. The other cores had a usage of about 1-5%. If your CPU has three cores with two threads each, the JVM is maybee doing the calculations distributed on the physical cores, not the threads in your cores. Just an idea...
score: 0

http://stackoverflow.com/comment/39054411
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25097851
has text: Jdbc-odbc bridge is deprecated in newest java releases

replace
tags question: http://stackoverflow.com/q/25178318
tags question: http://stackoverflow.com/q/25149579
tags question: http://stackoverflow.com/q/25139615
type: Tag
tag name: replace

http://stackoverflow.com/a/47292199
has body: Project structure -> modules -> choose required module (desktop, android, etc) -> Dependencies -> Add Library. Don't forget change Scope from "Provided" to "Compile".
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25080731

http://stackoverflow.com/q/25145047
type: Question
has body: In the code below, I create a JFrame, set the size to 800 by 800 pixels, set the layout to BorderLayout, then add a JPanel. In the JPanel, I use paintComponent to draw a 20x20 pixel image in 7 locations. At position 0-0, the icon appears in the upper right corner. The icon is 20 pixels high, and the frame and panel are both 800 pixels high, so drawing the icon at x-780 should align the icon with the bottom of the window. But the icond doesn't even appear. The remaining icons are drawn a x-770, x-760, x-758, and x-750. x-758 appears aligned with the bottom of the window. So I conclude that x[0] on the JPanel start at the JFrame's x[42] I think I've set the BorderLayout correctly. I do call setSize() in the JPanel's constructor. I thought setting an explicit size might screw it up. But after commenting that line out, the program shows the same behavior. Can you show me what I'm doing wrong? Frametest.java package frametest; import java.awt.BorderLayout; import javax.swing.JFrame; public class FrameTest extends JFrame{ public static final int HEIGHT = 800; public static final int WIDTH = 800; public FrameTest(){ setLayout(new BorderLayout()); add(new Panel(WIDTH, HEIGHT), BorderLayout.CENTER); pack(); setTitle("Frame Test"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(WIDTH, HEIGHT); setResizable(false); setLocationRelativeTo(null); setVisible(true); } public static void main(String[] args) { new FrameTest(); } } Panel.java package frametest; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import javax.swing.ImageIcon; import javax.swing.JPanel; public class Panel extends JPanel{ private int height; private int width; Image icon1 = new ImageIcon(this.getClass().getResource("icon1.png")).getImage(); //Note that the png file is 20 x 20 pixels. public Panel(int width, int hieght){ setBackground(Color.BLUE); //setSize(width, hieght); } public void paintComponent(Graphics g){ super…
score: 0
has title: JPanel and JFrame are different sizes
answer count: 3
has answer: http://stackoverflow.com/a/25145172
has answer: http://stackoverflow.com/a/25145261
accepted answer: http://stackoverflow.com/a/25145261
tagged with: jframe
tagged with: swing
has answer: http://stackoverflow.com/a/25145153
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39142908
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/25145153

http://stackoverflow.com/comment/39050231
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25092384
type: QuestionComment
has text: I think XWPF is also acceptable if there is no problem to save .doc as .docx. My work is that, suppose I have a .doc file that contains some information of different countries such as US, Japan, Italy. Then the first step is to extract the US related information into a new file us.doc and that of Japan into a new file Japan.doc.

http://stackoverflow.com/comment/39210247
type: QuestionComment
comment on: http://stackoverflow.com/q/25176436
has text: after correcting the syntax errors (closing tags) on xhtml code, it works just fine. i just don't get it...
score: 0
type: Comment

http://stackoverflow.com/q/25092216
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/2629357
tagged with: java
linked to: http://stackoverflow.com/q/2629357
has answer: http://stackoverflow.com/a/25092333
type: Question
score: 0
answer count: 1
favorite count: 0
has body: I recently read this post: Is Java "pass-by-reference" or "pass-by-value"? The first answer was far too terse and specific to give me a firm understanding, and everyone else created 15 page essays explaining what should be a simple topic. Are the following rules correct (which are pretty simple if true): 1.) Named things associated with a type that aren't primitives ("objects references" in Java talk) are pointers in C++. 2.) . on a Java pointer is the same as using -> on a C++ pointer. 3.) = on a Java pointer is the same as using = on a C++ pointer. 4.) All functions pass by value (and hence pass Java pointers by value). (This ignores memory management differences like the fact that = on a Java pointer is fine whereas = on a C++ pointer means you might need to worry about memory management) The most confusing element to the puzzle is that no one I have seen has conveyed this set of rules/understanding of what Java is doing in clear English (opting instead for 15 pages and diagrams). The second most confusing element is that Java uses the word "reference" in a way that is different from C++. If you want an analogy between what Java is doing in terms of C++, pointers and the rules I created are the simplest terms to digest Java's behavior.
has comment: http://stackoverflow.com/comment/39047358
tagged with: c++
upvote count: 3
downvote count: 3
linked to: http://stackoverflow.com/q/40480
accepted answer: http://stackoverflow.com/a/25092333
has title: Java Objects and Pointers from C++ Perspective

http://stackoverflow.com/q/25117060
tagged with: selenium-webdriver
has body: My application is using Mathml editor and i want to record button from this editor. i am using Selenium IDE, But not able to record any action from this editor. i am new for selenium please help me out. This is what I've tried so far: driver.switchTo().frame("editML"); WebElement editor = driver.findElement(By.className("#editML")); JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; jsExecutor.executeScript("arguments[0].innerHTML = ' Heading Hello World'", editor);
tagged with: java
downvote count: 1
type: Question
tagged with: testing
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/25122880
answer count: 2
has answer: http://stackoverflow.com/a/31696609
favorite count: 0
tagged with: selenium-ide
type: UnansweredQuestion
has title: Software Testing Selenium IDE/Web driver
has comment: http://stackoverflow.com/comment/39093665

http://stackoverflow.com/q/25132215
downvote count: 3
upvote count: 1
tagged with: blender
has body: I'm planning to make a 3D, interactive main menu in Blender for a visual novel I'm making. The coders are writing their own engine. I'm wondering if it's possible to make the main menu in Blender and then put it into the custom engine. The engine is being written in Java. Sorry, if I'm vague. I propsed the idea, but don't know much about coding (I'm an artist).
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/39118363
has title: Porting a Blender game to another engine
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/39118458
favorite count: 0
has comment: http://stackoverflow.com/comment/39118475
has answer: http://stackoverflow.com/a/25205726
type: UnansweredQuestion

http://stackoverflow.com/a/25213272
has body: You've named your class is ResultSetMetaData which doesn't contain the methods found in java.sql.ResultSetMetaData.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25212341
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25212341
type: Answer

http://stackoverflow.com/q/25078716
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39018044
type: Question
has title: Why components become big when I insert JList into dialog with GridLayout?
has comment: http://stackoverflow.com/comment/39018526
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/39019207
favorite count: 0
type: UnansweredQuestion
tagged with: jlist
has comment: http://stackoverflow.com/comment/39018049
tagged with: swing
has answer: http://stackoverflow.com/a/25082852
has body: If I use JList my JDialog becomes very large and JTextFields are resized themselves. But if I don't use JList all is ok. To see my big buttons and textfields please run this demo: package demo; import java.awt.BorderLayout; import java.awt.GridLayout; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JTextField; public class AddInventoryDialog extends JDialog { private static AddInventoryDialog dialog; private AddInventoryDialog() { super(null, "Add inventory", ModalityType.APPLICATION_MODAL); JPanel contentPane = (JPanel) super.getContentPane(); contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); super.setLayout(new BorderLayout(0, 20)); super.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(10, 2, 10, 5)); JLabel nameLabel = new JLabel("Name"); JLabel sizeLabel = new JLabel("Size"); JLabel brandLabel = new JLabel("Brand"); JLabel patternLabel = new JLabel("Pattern"); JLabel colorLabel = new JLabel("Color"); JLabel boughtLabel = new JLabel("Bought date(dd MM yyyy)"); JLabel lastWashedLabel = new JLabel("Last washed(dd MM yyyy)"); JLabel seasonLabel = new JLabel("Season"); JLabel categoryLabel = new JLabel("Category"); final JTextField nameField = new JTextField(); final JTextField sizeField = new JTextField(); final JTextField brandField = new JTextField(); final JTextField patternField = new JTextField(); final JTextField colorField = new JTextField(); final JTextField boughtField = new JTextField(); final JTextField lastWashedField = new JTextField(); final JList&lt;String&gt; categoryField = new JList&lt;&gt;(new String[] { "ietm1", "ietm1", "ietm1", "ietm1" }); panel.add(nameLabel); panel.add(nameField); panel.add(sizeLabel); panel.add(sizeField); panel.add(brandLabel); panel.add(brandField); panel.add(patternLabel); panel.add(patternField); p…
score: 2

http://stackoverflow.com/q/25137793
has comment: http://stackoverflow.com/comment/39128449
has comment: http://stackoverflow.com/comment/39129076
has body: "Error: Could not find or load main class Start" This is the error I have been dealing with for the past few days, no matter how much research I do it doesn't seem ot help me at all. I know that it is trying to locate "Start.java", I believe I have configured Eclipse to look for Start.java in the (default packages) package, where it is. However, I click the run button and the error just keeps popping up. Please, I desperately need help, any comment will be appreciated greatly. [Update] I managed to add Start.class to my classpath somehow, I just tried every single method on StackExchange and one of them seemed to work. However, yet another problem has arose, on launch this occurs: Exception in thread "main" java.lang.SecurityException: class "bgv"'s signer information does not match signer information of other classes in the same package at java.lang.ClassLoader.checkCerts(Unknown Source) at java.lang.ClassLoader.preDefineClass(Unknown Source) 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.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 Start.main(Start.java:11)
has comment: http://stackoverflow.com/comment/39128440
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/39128413
tagged with: find
has answer: http://stackoverflow.com/a/57893989
upvote count: 2
has comment: http://stackoverflow.com/comment/39128793
answer count: 1
tagged with: load
favorite count: 0
has title: Error: Could not find or load main class Start
linked to: http://stackoverflow.com/q/11235827
has comment: http://stackoverflow.com/comment/39128337
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39128504
score: 2
downvote count: 0
tagged with: java

http://stackoverflow.com/a/56612153
has body: this (validatingListener.addValidator("beforeCreate", validator);) doesn't really fully work because the validation only manages the entities. So if you try for example to put a validation on a non-entity you get a nasty error saying org.springframework.beans.NotReadablePropertyException: Invalid property '...' of bean class [... the non-entity one ...]: Bean property '....' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? While obviously more laborious you can perform the validation directly on the Validator manually, e.g: @Component("beforeSaveListingValidator") public class BeforeSaveListingValidator implements Validator { @Autowired private LocalValidatorFactoryBean validator; @Override public void validate(Object object, Errors errors) { BindingResult bindingResult = new BeanPropertyBindingResult(object, errors.getObjectName()); validator.validate(object, bindingResult); errors.addAllErrors(bindingResult);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25220440

http://stackoverflow.com/comment/39180151
type: Comment
has text: There probably is a way to get the vm to read classes out of a zipfile/apk, yes (though there might be a problem with the odex?) but the runtime linker won't take a .so file contained there - you will have to use your java code to copy it out to the file system and mark it executable before you can load that into your process and make jni calls to it.
score: 1
comment on: http://stackoverflow.com/q/25165254
type: QuestionComment

image
tags question: http://stackoverflow.com/q/25179381
tags question: http://stackoverflow.com/q/25190213
tags question: http://stackoverflow.com/q/25214528
tags question: http://stackoverflow.com/q/25093819
tags question: http://stackoverflow.com/q/25117383
tags question: http://stackoverflow.com/q/25161843
tags question: http://stackoverflow.com/q/25196734
tags question: http://stackoverflow.com/q/25123790
tags question: http://stackoverflow.com/q/25119308
tags question: http://stackoverflow.com/q/25135454
tags question: http://stackoverflow.com/q/25086868
tags question: http://stackoverflow.com/q/25159067
tags question: http://stackoverflow.com/q/25085871
tags question: http://stackoverflow.com/q/25177795
tags question: http://stackoverflow.com/q/25131904
tags question: http://stackoverflow.com/q/25199482
tags question: http://stackoverflow.com/q/25218853
tags question: http://stackoverflow.com/q/25127930
tag name: image
tags question: http://stackoverflow.com/q/25075504
tags question: http://stackoverflow.com/q/25123849
tags question: http://stackoverflow.com/q/25114303
tags question: http://stackoverflow.com/q/25151939
tags question: http://stackoverflow.com/q/25167256
type: Tag
tags question: http://stackoverflow.com/q/25212741
tags question: http://stackoverflow.com/q/25099511
tags question: http://stackoverflow.com/q/25123115

http://stackoverflow.com/a/25108525
type: Answer
downvote count: 0
score: 11
has body: I'd suggest to use some sorted data structure, such as TreeSet. Before insertion, check the number of items in the set, and if it reached 1000, remove the smallest number if it's smaller than the newly added number, and add the new number. TreeSet&lt;Integer&gt; set = ...; public void add (int n) { if (set.size () &lt; 1000) { set.add (n); } else { Integer first = set.first(); if (first.intValue() &lt; n) { set.pollFirst(); set.add (n); } } }
upvote count: 11
answers question: http://stackoverflow.com/q/25108416

http://stackoverflow.com/a/25220576
has body: Most certainly adapter is null. Your code doesn't show how the adapter got initialized, so it could be that it wasn't initialized with a value, or it was set to null after that.
has comment: http://stackoverflow.com/comment/39283107
type: Answer
has comment: http://stackoverflow.com/comment/39283167
answers question: http://stackoverflow.com/q/25220522
has comment: http://stackoverflow.com/comment/39288652
has comment: http://stackoverflow.com/comment/39283081
score: 0

http://stackoverflow.com/q/25224454
has body: @EventHandler public void onEntityDamageByEntityEvent(EntityDamageEvent event) { if(Math.random()&amp;lt;=0.02) { Entity e = event.getEntity(); int bleed = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { public void run() { //Two percent chance you will bleed if(e instanceof Player) { Player player = (Player) e; player.damage(1.0D); player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 200, 2)); player.sendMessage(ChatColor.RED + "You are bleeding, find a bandage and heal yourself"); public void onPlayerEvent(PlayerInteractEvent event) { //ERROR HAPPENS ON THIS LINE ON THE PARENTHESES Player player = event.getPlayer(); Action act = event.getAction(); if(event.getAction() == act.RIGHT_CLICK_AIR) { if(player.getItemInHand().getType() == Material.PAPER) { plugin.getServer().getScheduler().cancelTask(bleed); } } } } } }, 20, 400); } } I am fully aware that I am not allowed to have a method inside of a method, but I do not know any other way to make this work. The bleed variable on line 7 is supposed to correspond with the same one on line 22 The 2nd event is supposed to cancel the task in the first one. The error I'm getting is: Syntax error on "(" , ; expected. EDIT: @AndrewG So, I tested out your code, and it is not working correctly, this is the whole source of the class i have: ` package com.aidan.TeamHeal; import java.util.HashMap; import java.util.Map; import java.util.UUID; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; public class BukkitListener implements Listener { Map&lt;UUID, Integer&gt;…
has answer: http://stackoverflow.com/a/25224515
tagged with: java
tagged with: bukkit
type: Question
tagged with: minecraft
has title: How do i make the variable bleed work with both of these events
has comment: http://stackoverflow.com/comment/39308623
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/39307217
answer count: 3
has comment: http://stackoverflow.com/comment/39290022
has comment: http://stackoverflow.com/comment/39289995
has answer: http://stackoverflow.com/a/25224569
has comment: http://stackoverflow.com/comment/39304190
has answer: http://stackoverflow.com/a/25227167
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39302595
upvote count: 1
tagged with: plugins
has comment: http://stackoverflow.com/comment/39290031
downvote count: 1

http://stackoverflow.com/comment/39085511
score: 0
type: Comment
type: QuestionComment
has text: I can't see any `List` here.
comment on: http://stackoverflow.com/q/25114645

http://stackoverflow.com/a/25198470
upvote count: 3
type: Answer
has body: The POI Javadoc clearly documents XSSFSheet#removeRow(), which will remove the entire row from the sheet. There's also XSSFRow#removeCell(cell) to remove single cells.
has comment: http://stackoverflow.com/comment/39431790
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/25197874

http://stackoverflow.com/comment/39083730
comment on: http://stackoverflow.com/q/25113646
score: 0
type: Comment
type: QuestionComment
has text: elaborate your question..

http://stackoverflow.com/comment/39008009
comment on: http://stackoverflow.com/q/25073094
type: Comment
type: QuestionComment
has text: Try overriding the KeyReleased method and put your code in keyReleased.
score: 0

http://stackoverflow.com/comment/39236700
comment on: http://stackoverflow.com/a/25184537
type: Comment
has text: He say it in comments
score: 0
type: AnswerComment

http://stackoverflow.com/a/25226131
has comment: http://stackoverflow.com/comment/39293317
answers question: http://stackoverflow.com/q/25226102
type: Answer
has comment: http://stackoverflow.com/comment/39293335
has comment: http://stackoverflow.com/comment/39293402
has comment: http://stackoverflow.com/comment/39293153
upvote count: 1
has comment: http://stackoverflow.com/comment/39293178
has comment: http://stackoverflow.com/comment/39293463
score: 1
has comment: http://stackoverflow.com/comment/39293486
has body: How about this: ent1.setText(""); just put it at the end of your onClick Method Edit: conv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // here you get the text from your editText x = new Integer(ent1.getText().toString()); // do something with the text counter = x/100; // set result in another TextView dis1.setText("In Metres: " +counter); // work is done, so the editText can be cleared ent1.setText(""); } }); Edit 2 (reset button): resetButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // reset only by another button ent1.setText(""); } });
has comment: http://stackoverflow.com/comment/39293251
accepted answer of: http://stackoverflow.com/q/25226102
has comment: http://stackoverflow.com/comment/39293273
has comment: http://stackoverflow.com/comment/39293131
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25207744
tagged with: static
has answer: http://stackoverflow.com/a/25207783
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/2943556
has answer: http://stackoverflow.com/a/25207843
tagged with: java
has comment: http://stackoverflow.com/comment/39258936
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/2943556
has comment: http://stackoverflow.com/comment/39258959
score: 0
has title: Syntax - Java Static Segment of Class
has body: I've been working on debugging some projects, and I have come across this code syntax multiple times the fast few days. I've never seen this before and searches have not helped. What does this code do? public class SomeClass{ // Class member declarations... static{ // Code / method calls. Basically looks like a method. // What is this? } // method declarations... }

http://stackoverflow.com/a/25107879
has body: I'd use javax.xml.xpath. See XPath Tutorial - Example 6: Values of attributes can be used as selection criteria. Note also that there is not necessarily a (single) element's class name. id is unique in a Document whereas class is not. So it should rather read elements' class name. (Subtle, but important. :-) In other words: there is not necessarily just one Element returned when searching for a given class.
type: Answer
answers question: http://stackoverflow.com/q/25107554
score: 0

http://stackoverflow.com/comment/39217981
type: AnswerComment
has text: Dont see a libraries section when hit alt+enter!!!
comment on: http://stackoverflow.com/a/25185831
type: Comment
score: 2

http://stackoverflow.com/comment/58232827
score: 0
type: Comment
has text: Perhaps you could expand on the 'code only' answer. Provide an explanation of how it works?
comment on: http://stackoverflow.com/a/35259938
type: AnswerComment

http://stackoverflow.com/a/25243913
answers question: http://stackoverflow.com/q/25229034
type: Answer
downvote count: 0
score: 1
has body: JMS plugin is EE licenced. There could be solution for you. First, check this. Try to contact plugin creator if he want to share it. He had also shared his code. If you are familiar with Java, you would probably be in position to create plugin by yourself and maybe to share it with others. (note - he was designing for older version). It might be painful but even a paying someone (local guy, employee, freelancing sites, wasting your time on this), can be cheaper than buying EE solution because of one plugin (if you need other options it's off the topic right now) and it would be a great addition to pentaho community.
upvote count: 1

http://stackoverflow.com/comment/39182386
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25166449
has text: thats the think i don't want to make the depth of the folder structure fixed so these could go also with 12 folders or more.
score: 0

http://stackoverflow.com/comment/39048384
score: 2
has text: One `.0` is enough. Another option is adding `d` or `D` suffix after number to change it to `double`.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25094686

http://stackoverflow.com/a/25119944
answers question: http://stackoverflow.com/q/25119734
accepted answer of: http://stackoverflow.com/q/25119734
type: Answer
has comment: http://stackoverflow.com/comment/39133464
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/39237470
has body: Use '"+exp+"' instead of \""+exp+"\" : d.findElement(By.xpath("a[contains(text(),'"+exp+"')]//ancestor::table//parent::div")).sendKeys(Keys.ARROW_DOWN); Update d.findElement(By.xpath('a[contains(text(),"'+exp+'")]//ancestor::table//parent::div')).sendKeys(Keys.ARROW_DOWN);
has comment: http://stackoverflow.com/comment/39132149
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/68111409
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25163853
has body: You can also use parameters for the @Step annotation. For example, if the method accepts some variables: @Step("Get the maximum between {a} and {b}") public int max(int a, int b){ //implementation } If you need to use any object, you can override toString() method, or use needed parameters: public class User { private String name; private String password; ... } @Step("Type {user.name} / {user.password}.") public void loginWith(User user) { ... }

http://stackoverflow.com/comment/39186028
type: Comment
comment on: http://stackoverflow.com/q/25168549
type: QuestionComment
score: 0
has text: Just confirm, you want to keep only the last Eddie if there is more than one in the file? Or you want to keep all of them?

http://stackoverflow.com/comment/39060016
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25100852
score: 1
has text: What problem are you having?

http://stackoverflow.com/q/25158936
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/27385896
tagged with: java
has comment: http://stackoverflow.com/comment/39180632
type: Question
tagged with: jpa
answer count: 1
tagged with: database
has title: Concatenation in JPA 1.0
has body: I am facing an issue while trying to concatenate column values in JPA 1.0 named query : SELECT aum.id.pin, aum.id.planNBR, aum.id.subPlanNBR, AVG(aum.aumAmount) FROM AUMBalanceDO aum WHERE " + "CONCAT(aum.id.pin,aum.id.planNBR,aum.id.subPlanNBR) NOT IN ( SELECT CONCAT(PAP.pin,edo.planNBR,edo.subPlanNBR) FROM " + "ParticipantAdvicePortfolioDO PAP, EnrollmentDO edo WHERE PAP.userID = edo.userID AND edo.status ='E' AND edo.startDT &lt; :endDate " + " AND (edo.endDT &gt; :endDate OR edo.endDT IS NULL) ) AND aum.id.priceDate BETWEEN :startDate AND :endDate GROUP BY aum.id.pin, " + "aum.id.planNBR, aum.id.subPlanNBR" I am getting the below exception while trying to run the query, unexpected token [concat] As per the error its clear that in JPA 1.0 we dont have concat function is there any other alternative way to achieve this?
score: 0
has comment: http://stackoverflow.com/comment/39167501
has comment: http://stackoverflow.com/comment/39198850
has comment: http://stackoverflow.com/comment/39167670

http://stackoverflow.com/comment/39121094
score: 0
type: Comment
has text: So the misconfiguration seems to be on the Grizzly part, as if it used just one thread to service all incoming connections (as a double check, you should always see the same thread ID in your stdout). Try to remove all your custom configuration at the beginning of `GrizzlyMain`, just to see if the factory settings work differently
type: QuestionComment
comment on: http://stackoverflow.com/q/25133196

http://stackoverflow.com/q/25114303
favorite count: 0
has answer: http://stackoverflow.com/a/26490696
accepted answer: http://stackoverflow.com/a/26490696
linked to: http://stackoverflow.com/q/4918482
tagged with: degrees
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/26487614
downvote count: 0
score: 1
tagged with: java
tagged with: cursor
possible better answer: http://stackoverflow.com/a/25114623
type: Question
has answer: http://stackoverflow.com/a/25114623
tagged with: rotation
answer count: 2
tagged with: image
upvote count: 1
has body: Okay. So I'm trying to rotate the cursor image or the cursor itself depending on it's position. I have tried using Graphics2D g2d = (Graphics2D)g; AffineTransform old = g2d.getTransform(); g2d.rotate(Math.toRadians(degrees)); Toolkit toolkit = Toolkit.getDefaultToolkit(); //Get the default toolkit Image image = toolkit.getImage("pictures/skills/skill" +InfoReader.SkillData("CastImage") +".png"); //Load an image for the cursor Cursor cursor = toolkit.createCustomCursor(image, new Point(0, 0), "Cursor"); setCursor(cursor); g2d.setTransform(old); So I was thinking that this should rotate the image, but g2d.rotate() doesen't seem to have any effect on cursor? I'm not 100% sure if it has affect on the image itself. Atleast the cursor image is what I want it to be though. EDIT: Here's an example video :) (In my case, I just want to rotate it around a certain point which stays on the same spot all the time). https://www.youtube.com/watch?v=TQ71QXa-B-s
has title: Rotating Cursor or Cursor image Java

http://stackoverflow.com/q/25104992
has comment: http://stackoverflow.com/comment/39080013
answer count: 0
type: UnansweredQuestion
has title: Configuring Logging for Unit Tests in Spring Boot Project using Gradle Build
tagged with: spring-boot
tagged with: java
tagged with: gradle
type: Question
upvote count: 4
downvote count: 0
tagged with: logback
score: 4
has body: I have configured a web application in Gradle using spring boot, and I am running tests directly through STS, but the unit test does not pick up the custom logging, it is the same with running tests during Gradle builds. How do I customise the logging so that Unit Tests use the logback.xml I have added in src/test/resources both while running a Test individually from STS or running tests as part of Gradle Build? My Gradle file is as follows buildscript { repositories { mavenLocal() mavenCentral() maven { url "http://repo.spring.io/libs-release" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.4.RELEASE") } } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'eclipse-wtp' apply plugin: 'spring-boot' apply plugin: 'war' eclipse{ classpath { downloadSources=true } } war { baseName = 'wiggle' version = '0.0.1-BUILD-SNAPSHOT' } repositories { mavenLocal() mavenCentral() maven { url "http://repo.spring.io/libs-release" } } configurations { providedRuntime } dependencies { compile("org.springframework.boot:spring-boot-starter-web") compile("org.springframework.boot:spring-boot-starter-social-facebook") compile("org.springframework.boot:spring-boot-starter-data-jpa") compile("org.springframework.boot:spring-boot-starter-data-rest") compile("org.springframework.boot:spring-boot-starter-security") compile("com.jolbox:bonecp:0.8.0.RELEASE") // Test Dependencies testCompile("org.springframework.boot:spring-boot-starter-test") } task wrapper(type: Wrapper) { gradleVersion = '1.12' } I have a custom logback.xml (to put everything in debug mode) Anadis-MacBook-Pro:wiggle anadi$ cat src/test/resources/logback.xml <?xml version="1.0" encoding="UTF-8"?> <configuration> %d %5p | %t | %-55logger{55} | %m %n <level value="DEBUG" /> <level value="DEBUG" /> <appender-ref ref="CONSOLE" /> However when I run a test through Gradle or from STS directly The logging does not work for Spring, the output I get is SLF4J: Class path contains multiple SLF…
favorite count: 0

http://stackoverflow.com/q/25092903
accepted answer: http://stackoverflow.com/a/25092949
favorite count: 0
score: 2
upvote count: 2
possible better answer: http://stackoverflow.com/a/25092959
tagged with: swing
type: Question
has title: Java Applet Thread Animation
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25092959
tagged with: java
has body: I am gone through some of code java applet and animation, i write the following code : import java.applet.*; import java.awt.*; /*&lt;applet code="AppletDemo" width = 200 height = 100&gt;&lt;/applet&gt; */ public class AppletDemo extends Applet implements Runnable { String msg = "Text Animating from right to left..."; Thread t = null; int state; boolean stopFlag; int msgX = 200; String s; boolean diff; public void init() { setBackground(Color.cyan); setForeground(Color.black); } public void start() { t = new Thread(this); stopFlag = false; t.start(); s = "abc"; diff = s.equalsIgnoreCase("abc"); } public void run() { while (true) { try{ if(msgX&gt;=-150) msgX--; else msgX =200; Thread.sleep(10); repaint(); } catch(Exception e) {} } } public void paint(Graphics g) { g.drawString(msg,msgX,20); showStatus(diff+"Text at "+msgX+",20"); } } What is happening is that when i put Thread.sleep(100), it works fine but when i try to animate faster that is Thread.sleep(10) it starts flickering , i couldn't understand what is happening can anyone help.
answer count: 2
downvote count: 0
tagged with: applet
has answer: http://stackoverflow.com/a/25092949

http://stackoverflow.com/comment/39158196
comment on: http://stackoverflow.com/a/25133788
type: Comment
has text: @flyingmouse Thank you for a green mark. But i'm not completely satisfied, as you still have big problems. So let's try to see what we can do. Ouch, 40 minutes? That's huge! I've never worked with big files, and that's why i never really cared about time optimization. But now the time has come ;-) This code above is not perfect at all, i'll try to optimize it. And here i need your help: i would like to face the same problems as you do, so please tell me the sequence of actions you perform from the very beginning: you take .doc from the website, and what next?
score: 0
type: AnswerComment

http://stackoverflow.com/q/25168396
possible better answer: http://stackoverflow.com/a/25168489
score: 0
has answer: http://stackoverflow.com/a/25168489
has title: Java initializing object - Static vs non-Static access
favorite count: 0
tagged with: static
answer count: 4
has answer: http://stackoverflow.com/a/25168529
type: AnsweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/25168438
downvote count: 1
type: Question
tagged with: instantiation
tagged with: object
tagged with: java
accepted answer: http://stackoverflow.com/a/25168438
has body: I haven't been coding anything for a while now and I decided to practice a bit. I came up with this issue at the very beginning of my program and I spent last night trying to figure out or find a way around this problem but I didn't get any expected results. First, let's see the class: public class Task { private static int priority; private static int taskTime; private static boolean solved; public void setPriority(int p){this.priority = p;} public void setTasktime(int t){this.taskTime = t;} public void setSolved(boolean s){solved = s;} public int getPriority(){return this.priority;} public int getTaskTime(){return this.taskTime;} public boolean getSolved(){return this.solved;} public Task(int p, int t){ this.priority = p; this.taskTime = t; this.solved = false; } public static class ComparePriority implements Comparator&lt;Task&gt;{ @Override public int compare(Task t1, Task t2){ return Integer.compare(t1.getPriority(), t2.getPriority()); } } } Now, this is the piece of code I am trying to run: public class main { public static void main(String[] args) { Task t1 = new Task(20,1); Task t2 = new Task(13,2); Task t3 = new Task(10,5); ArrayList&lt;Task&gt; t = new ArrayList&lt;Task&gt;(); t.add(t2); t.add(t3); t.add(t1); System.out.println("List size: " + t.size()); System.out.println("T1 object's priority: " + t1.getPriority()); System.out.println("T2 object's priority: " + t2.getPriority()); System.out.println("T3 object's priority: " + t3.getPriority()); for(int i=0;i&lt;t.size();i++){ System.out.println("Current object task time: "+ t.get(i).getTaskTime()); System.out.println("Current index:" + i); } Collections.sort(t, new Task.ComparePriority()); for(int i=0;i&lt;t.size();i++){ System.out.println("Current object task time (post sort): " + t.get(i).getTaskTime()); System.out.println("Current index: " + i); } } I understand that these attributes were defined in a static way and I should be accessing them as Class.method(); If I were to instantiate 3 objects (as us…
has answer: http://stackoverflow.com/a/25168590

http://stackoverflow.com/a/25092921
downvote count: 0
upvote count: 2
has body: Graphics g is null. You cannot dereference a null object (e.g. by acessing fields or methods). Dereferencing such a null object throws the NullPointerException NullPointerException javadoc: Thrown when an application attempts to use null in a case where an object is required. These include: Calling the instance method of a null object. Accessing or modifying the field of a null object. Taking the length of null as if it were an array. Accessing or modifying the slots of null as if it were an array. Throwing null as if it were a Throwable value. As an additonal note, don't supress null warnings unless you actually know what you are doing. The IDE/compiler is there to help you, not get in your way.
answers question: http://stackoverflow.com/q/25092904
type: Answer
score: 2

actionlistener
tags question: http://stackoverflow.com/q/25098557
tags question: http://stackoverflow.com/q/25162658
tags question: http://stackoverflow.com/q/25197408
tags question: http://stackoverflow.com/q/25127484
tags question: http://stackoverflow.com/q/25223219
tags question: http://stackoverflow.com/q/25103083
tags question: http://stackoverflow.com/q/25100422
tags question: http://stackoverflow.com/q/25183873
type: Tag
tag name: actionlistener

jpype
tag name: jpype
type: Tag
tags question: http://stackoverflow.com/q/25070447

http://stackoverflow.com/comment/39102888
score: 0
comment on: http://stackoverflow.com/q/25123695
type: Comment
type: QuestionComment
has text: Try `Intent nextScreen = new Intent(youractivityname.this, MainMenu.class);` instead of `Intent nextScreen = new Intent(view.getContext(), MainMenu.class);`

http://stackoverflow.com/a/25133703
has comment: http://stackoverflow.com/comment/39161442
score: 0
has body: Is there any other way to test if a valid mail exists? You can't do that in a sensible way. Many developers are trying too hard to validate e-mail adresses, and even the regex you use is probably too much already. The format of e-mail adresses is not exactly fixed. And, even if you would test for the existence of a mail account by sending a mail to it, you don't even know if it belongs to a person. Is there a way to give the user an error message which tells him what mail caused the error? I'm not familiar with javax.mail specifically, but the function you call throws an exception. Why not do something like: try { javax.mail.Transport.send(myMessage, myAdresses); } catch(MessagingException ex) { System.out.println("An error occured: " + ex.getMessage(); } But maybe with better reporting. Also according to the documentation, the SendFailedException subclass (catch this one) has getValidUnsentAddresses to get you the addresses to where the sending of the message failed.
type: Answer
answers question: http://stackoverflow.com/q/25133415
has comment: http://stackoverflow.com/comment/39161559
has comment: http://stackoverflow.com/comment/39145412
has comment: http://stackoverflow.com/comment/39145212
has comment: http://stackoverflow.com/comment/39154218

http://stackoverflow.com/comment/39176204
score: 0
type: Comment
type: QuestionComment
has text: Have you tried: `#systemProperties['value'] ?: ${valuefromFile}` ?
comment on: http://stackoverflow.com/q/25163335

http://stackoverflow.com/a/25509257
has body: The answer for the above mentioned issue was that the constructor present in FileServlet was invoking before the filter was executed. To solve this problem I have changed the constructor to a public method which is being called in doget() method of Servlet. After this changed the filter was invoking first and then the servlet was being invoked.
type: Answer
accepted answer of: http://stackoverflow.com/q/25195907
score: 0
answers question: http://stackoverflow.com/q/25195907
type: AcceptedAnswer

http://stackoverflow.com/comment/39236215
type: Comment
comment on: http://stackoverflow.com/q/25193970
score: 0
has text: ...if you have a working solution with sockets, why insist on shared memory?
type: QuestionComment

http://stackoverflow.com/comment/41271871
has text: You need to write an explanation in the body of the answer or this could be deleted.
comment on: http://stackoverflow.com/a/26301294
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25131680
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/39118148
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25131843
has title: How to fix the error in Login Validation Android
tagged with: java
has body: I have a problem when trying to login on my android screen. I have two fields that requires user to enter username and password, it should then go and check sqlite db if correct they will be navigated to anotherscreen(user loggedin) if incorrect they will be notified via toast message. My problem is when i hit login button my app displays "The application Database has stopped unexpectedly. Please try again"! Please someone help!!My code is posted below UserLogin.java: public class UserLogin extends Activity { public static String getName; public static String getPassword; EditText name,pwd; Button login,signup; DataBaseHandler dataBaseHandler; SQLiteDatabase db; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.ulogin); name = (EditText) findViewById(R.id.name); pwd = (EditText) findViewById(R.id.pwd); login = (Button) findViewById(R.id.login); signup = (Button) findViewById(R.id.signup); login.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub dataBaseHandler = new DataBaseHandler(getBaseContext()); dataBaseHandler.open(); String getName = name.getText().toString(); String getPassword = pwd.getText().toString(); System.out.println("print something"); if(getName.equals("")||getName==null) { Toast.makeText(getBaseContext(), "User Name Empty", Toast.LENGTH_SHORT).show(); System.out.println("User name empty"); } else if(getPassword.equals("")||getPassword==null) { Toast.makeText(getBaseContext(), "Password Empty", Toast.LENGTH_SHORT).show(); System.out.println("Password empty"); } else { try { Cursor c = db.rawQuery("SELECT txtUserName,txtPassword FROM mytable WHERE txtUserName= ? AND txtPassword= ?", new String[] {getName, getPassword}); if(c.moveToFirst()) { Toast.makeText(getBaseContext(), "User Name and Password is Correct", Toast.LENGTH_SHORT).show(); Intent i = new Intent(UserLogin.this, Logg…
downvote count: 1
type: Question

http://stackoverflow.com/q/25098869
upvote count: 1
has title: Launch Google Maps with location via Cordova
tagged with: java
type: Question
tagged with: google-maps
has body: In Cordova, I'm trying to build a map to find camping areas, but I can't manage google maps in order to toggle navigation. I found a plugin which allows me to open any application I want, but I can't pass it any parameter other than its package name. Here's what I've written so far: package technology.kulak.cordova.appopen; import org.apache.cordova.CordovaPlugin; import org.apache.cordova.CallbackContext; import android.content.Intent; import android.content.Context; import android.content.pm.PackageManager; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; public class OpenApplication extends CordovaPlugin { @Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { Log.d("kulak", "EXECUTING"); Context context = this.cordova.getActivity().getApplicationContext(); Intent i = new Intent(Intent.ACTION_MAIN); PackageManager manager = context.getPackageManager(); i = manager.getLaunchIntentForPackage(action); i.addCategory(Intent.CATEGORY_LAUNCHER); context.startActivity(i); return true; } } As you can see, I have access to the action parameter, but nothing else. How should I go about passing a parameter while opening another application?
downvote count: 0
favorite count: 0
tagged with: android
tagged with: cordova
answer count: 0
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/39192210
type: QuestionComment
comment on: http://stackoverflow.com/q/25171743
score: 1
has text: They are simulating some warfare :> I can tell it works perfectly (and all threads die) if I put the code in notes (the program terminates cleanly)
type: Comment

http://stackoverflow.com/comment/39205482
type: Comment
type: QuestionComment
score: 0
has text: Probably one dot per filename, at the extension. But you know, users are tricky..
comment on: http://stackoverflow.com/q/25178841

http://stackoverflow.com/a/25098736
has body: First of all, concerning your comment I thought I was in the java forum? (also @PM77-1 :) StackOverflow is not a forum at all! Also see https://meta.stackexchange.com/a/92110 . It is a "Question And Answer" site, and this imposes some constraints on how you should ask, and what to expect as a response. (Actually, the fact that I'm writing this here is already a "violation" of these rules, and I'm risking downvotes for that). The question in its current form is hardly suitable for any site of the StackExchange network. If you write a question here, then you should ... Include a clear and focussed question (namely, one that goes beyond "What is wrong with my code?") Provide Minimal, Complete, and Verifiable example (preferably, if possible and appropriate, as a single code block, with no dependencies to other, unrelated classes, and no dependencies to external resources etc.) That said, regarding your actual "question": The formula that you are using is correct. But it is not properly implemented. The formula is (according to Wikipedia) The "r" refers to the distance between the centers of mass of the objects. In your code, you tried to implement this in the SolarSystem#genAccelX and SolarSystem#genAccelY methods: ... double x1=0; double x2=0; x1=getX(); x2=planets.get(i).getX(); double G=6.67e-11; double d=x1-x2; d*=d; planets.get(i).setxForce((G*getMass()*planets.get(i).getMass())/d); return planets.get(i).getxForce()/planets.get(i).getMass(); But the problem is that you are computing this separately for x and for y. Thus, the resulting force is losing its actual direction (and is "wrong" anyhow). To put it simply: The d that you are computing there is negative, because the planet should move to the left. But by taking d*=d, it becomes positive (and this, the planet is moving to the right) The solution: You should describe all positions, velocities and forces as vectors instead of computing everything separately for x and y. Basically, it will boil down to a class l…
has comment: http://stackoverflow.com/comment/39057054
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25097719
has comment: http://stackoverflow.com/comment/39057567
has comment: http://stackoverflow.com/comment/39057321

http://stackoverflow.com/a/25195085
has comment: http://stackoverflow.com/comment/39235396
has body: With some knowledge of modular arithmetic you can fold an array around into a circle. Observe that the starting point of each index shifts to the right by one place from the starting point of the previous row. So you do your loop like this: n := length of the array for i = 0 to n-1 (assuming the array is zero-based) j := i do loop print(array[j]) j := j + 1 j := j%n until j = i end for This is a language independent pseudo-code. Adapt it to whatever language your're coding in.
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39235639
upvote count: 2
answers question: http://stackoverflow.com/q/25194992

http://stackoverflow.com/comment/39062428
has text: @VinceEmigh Plz check my code and let me know how to do this? I want to get sting from parent to child classand open it on IE browser: public class ExtendExamle{ public static void main(String[] args) { // TODO Auto-generated method stub File file=new File("D:\\softs\\IEDriverServer_Win32_2.42.0\\IEDriverServer.exe"); System.setProperty("webdriver.ie.driver", file.getAbsolutePath()); WebDriver driver = new InternetExplorerDriver(); driver.get("gmail.com"); } public static class Test extends ExtendExamle{ public static void main(String[] args) { } } }
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25102051

http://stackoverflow.com/comment/39168706
comment on: http://stackoverflow.com/q/25135335
type: Comment
type: QuestionComment
has text: Yes, it works with appengine and as long as you have the GWT plugin installed and you started a normal Web Application Project it should work with eclipse EE too. Make sure you don't run eclipse luna though, as it's yet to be supported.
score: 0

http://stackoverflow.com/q/25093901
type: Question
tagged with: network-programming
score: -1
has body: I am beginner in Java and programming a chat-server application. The application facilitates chat among n number of clients Current Problem In my code below the Chatinterface classis the client class. After I open my 2 instances of Chatinterfaceclass, when I try to communicate by entering a message in the text area. I do not receive the message in the another client instance window and vice versa. Either my socket is not communicating or there is some other problem. Expected Output Both the clients must communicate and the messages must be displayed in the respective window. Could any one tell me what's going on wrong and where can I correct my code ? Anyways I am pasting both my client and server code for a detailed analysis. package stack; import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.net.UnknownHostException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.SpringLayout; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; class Chatinterface implements ActionListener { private JFrame frame; JTextArea textArea_1; JTextArea textArea_2; JButton btnNewButton; JButton btnNewButton_1; Socket client; BufferedReader read; PrintWriter write; String getmsg; String gettext; public Chatinterface(){ communicate(); displaygui(); } private void communicate() { // TODO Auto-generated method stub try { client = new Socket("localhost",3420); read = new BufferedReader(new InputStreamReader(client.getInputStream())); write = new PrintWriter(client.getOutputStream(),true); if(getmsg!=null) { whil…
has answer: http://stackoverflow.com/a/25094061
answer count: 2
linked to: http://stackoverflow.com/q/513832
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25100963
type: UnansweredQuestion
tagged with: sockets
has title: Communication deadlock in single server and multiple clients
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/39139283
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25141679
type: AnswerComment
has text: please see my edit. And don't ask how you get a reference to the `geolocation` that's a different question and the answer is `Singleton`

http://stackoverflow.com/comment/39219130
has text: I was showing a bunch of errors yesterday.An internal error occurred during: "Loading descriptor for xxx.". org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'taglib' not found. (platform:/resource/xxx/src/main/webapp/WEB-INF/web.xml, 226, 11). This was one of the errors yesterday
type: AnswerComment
comment on: http://stackoverflow.com/a/25186430
score: 0
type: Comment

http://stackoverflow.com/q/25123655
has answer: http://stackoverflow.com/a/25123808
answer count: 1
accepted answer: http://stackoverflow.com/a/25123808
has body: I am developing an android application for gathering data about the user location from the location sensor. Here is my code. public class GPSService extends IntentService implements LocationListener { public GPSService(String name) { super(name); // TODO Auto-generated constructor stub } public GPSService() { super("GPSService"); // TODO Auto-generated constructor stub } private VSensorConfig config = null; private static final String TAG = "AccelometerService"; public AndroidControllerListVSNew VSNewController; public AbstractWrapper w; private final Context mContext = null; // flag for GPS status boolean isGPSEnabled = false; // flag for network status boolean isNetworkEnabled = false; // flag for GPS status boolean canGetLocation = false; Location location; // location double latitude; // latitude double longitude; // longitude // The minimum distance to change Updates in meters private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters // The minimum time between updates in milliseconds private static final long MIN_TIME_BW_UPDATES = 1000 * 60 * 1; // 1 minute // Declaring a Location Manager protected LocationManager locationManager; public Location getLocation() { try { Log.i("getLocation", "getLocation"); locationManager = (LocationManager) mContext .getSystemService(LOCATION_SERVICE); // getting GPS status isGPSEnabled = locationManager .isProviderEnabled(LocationManager.GPS_PROVIDER); // getting network status isNetworkEnabled = locationManager .isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!isGPSEnabled &amp;&amp; !isNetworkEnabled) { // no network provider is enabled } else { this.canGetLocation = true; if (isNetworkEnabled) { locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); Log.d("Network", "Network"); if (locationManager != null) { location = locationManager .getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (location != null) { lat…
has comment: http://stackoverflow.com/comment/39131811
score: 0
has comment: http://stackoverflow.com/comment/39102681
tagged with: android
has title: Android GPS sensor don't enter onLocationChanged method
has comment: http://stackoverflow.com/comment/39136202
type: Question
has comment: http://stackoverflow.com/comment/39102655
type: AnsweredQuestion
tagged with: java
tagged with: location

http://stackoverflow.com/comment/39179873
score: 0
type: Comment
type: QuestionComment
has text: haha i guess there is no way to send information from mobile to pc without the use of internet or cables. My final year project idea is ruined :D
comment on: http://stackoverflow.com/q/25165128

http://stackoverflow.com/comment/39260912
comment on: http://stackoverflow.com/a/25207892
type: Comment
type: AnswerComment
has text: There is probably no real reason why I didn't use EntityUtilis here, just what I had used at the time.
score: 0

http://stackoverflow.com/q/25081541
accepted answer: http://stackoverflow.com/a/25081756
possible better answer: http://stackoverflow.com/a/25081629
has comment: http://stackoverflow.com/comment/39023712
has answer: http://stackoverflow.com/a/25081629
type: Question
has answer: http://stackoverflow.com/a/25081635
tagged with: for-loop
has comment: http://stackoverflow.com/comment/39023787
has comment: http://stackoverflow.com/comment/39023651
has comment: http://stackoverflow.com/comment/39023784
score: 0
has comment: http://stackoverflow.com/comment/39023731
has comment: http://stackoverflow.com/comment/39023780
has answer: http://stackoverflow.com/a/25082113
has comment: http://stackoverflow.com/comment/39023743
has comment: http://stackoverflow.com/comment/39023765
has answer: http://stackoverflow.com/a/25081756
answer count: 4
has comment: http://stackoverflow.com/comment/39023886
tagged with: return-type
tagged with: return-value
has title: How to use a value which you are getting from a for loop as return value for the same method
has comment: http://stackoverflow.com/comment/39023739
has comment: http://stackoverflow.com/comment/39023725
type: AnsweredQuestion
has body: I am trying to create a method which return a int value(in my case locationY is the value which i wanted to return) which i am getting from a variable which is declared and initialized inside a for loop in thge same method. I tried two ways to do so. In my 1st try code i got error which says "locationY cannot be resolved to a variable". Then in my 2nd try i tried to return the locationY from inside the for loop. But again got an error which says that "This method must return a result of type int". Can anyone please tell me how can i use the varable present inside a for loop to the same method. 1st Try - public int getvalueY() throws InterruptedException{ for(int i=0; i&lt;20;i++){ PointerInfo pointer = MouseInfo.getPointerInfo(); Point point = pointer.getLocation(); int locationY = (int)point.getY(); Thread.sleep(2000); } return locationY; } 2nd Try - public int getvalueY() throws InterruptedException{ for(int i=0; i&lt;20;i++){ PointerInfo pointer = MouseInfo.getPointerInfo(); Point point = pointer.getLocation(); int locationY = (int)point.getY(); Thread.sleep(2000); return locationY; } }
tagged with: java

http://stackoverflow.com/comment/39239666
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25197345
has text: @Neji, I have only android-support-v4.jar library.

http://stackoverflow.com/a/25104368
type: Answer
answers question: http://stackoverflow.com/q/25104346
score: 1
upvote count: 1
downvote count: 0
has body: How about while(myCollection.remove(null)); The remove() method returns true if something was removed, so you can remove all the nulls (or any elements) with that oneliner. Avoids ConcurrentModificationException and works for all collections that implement remove(Object o) (which is all of them, or at least the common ones).

http://stackoverflow.com/comment/39160731
type: AnswerComment
has text: I think I find the problem, in my javascript code I need to load some picture which is located in src/images/pic.png. so how should I address it in my html.html file so that it could find it?!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25140248

http://stackoverflow.com/comment/39134895
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25140307
has text: Did you try to use raw types, like this : `public class EntityMongoControllerAspect { @DeclareParents(value="@EntityController *",defaultImpl=EntityMongoController.class) private IEntityController iEntityController;}` ?

http://stackoverflow.com/comment/39212984
comment on: http://stackoverflow.com/q/25183405
has text: Are you sure that this site actually exists? I can't see nor ping it from my pc (tried with terminal ping, google chrome, firefox and opera, they all said the url cannot be resolved).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25111825
upvote count: 1
has comment: http://stackoverflow.com/comment/39080803
has comment: http://stackoverflow.com/comment/39080917
answers question: http://stackoverflow.com/q/25072024
has body: @ImportResource("classpath:persistence-context.xml") Will work fine just dont forget to put the persistence-context.xml under the webapp folder as it is considered as the classpath in case of Web Project. Well in for placing the file under src/main/resources then try reading it this way you will never face path problem in this case. String pathOfTheResurceFile = Thread.currentThread().getContextClassLoader() .getResource("yourFileName").getPath();
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39080729

http://stackoverflow.com/comment/39143581
type: Comment
score: 0
type: QuestionComment
has text: The bottom line: **Never call `getGraphics()` on a `Component`**
comment on: http://stackoverflow.com/q/25145454

maven-jaxb2-plugin
type: Tag
tags question: http://stackoverflow.com/q/25163837
tag name: maven-jaxb2-plugin

http://stackoverflow.com/comment/39222522
comment on: http://stackoverflow.com/q/25187749
has text: I more or less understood that. It seems that adding "charAt" add the ascii hex value of the character to suma.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25073316
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39011296
tagged with: printing
type: Question
has title: Print browser page SWT
has comment: http://stackoverflow.com/comment/39008907
has comment: http://stackoverflow.com/comment/39009118
tagged with: swt
has comment: http://stackoverflow.com/comment/39009082
has comment: http://stackoverflow.com/comment/39011324
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/15156231
tagged with: eclipse
has body: I am developing a desktop application using SWT.I have embedded a browser in it.I want to add print and print preview functions to this app.I have searched for tutorials but dint find any except this http://www.eclipse.org/forums/index.php/t/122978/ .But to understand this solution i need to know how to implement print fuction.Does anyone have any ideas?Iknow we can use browser.execute() to print but i dont want to use any other scripts.
tagged with: browser
has comment: http://stackoverflow.com/comment/39010728
answer count: 0

http://stackoverflow.com/comment/39270089
type: AnswerComment
comment on: http://stackoverflow.com/a/25211099
score: 0
type: Comment
has text: what do you mean by edge component package. as I have ND version and thought I should use IHS as load balancer between them . is there a way to load balance using the ND package itself ? @gas

http://stackoverflow.com/q/25070892
tagged with: java
has title: How to find the marker postion by its title?
has comment: http://stackoverflow.com/comment/39004566
type: Question
has answer: http://stackoverflow.com/a/25072500
has body: I have a list where a user types and picks a place's name. The user clicks on the name and an infowindow pops up showing the location of the name. I already have the markers made. I am able to get the title of the marker the user has clicked. How do I find the marker's position by the marker's title? Here's the code for my // My list is pulled from an xml file String[] countries = getResources(). getStringArray(R.array.list_of_countries); ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, countries); actv = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1); actv.setAdapter(adapter); actv.setOnItemClickListener(new AdapterView.OnItemClickListener() {@ Override public void onItemClick(AdapterView &lt;? &gt; parent, View view, int position, long id) { CharSequence country = ((TextView) view).getText(); Toast.makeText(getBaseContext(), country, Toast.LENGTH_SHORT) .show(); // Here I get the marker's title. // for example if the title is "EF", how do I find that the LatLng = 23,82 } }); Here's my markers: googleMap.addMarker(new MarkerOptions().position(new LatLng(23,81)).title("AB")); googleMap.addMarker(new MarkerOptions().position(new LatLng(24,81)).title("CD")); googleMap.addMarker(new MarkerOptions().position(new LatLng(23,82)).title("EF"));
has comment: http://stackoverflow.com/comment/39004214
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25071246
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/25139028
has body: I keep having trouble switching from one while loop to another. here is my code: package test; import java.util.Scanner; public class test { private static boolean test1 = false; private static boolean test2 = false; public static Scanner UI = new Scanner(System.in); private static String testString; public static void main(String[] args) { test1 = true; while(test1 = true){ System.out.println("test1"); testString = UI.nextLine(); if(testString.equals("Hello World")){ test1 = false; test2 = true; } } while(test2 = true){ System.out.println("test2"); testString = UI.nextLine(); if(testString.equals("GOTO 1")){ test2 = false; test1 = true; } } } } I think it has something to do with the test1 = true statement but I don't know if that's true. I want to be able to switch from one while loop to another and I don't want to do that with if statements. I'm pretty new to java.
has answer: http://stackoverflow.com/a/25139140
score: -1
type: Question
has title: Switching through while loops in java
upvote count: 0
tagged with: while-loop
accepted answer: http://stackoverflow.com/a/25139140
has answer: http://stackoverflow.com/a/25139252
has answer: http://stackoverflow.com/a/25139076
possible better answer: http://stackoverflow.com/a/25139066
favorite count: 0
has answer: http://stackoverflow.com/a/25139066
answer count: 5
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25139057

http://stackoverflow.com/q/25205387
has answer: http://stackoverflow.com/a/25206434
has answer: http://stackoverflow.com/a/25205576
has body: I seem to be hitting a constant unexpected end of my file. My file contains first a couple of strings, then byte data. The file contains a few separated strings, which my code reads correctly. However when I begin to read the bytes, it returns nothing. I am pretty sure it has to do with me using the Readers. Does the BufferedReader read the entire stream? If so, how can I solve this? I have checked the file, and it does contain plenty of data after the strings. InputStreamReader is = new InputStreamReader(in); BufferedReader br = new BufferedReader(is); String line; { line = br.readLine(); String split[] = line.split(" "); if (!split[0].equals("#binvox")) { ErrorHandler.log("Not a binvox file"); return false; } ErrorHandler.log("Binvox version: " + split[1]); } ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int nRead, cnt = 0; byte[] data = new byte[16384]; while ((nRead = in.read(data, 0, data.length)) != -1) { buffer.write(data, 0, nRead); cnt += nRead; } buffer.flush(); // cnt is always 0 The binvox format is as followed: #binvox 1 dim 64 40 32 translate -3 0 -2 scale 6.434 data [byte data] I'm basically trying to convert the following C code to Java: http://www.cs.princeton.edu/~min/binvox/read_binvox.html
answer count: 5
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39255476
score: 1
tagged with: java
has title: InputStream returns unexpected -1/empty
accepted answer: http://stackoverflow.com/a/25209140
has comment: http://stackoverflow.com/comment/39257012
type: Question
has answer: http://stackoverflow.com/a/25205753
has answer: http://stackoverflow.com/a/25205520
downvote count: 0
possible better answer: http://stackoverflow.com/a/25205576
has answer: http://stackoverflow.com/a/25209140
favorite count: 0

http://stackoverflow.com/a/25204223
downvote count: 0
type: Answer
score: 1
has body: The distance is in a JSONObject under result only. So you have to getJSONObject("result").getDouble("distance").
upvote count: 1
answers question: http://stackoverflow.com/q/25204104
has comment: http://stackoverflow.com/comment/39251985
has comment: http://stackoverflow.com/comment/39251911

http://stackoverflow.com/comment/39161354
comment on: http://stackoverflow.com/q/25139713
type: Comment
type: QuestionComment
has text: I have added the modified code to the post.
score: 0

http://stackoverflow.com/q/25117214
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39090562
favorite count: 0
has comment: http://stackoverflow.com/comment/39091021
score: 1
has answer: http://stackoverflow.com/a/25117787
has comment: http://stackoverflow.com/comment/39092630
has comment: http://stackoverflow.com/comment/39090546
tagged with: jradiobutton
upvote count: 1
tagged with: swing
tagged with: jbutton
has title: JRadiobuttons combining JButtons implemetation. Error method not abstract and does not override abstract method
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39091608
tagged with: java
accepted answer: http://stackoverflow.com/a/25117787
type: Question
has body: Am trying to implement a set of 3 JRadiobuttons that are detected using 3 ItemListeners and a set of 2 JButtons that are selected by 2 ActionListeners. When the "OK" JButton is pressed the current JRadioButton selection should be detected. I have tried to implement this by combining ActionEvent and ItemEvent into one method where if statements can be used to verify which JRadioButton is selected when "OK" is pressed. The error message produced is method is not abstract and does not override abstract method actionPerformed(ActionEvent) in actionListener. When the main method is made abstract it will not instantiate. I have tried placing @Override before the public void actionPerformed method and using alt+ins to insert an override but this has not worked. The code is as follows: import javax.swing.*; import java.awt.*; import java.awt.event.*; import static javax.swing.JFrame.EXIT_ON_CLOSE; class MainMenu extends JFrame implements ActionListener, ItemListener { JPanel pnl = new JPanel(); JPanel grid = new JPanel(new GridLayout(3, 1)); JRadioButton input1 = new JRadioButton("Enter New Information", true); JRadioButton input2 = new JRadioButton("Load from a CSV file"); JRadioButton input3 = new JRadioButton("Save to a CSV file"); ButtonGroup inputs = new ButtonGroup(); JButton b1 = new JButton("OK"); JButton b2 = new JButton("Cancel"); JTextArea txtArea = new JTextArea(5, 25); public void actionPerformed(ActionEvent event2, ItemEvent event1) { txtArea.setText(event2.getActionCommand() + " Clicked"); if (event2.getSource() == b1 &amp;&amp; event1.getItemSelectable() == input1) { System.exit(0); } if (event2.getSource() == b1 &amp;&amp; event1.getItemSelectable() == input2) { final JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(null); System.exit(0); } if (event2.getSource() == b1 &amp;&amp; event1.getItemSelectable() == input3) { System.exit(0); } if (event2.getSource() == b2) { System.exit(0); } } public MainMenu() { super("Main Menu"); setSize…

http://stackoverflow.com/comment/46223749
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25127272
has text: Did you find an answer to this? I get the same error.

communication
tag name: communication
tags question: http://stackoverflow.com/q/25185255
type: Tag

http://stackoverflow.com/a/25149365
type: Answer
has comment: http://stackoverflow.com/comment/39150538
has comment: http://stackoverflow.com/comment/39150568
has body: You're splitting using the "" which means split every character. Then you take the first character. I don't know why you're doing it that way. In summary, what happens in every loop is it takes the first character ([0]) of element i of the array, then sets every single value that wil lbe printed in the string to that character. Instead, try this String[] newText = text.split("[./ ]"); for(int i = 0; i &lt; newText.length - 4; i+=4){ System.out.println("Name: " + newText[i] + ", last name: " + newText[i+1] + ", date of birth: " + newText[i+2] + ", place of birth: " + newText[i+3]); } However, this is a terrible solution, it relies on fixed sized entries and should not be used in practice. What if someone enters the string in a different order, or with one too many inputs or one too few? Try using more flexible designs, such as the usage of a csv format parser, so you always split using commas, and the rows can be something like entry-type, entry entry-type, entry2 entry-type, entry3 Or something like that. Try it out. Always try to aim for flexible solutions that don't rely on exact input to work, otherwise you will have exceptions and runtime issues like there's no tomorrow. PS the point of the split() method is to split the string between occurences of the specified input, i.e. [./], so don't use it if you want to just give a "", that's no different than making a charArray (except instead of char[] it is String[])
answers question: http://stackoverflow.com/q/25149205
score: 0

http://stackoverflow.com/a/25135552
has comment: http://stackoverflow.com/comment/39125739
has comment: http://stackoverflow.com/comment/39125170
has comment: http://stackoverflow.com/comment/39125553
has body: You need to quote your string literals in SQL: String sql = "SELECT * FROM " + TABLE_DAY_OF_WEEK + " WHERE " + COLUMN_WEEKDAY + " = " + dName; Cursor cursor = db.rawQuery(sql, null); Change to: String sql = "SELECT * FROM " + TABLE_DAY_OF_WEEK + " WHERE " + COLUMN_WEEKDAY + " = '" + dName + "'"; Cursor cursor = db.rawQuery(sql, null); Note the single quotes around dName. Or even better, use parameters: String sql = "SELECT * FROM " + TABLE_DAY_OF_WEEK + " WHERE " + COLUMN_WEEKDAY + " = ?"; Cursor cursor = db.rawQuery(sql, new String[] { dName }); Without the quotes or ? parameter placeholder it is interpreted as an identifier (column name) and not a literal value.
has comment: http://stackoverflow.com/comment/39125471
type: Answer
has comment: http://stackoverflow.com/comment/39125209
score: 0
answers question: http://stackoverflow.com/q/25134452

http://stackoverflow.com/comment/39202776
type: AnswerComment
comment on: http://stackoverflow.com/a/25177470
type: Comment
has text: Thanks Luca. Is it possible to disable it ?
score: 0

http://stackoverflow.com/a/25189450
answers question: http://stackoverflow.com/q/25188538
has body: Have you heard NEVER GIVE A MONKEY TO DO MAN'S WORK Well AFAICS you will have the fields username password and user so why dont use a database instead of a file. Take advantage of H2 database allows you to store data as file. Just include the driver jar and write this simple codes Connection con = null; try{ Class.forName("org.h2.Driver"); con = DriverManager.getConnection("jdbc:h2:./mydb;MODE=MySQL;", "", ""); PreparedStatement stmt= con.prepareStatement ("INSERT INTO yourTable(user,username,password) VALUES(?,?,?)"); stmt.setString(1, "someUser"); stmt.setString(2, "someUsername"); stmt.setString(3, "somePassword"); stmt.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally{ //close statements }
score: 0
type: Answer

http://stackoverflow.com/a/25198406
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25122854
type: Answer
has body: No need to drop down to the drivers. This problem can be solved by extending the MongoTemplate class and overriding the mapReduce method. Obviously care should be taken, when the libraries are upgraded, to port any changes to this new class. The new method looks like this: @Override public &lt;T&gt; MapReduceResults&lt;T&gt; mapReduce(Query query, String inputCollectionName, String mapFunction, String reduceFunction, MapReduceOptions mapReduceOptions, Class&lt;T&gt; entityClass) { if (mapReduceOptions.getOutputType() == OutputType.INLINE) { // if output type is inline then no need to suppress results return super.mapReduce(query, inputCollectionName, mapFunction, reduceFunction, mapReduceOptions, entityClass); } String mapFunc = replaceWithResourceIfNecessary(mapFunction); String reduceFunc = replaceWithResourceIfNecessary(reduceFunction); DBCollection inputCollection = getCollection(inputCollectionName); MapReduceCommand command = new MapReduceCommand(inputCollection, mapFunc, reduceFunc, mapReduceOptions.getOutputCollection(), mapReduceOptions.getOutputType(), null); DBObject commandObject = copyQuery(query, copyMapReduceOptions(mapReduceOptions, command)); if (logger.isDebugEnabled()) { logger.debug("Executing MapReduce on collection [{}], mapFunction [{}], reduceFunction [{}]", command.getInput(), mapFunc, reduceFunc); } CommandResult commandResult = executeCommand(commandObject); handleCommandError(commandResult, commandObject); if (logger.isDebugEnabled()) { logger.debug("MapReduce command result = [{}]", serializeToJsonSafely(commandObject)); } return new MapReduceResults&lt;&gt;(new ArrayList&lt;T&gt;(), commandResult); } You will also need to port a few private methods across from the original MongoTemplate class so that this new class has access to them.
answers question: http://stackoverflow.com/q/25122854
score: 2

http://stackoverflow.com/q/25087377
has title: ERROR [main] master.HMasterCommandLine: Master exiting java.lang.RuntimeException: Failed construction of Master
has body: I am getting the below error while trying to run HBASE with HADOOP HBASE 0.98.x HADOOP 2.4.0 ERROR [main] master.HMasterCommandLine: Master exiting java.lang.RuntimeException: Failed construction of Master: class org.apache.had$ at org.apache.hadoop.hbase.util.JVMClusterUtil.createMasterThread(JVMCl$ at org.apache.hadoop.hbase.LocalHBaseCluster.addMaster(LocalHBaseCluste$ at org.apache.hadoop.hbase.LocalHBaseCluster.&lt;init&gt;(LocalHBaseCluster.j$ at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMaste$ at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommand$ at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65) at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandL$ at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:2793) Caused by: org.apache.hadoop.ipc.RemoteException: Server IPC version 9 cannot c$ at org.apache.hadoop.ipc.Client.call(Client.java:1113) at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:229) at org.apache.hadoop.hdfs.DFSClient.&lt;init&gt;(DFSClient.java:245) at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedF$ at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:144$ at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:67) at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1464) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:263) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:124) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:247) at org.apache.hadoop.fs.Path.getFileSystem(Path.java:187) at org.apache.hadoop.hbase.util.FSUtils.getRootDir(FSUtils.java:895) at org.apache.hadoop.hbase.master.HMaster.&lt;init&gt;(HMaster.java:458) at org.apache.hadoop.hbase.master.HMasterCommandLine$LocalHMaster.&lt;init$ at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruc$ at sun.reflect.DelegatingConstructorAccessorImpl.newInst…
tagged with: java
upvote count: 2
tagged with: hadoop
has answer: http://stackoverflow.com/a/27314951
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/30725352
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: hbase
type: Question

http://stackoverflow.com/q/25127021
has answer: http://stackoverflow.com/a/54141330
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39112336
score: 7
has comment: http://stackoverflow.com/comment/39109207
has body: I have the task of porting some python code to Scala for research purposes. Now I use the Apache Math3 commons library and am having difficulty with the MersenneTwister. In Python: SEED = 1234567890 PRIMARY_RNG = random.Random() PRIMARY_RNG.seed(SEED) n = PRIMARY_RNG.randrange((2**31) - 1) #1977150888 In Scala: val Seed = 1234567890 val PrimaryRNG = new MersenneTwister(Seed) val n = PrimaryRNG.nextInt(Int.MaxValue) //1328851649 What am I missing here? Both are MersenneTwister's, and Int.MaxValue = 2147483647 = (2**31) - 1
possible better answer: http://stackoverflow.com/a/25127593
tagged with: random
answer count: 3
has answer: http://stackoverflow.com/a/25127593
accepted answer: http://stackoverflow.com/a/25139853
downvote count: 0
has comment: http://stackoverflow.com/comment/39111974
favorite count: 0
tagged with: python
has title: Java Apache Math3 MersenneTwister VS Python random
tagged with: mersenne-twister
has comment: http://stackoverflow.com/comment/39109835
has comment: http://stackoverflow.com/comment/39110420
tagged with: scala
tagged with: java
has answer: http://stackoverflow.com/a/25139853
upvote count: 7
has comment: http://stackoverflow.com/comment/39109978

http://stackoverflow.com/comment/39293420
type: QuestionComment
score: 0
has text: Can you add the content of web.xml?
comment on: http://stackoverflow.com/q/25226308
type: Comment

http://stackoverflow.com/comment/39198692
score: 0
has text: Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, **a specific problem or error** and the **shortest code necessary to reproduce it** in the question itself. Questions without a clear problem statement are not useful to other readers. See [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25175288

http://stackoverflow.com/comment/39207994
has text: I am using socket.io for java and socket event returning jsonobject for json data.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25180746

http://stackoverflow.com/comment/39158331
score: 0
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal, Complete, Verifiable Example). 2) One way to get images for an example is to hot-link to images listed in [this Q&A](http://stackoverflow.com/q/19209650/418556).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25153391

http://stackoverflow.com/a/25200911
type: Answer
answers question: http://stackoverflow.com/q/25200599
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39246320
has body: Please check your application lib and tomcat lib. It seems that you have the same jar with different version at two places.
upvote count: 1

http://stackoverflow.com/comment/39029071
type: QuestionComment
has text: @DavidConrad I'm creating an menu interface that is able to display a list of customers,e.g. 1)John 2)Jack .So in order to prevent user from entering other non-numeric value such as alphabet.I have to check whether it is an digit before proceeding to the subsequents steps to prevent errors.
comment on: http://stackoverflow.com/q/25083208
type: Comment
score: 0

http://stackoverflow.com/comment/39004654
comment on: http://stackoverflow.com/a/25071002
has text: Thanks for the quick feedback. How do you flush the PrintWriter? And can you explain how I close the streams and where I would do this at. Sorry, like I said, new to java :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39213369
score: 0
type: AnswerComment
type: Comment
has text: @Neeldz What server are you using? Jetty, Tomcat? Do you have a context path set?
comment on: http://stackoverflow.com/a/25183460

http://stackoverflow.com/a/25228069
score: 0
type: AcceptedAnswer
has body: The problem is that the pseudocode array is 1-based, while Java arrays are 0-based. Just change for (j=2; j&lt;nElems; j++) { i=1; // more code to for (j=1; j&lt;nElems; j++) { i=0; // more code
type: Answer
accepted answer of: http://stackoverflow.com/q/25228010
answers question: http://stackoverflow.com/q/25228010

http://stackoverflow.com/a/25201775
score: 1
accepted answer of: http://stackoverflow.com/q/25190200
answers question: http://stackoverflow.com/q/25190200
upvote count: 1
type: AcceptedAnswer
has body: Alright. Quoting the user 'Mics': Short answer: There's no AttributeKey(String) in netty 4.1, use AttributeKey.valueOf(String). Additional information: github.com/netty/netty/issues/1824 Thanks for the answer.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/39009328
type: QuestionComment
type: Comment
has text: In java script bind allows set the value of "this" to an specific object, reuse methods and curry a function. But In Java those are different concepts.
comment on: http://stackoverflow.com/q/25073707
score: 0

http://stackoverflow.com/a/25205104
downvote count: 0
has comment: http://stackoverflow.com/comment/39254969
answers question: http://stackoverflow.com/q/25204619
upvote count: 2
has comment: http://stackoverflow.com/comment/39254952
has comment: http://stackoverflow.com/comment/39254454
has comment: http://stackoverflow.com/comment/39254790
has body: you dont need to calculate factorial to get number of trailing zeroes. Solution : import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int lines = Integer.parseInt(br.readLine()); int sum, N, p; for (int i = 0; i &lt; lines; i++) { N = Integer.parseInt(br.readLine()); sum = 0; p = 5; while (N / p != 0) { sum = sum + N / p; p = p * 5; } System.out.println(sum); } } } Logic is : The highest power of a prime number p in N! is given by floor(N/p) + floor(N/p*p) + floor(N/p*p*p) ... so on till [floor(N/p^n) = 0] so since number of ending zeroes is required , ans = min(max power of 2 in N!, max power of 5 in N!) because zeroes appears on multiplication by ten and ten can be decomposed to 10 = (2 * 5). It is fine to assume that max power of 5 in N! is always less than max power of 2 in N!. as multiples of 2 occur more frequently than multiples of 5. So problem reduces to finding max power of 5 in N! and hence the solution. Example : N = 5 max power of 5 in 5! = floor(5/5) + floor(5/25) =&gt; 1 + 0 =&gt; ans = 1 N = 100 max power of 5 in 100! = floor(100/5) + floor(100/25) + floor(100/125) =&gt; 20 + 4 + 0 =&gt; ans = 24
type: Answer
score: 2

http://stackoverflow.com/q/25156408
tagged with: jquery
has answer: http://stackoverflow.com/a/25157982
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/25157180
has body: I am not very experienced in this so need help.I need following things to be done : 1. Want to traverse a folder structure in a content management repository. 2. Want to create JSON Object of the folder in child-node form. 3. Json data will be used to create tree using jQuery Json format: var data = [ { text: "Parent 1", nodes: [ { text: "Child 1", nodes: [ { text: "Grandchild 1" }, { text: "Grandchild 2" } ] }, { text: "Child 2" } ] }, { text: "Parent 2" }, { text: "Parent 3" }, { text: "Parent 4" }, { text: "Parent 5" } ]; My Java method is like this: public static void displayIt(File node){ System.out.println(node.getAbsoluteFile()); if(node.isDirectory()){ String[] subNote = node.list(); for(String filename : subNote){ displayIt(new File(node, filename)); } } } I am Struggling to frame strategy to create JSON object and Array to depict this. Please can you help me.
has comment: http://stackoverflow.com/comment/39167941
has title: Creating JSON in required format - Java
accepted answer: http://stackoverflow.com/a/25157982
possible better answer: http://stackoverflow.com/a/25157180
score: 0
answer count: 2

http://stackoverflow.com/q/25077236
tagged with: parsing
has comment: http://stackoverflow.com/comment/39019878
tagged with: antlr4
type: UnansweredQuestion
has title: getType() method not found in antlr4
tagged with: java
type: Question
tagged with: antlr
score: 0
has body: The rule below is an extract from the larger rule. Notice the optional part at the tail end of the grammar. After the input is parsed, we walk the generated parsed tree to evaluate the expression. The listener code for the first rule is also given below. arithmeticTerm : arithmeticFactor (op=(MULT|DIVIDE) arithmeticFactor)* ; arithmeticFactor: INTEGER /* For now , let it be simple terminal */ Listener import java.util.ArrayList; import org.antlr.v4.runtime.misc.NotNull; import org.antlr.v4.runtime.tree.ParseTree; import org.antlr.v4.runtime.tree.ParseTreeProperty; public class PredicateEvaluator extends PredicateGrammarBaseListener { private ParseTreeProperty&lt;Float&gt; floatValues = new ParseTreeProperty&lt;Float&gt;(); private ArrayList&lt;Float&gt; arithmeticTermFactorList = null; private void setFloatValue(ParseTree node, float value){ floatValues.put(node, value); } private float getFloatValue(ParseTree node){ return floatValues.get(node); } public void enterArithmeticTerm( @NotNull PredicateGrammarParser.ArithmeticTermContext ctx) { arithmeticTermFactorList = new ArrayList&lt;Float&gt;(); } Currently, I am evaluating the arithmetic term in this way. I need to detect the type op and either divie or multipy the factors. But, the my compiler cannot find the getType() method. I looked at the antlr4 generated codes but it was not there. I am following the book by the creator of antlr4 and he uses the getType() method in the similar scenario, but the same thing is not working here. Your help will be really appreicated. public void exitArithmeticTerm( @NotNull PredicateGrammarParser.ArithmeticTermContext ctx) { float evaluatedValue = 0.0f; if (ctx.op == null){ evaluatedValue = getFloatValue(ctx.arithmeticFactor().get(0)); }else{ for(float value : arithmeticTermFactorList){ if(ctx.op.getType() == PredicateGrammarLexer.MULT) { evaluatedValue *= value; }else{ evaluatedValue /= value; } } } arithmeticExprTermList.add(evaluatedValue); } public void exitArithmeticFactor(…
answer count: 1
has answer: http://stackoverflow.com/a/25080061

http://stackoverflow.com/comment/39073030
type: Comment
has text: Yeah Sting.getBytes is not a good option here.I replaced it with Longs.toByteArray(value). But still not getting it right.Anyway thank you very much for the support.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25099204

http://stackoverflow.com/comment/39075952
type: QuestionComment
comment on: http://stackoverflow.com/q/25109303
score: 0
has text: It does not matter to the firewall what technology or language is used to implement a web server. For the firewall, it matters what port, protocol and where the request is coming from. Your question still doesn't state that all three are on the same port, but if that's the case and you're using exactly the same URLs to access all three and you're accessing them all from exactly the same computer, then the only variable left is that your server isn't actually running correctly.
type: Comment

http://stackoverflow.com/comment/39200928
type: QuestionComment
has text: You store it somewhere else, may be in an array or a `List`...?
comment on: http://stackoverflow.com/q/25176814
score: 0
type: Comment

http://stackoverflow.com/comment/39125553
comment on: http://stackoverflow.com/a/25135552
score: 0
type: AnswerComment
has text: Well, your `table_exercise` doesn't have such column. The code you posted was querying from `table_day_of_week` and it seems to have such column.
type: Comment

jsch
tags question: http://stackoverflow.com/q/25124385
tag name: jsch
tags question: http://stackoverflow.com/q/25171856
tags question: http://stackoverflow.com/q/25193891
tags question: http://stackoverflow.com/q/25172980
tags question: http://stackoverflow.com/q/25169957
tags question: http://stackoverflow.com/q/25119076
tags question: http://stackoverflow.com/q/25077580
tags question: http://stackoverflow.com/q/25189651
tags question: http://stackoverflow.com/q/25179501
type: Tag

http://stackoverflow.com/comment/39066773
score: 0
comment on: http://stackoverflow.com/q/25104556
type: QuestionComment
type: Comment
has text: I just need to send the request to server which contains XML as a string. This what I need to to Send as string

http://stackoverflow.com/a/25110697
upvote count: 2
has body: i have added a button listener to go to other page No, apparently you haven't. You cannot go to the other activity through this code setContentView(R.layout.activity123); You need to use Intent @Override public void onClick(View arg0) { Intent intent = new Intent(MainActivityTEST2.this,activity_main_activty_test2.class); startActivity(intent); finish(); //optional } ALSO remove import com.example.test2.R; from your second activity.
downvote count: 0
answers question: http://stackoverflow.com/q/25110662
type: Answer
score: 2

http://stackoverflow.com/comment/39061797
has text: I was able to set an initial value for spaceCounter which worked how it should, but now I'm just wondering how to decrement the spaceCounter by 1 for each iteration. My question is: where do I put the "spaceCounter--;"? I would think it'd go in the first while statement like my original code, although that doesn't seem to decrement anything. Or is it that the problem is possibly in the while (statement) itself?
comment on: http://stackoverflow.com/a/25101694
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39271175
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25214070
has text: I think it would be very easy and hopefully there would be a lot of people helping if you could make it easier to understand. Try renaming the class name to easier one like A, B etc. And similar getters and setters
score: 0

http://stackoverflow.com/comment/39066724
has text: wow,that is quite a good idea.thx for your reply.i can give a try.before i met this Robot class,but i didn't notice this method.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25103507

http://stackoverflow.com/comment/39261653
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25192135
score: 0
has text: Thank for your responses. I want to know how to resize a JPanel and all its children depending on mouse drag.

logging
tags question: http://stackoverflow.com/q/25077237
tags question: http://stackoverflow.com/q/25114526
tags question: http://stackoverflow.com/q/25078844
tags question: http://stackoverflow.com/q/25203388
tags question: http://stackoverflow.com/q/25204226
tag name: logging
tags question: http://stackoverflow.com/q/25129731
tags question: http://stackoverflow.com/q/25085648
tags question: http://stackoverflow.com/q/25141713
tags question: http://stackoverflow.com/q/25100047
tags question: http://stackoverflow.com/q/25118993
tags question: http://stackoverflow.com/q/25203821
tags question: http://stackoverflow.com/q/25096514
tags question: http://stackoverflow.com/q/25176547
tags question: http://stackoverflow.com/q/25183041
tags question: http://stackoverflow.com/q/25074417
tags question: http://stackoverflow.com/q/25189097
tags question: http://stackoverflow.com/q/25143666
tags question: http://stackoverflow.com/q/25175794
tags question: http://stackoverflow.com/q/25077261
tags question: http://stackoverflow.com/q/25179890
tags question: http://stackoverflow.com/q/25105927
tags question: http://stackoverflow.com/q/25120737
tags question: http://stackoverflow.com/q/25156812
tags question: http://stackoverflow.com/q/25190825
type: Tag

http://stackoverflow.com/comment/80083460
score: 9
type: AnswerComment
comment on: http://stackoverflow.com/a/40049018
type: Comment
has text: This is the most accurate answer

http://stackoverflow.com/a/25197807
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25197449
answers question: http://stackoverflow.com/q/25197449
has body: We use this file upload example with commons-fileupload:1.2.2 and it works as expected (haven't upgraded to 1.3 yet). Example shows how to get to input stream of each uploaded file.
downvote count: 0

http://stackoverflow.com/comment/39301150
score: 0
comment on: http://stackoverflow.com/q/25230074
type: Comment
type: QuestionComment
has text: 'Comments' - it is example. Users have to be able create big articles where will be big parts of code, code highlight must be there.

splash-screen
tags question: http://stackoverflow.com/q/25172201
type: Tag
tag name: splash-screen

http://stackoverflow.com/comment/39271285
score: 0
type: AnswerComment
has text: Please update your question. Try to put exact code you have got till now. And I can help you further.
type: Comment
comment on: http://stackoverflow.com/a/25213916

http://stackoverflow.com/a/25190616
has body: You need to set a property to the SOAP message. soapMessage.setProperty(SOAPMessage.WRITE_XML_DECLARATION, "true") The above code should do that. Here is the link to setProperty(String property, Object value) documentation.
accepted answer of: http://stackoverflow.com/q/25190357
has comment: http://stackoverflow.com/comment/39227364
answers question: http://stackoverflow.com/q/25190357
type: Answer
has comment: http://stackoverflow.com/comment/39228226
upvote count: 5
has comment: http://stackoverflow.com/comment/39258872
has comment: http://stackoverflow.com/comment/39229283
score: 5
has comment: http://stackoverflow.com/comment/61569939
has comment: http://stackoverflow.com/comment/39228012
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25108327
score: 4
accepted answer of: http://stackoverflow.com/q/25108266
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25108266
has comment: http://stackoverflow.com/comment/39074861
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/39073961
has body: In the second case you added this line: System.out.println("SOMETHING"); PrintStream#println is a synchronized method, so if that helped your program to start working, it is a quite clear indication that the method obj.isVisible is not synchronized, and since you don't use any explicit synchronization, you are effectively causing a data race in your program. The reading thread never observes the change in the value of the isVisible property. But, as many others have already noticed, this just answers the question as you have asked it; the code you have posted has many more issues with an inappropriate programming model (busy waiting) used to solve an essentially event-based problem.

http://stackoverflow.com/a/25118797
has comment: http://stackoverflow.com/comment/39118266
answers question: http://stackoverflow.com/q/25117417
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39119469
has body: Just to solve all your potential bugs in one single shot: is there anything preventing you from using Retrofit and GSON or Jackson? Each time I see such JSON/InputStream/URLConnection/... questions, I keep wondering why people keep on spending time to reinvent basic stuff instead of actually writing apps.
downvote count: 0
score: 1

http://stackoverflow.com/comment/39092732
type: AnswerComment
score: 0
type: Comment
has text: @Aaron Digulla : Exactly
comment on: http://stackoverflow.com/a/25118344

http://stackoverflow.com/q/25131675
score: 1
accepted answer: http://stackoverflow.com/a/25145985
tagged with: couchbase
upvote count: 1
answer count: 1
tagged with: memcached
tagged with: java
has title: CouchBase Client vs Spymemcache, Client Usage
tagged with: caching
linked to: http://stackoverflow.com/q/42918883
has answer: http://stackoverflow.com/a/25145985
type: AnsweredQuestion
downvote count: 0
has body: I am to use CouchBase as my caching layer. My caches are serialized objects and not(always) Document type or JSON values. The couchbase client(Couchbase-Java-Client-1.4.3) also uses Spymemcache jars which is the client of memcached server. My questions are, Should I use only Couchbas Client to cache my objects into couchbase server? What if I use default Spymemcache client to cache ? if I use, what could be pros and conse over the using couchbase client? Can the Spymemcache client handle server nodes and node failures itself?
favorite count: 0
type: Question

http://stackoverflow.com/comment/39102156
has text: @mmlooloo hey, i added this `publishProgress(f.getAbsolutePath());` and how can return the `f.getAbsolutePath()` at the `onProgressUpdate(String... progress)`
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25106976

http://stackoverflow.com/a/25180226
has comment: http://stackoverflow.com/comment/39212230
answers question: http://stackoverflow.com/q/25175448
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/39239518
has comment: http://stackoverflow.com/comment/76334610
score: 1
has body: Well, CachingConnectionFactory has another costructor to apply a com.rabbitmq.client.ConnectionFactory. So, it just enough to cofigure the last one as a an additional @Bean with appropriate options and inject it to the CachingConnectionFactory.
upvote count: 2

http://stackoverflow.com/q/25154253
tagged with: akka
downvote count: 0
favorite count: 0
has title: Concurrent email processing (without spamming)
type: Question
answer count: 2
tagged with: multithreading
score: 4
has answer: http://stackoverflow.com/a/25154600
tagged with: java
has answer: http://stackoverflow.com/a/25155172
type: UnansweredQuestion
has body: I have a scenario where I need to process a csv file that contains some simulation data from a device. Each line is an output representing the device state at a point in time. On processing each line, specific columns are checked for variance / anomalies. If there are anomalies, an email has to be sent to a bunch of folks with the detected anomaly. However to avoid spamming them (csv can occasionally be several 100 thousand lines) I have to maintain a threshold of X seconds.i.e If a mail was sent for the same anomaly from the same condition (from the same device being simulated) &lt; X seconds back, I must just ignore sending the mail. Currently the solution I use seems clumsy to me, where 1) I save the mail-message and device id with anomaly detection time. 2) Create one "alert" per email-id with a create-time-stamp, sent-time-stamp, message-id (from step 1) and device-id with status as "NEW". 3) Before sending each mail I do a database read to see if the last email with status as 'SENT' has a time stamp that exceeds the threshold to ignore. ( now - sent-time-stamp > threshold) If yes, then I get all the alerts using the message-id and send them out and update all their status to SENT- else just ignore. I started off with a thread pool executor and realized halfway through that the read-send condition can fail once there are multiple threads trying to send out emails and update the sent-time-stamp. So for now I have set the thread pool size to 1 - which beats the purpose of an executor. (I don't have row level locking as I use Mongo as the backing db). The backing datastore has to be a nosql store as the fields can vary drastically and will not fit a machine's disk as more simulations get piped in. The application is distributed - so a csv file can be picked by any random node to process and notify. Would Akka be a good candidate for this kind of process ? Any insights or lessons from prior experience implementing this are welcome (I have to stick with JVM).
upvote count: 4

http://stackoverflow.com/comment/39070807
comment on: http://stackoverflow.com/q/25105415
score: 0
type: QuestionComment
has text: thank you for your answer benoit_11. now here's what I've done: about 1. I tried completely deleting gca part so the code was like set('XTick'...) and that gave an error. I'm a matlab rookie so I guess that's not how I should have done that. well, then I tried completely deleting that line, so no more set(gca...), it still brings up the blank figure. and about 2.: I cut and pasted addlistener line under create function, it gave an error, which is "Attempt to reference field of non-structure array.". again, it completely ignores those two lines, no xticks no xlim, nothing.
type: Comment

http://stackoverflow.com/comment/39330211
type: Comment
comment on: http://stackoverflow.com/a/25221287
has text: Thanks. I will will check out the Lint docs as I am not familiar with it.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39047324
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25093415
has text: cart_id be present in Cart class and you already have a mapping for it in cart.hbm.xml.
score: 0

http://stackoverflow.com/a/25084314
answers question: http://stackoverflow.com/q/25084248
has comment: http://stackoverflow.com/comment/39029280
has comment: http://stackoverflow.com/comment/39030216
score: 4
upvote count: 4
has body: The sleep function executes in a separate thread so it does not cause the Event Dispatch Thread (EDT) to sleep, so the EDT keeps on executing. This is a good thing as you never want the EDT to sleep since this will prevent the GUI from repainting itself. To do animation you need to use a Swing Timer. Read the section from the Swing tutorial on How to Use Swing Timers for more information. I find the example in the tutorial a little complicated so here is the most basic example I can think of: import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.Timer; public class TimerTime extends JPanel implements ActionListener { private JLabel timeLabel; public TimerTime() { timeLabel = new JLabel( new Date().toString() ); add( timeLabel ); Timer timer = new Timer(1000, this); timer.setInitialDelay(1); timer.start(); } @Override public void actionPerformed(ActionEvent e) { timeLabel.setText( new Date().toString() ); } private static void createAndShowUI() { JFrame frame = new JFrame("TimerTime"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add( new TimerTime() ); frame.setLocationByPlatform( true ); frame.pack(); frame.setVisible( true ); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { createAndShowUI(); } }); } }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25084248
type: Answer

http://stackoverflow.com/a/25208917
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39261226
has comment: http://stackoverflow.com/comment/39261198
has body: http://dev.mysql.com/doc/refman/5.0/en/timestamp-initialization.html The TIMESTAMP data type offers automatic initialization and updating to the current date and time (that is, the current timestamp)
has comment: http://stackoverflow.com/comment/39261261
type: Answer
accepted answer of: http://stackoverflow.com/q/25208884
answers question: http://stackoverflow.com/q/25208884
has comment: http://stackoverflow.com/comment/39261267
score: 0

http://stackoverflow.com/q/25082462
score: -3
tagged with: android-alertdialog
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25082542
tagged with: java
downvote count: 3
accepted answer: http://stackoverflow.com/a/25082542
type: Question
has title: Display integer in AlertDialog
upvote count: 0
has body: Am trying to display a list of randomly generated numbers using AlertDialog. Problem is, it only accepts Strings(?).I have tried converting the int to String with no luck.I am wondering what alternatives there are to the approach am using.Here is my code: public String generateNumbers() { ArrayList&lt;Integer&gt; tempNumbers = new ArrayList&lt;Integer&gt;(); int numbers = 6; for (int i = 0; i&lt;numbers; i++) { tempNumbers.add((int) Math.random()*50 + 1); } ArrayList&lt;String&gt; finalNumbers = new ArrayList&lt;String&gt;(tempNumbers.size()); for(Integer nums: tempNumbers) { finalNumbers.add(String.valueOf(nums)); } return finalNumbers; } @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); final AlertDialog.Builder alert = new AlertDialog.Builder( context); alert.setTitle("Your Numbers"); myButton = (Button)findViewById(R.id.my_button); myButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alert .setMessage(generateNumbers()); alert.show(); } }); On the .setMessage(generateNumbers()) line, it asks me to change the return type of the method to int, but that doesn't help.Any suggestions would be appreciated.
tagged with: android
answer count: 1
favorite count: 0

http://stackoverflow.com/q/25108836
tagged with: jsp
answer count: 0
type: UnansweredQuestion
tagged with: java
has body: package controller; import java.io.IOException; import java.security.Principal; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.sql.DataSource; /** * Servlet implementation class LoginDataAccess */ public class LoginDataAccess extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public LoginDataAccess() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); Principal p = request.getUserPrincipal(); if(request.isUserInRole("user")){ session.setAttribute("isUser", true); } String username = p.getName(); System.out.println(username); String query = "SELECT user_name FROM tomcat_users WHERE user_name = '"+username+"'"; System.out.println(query); /* * This next section deals with getting the Data Source from the context. */ InitialContext context; DataSource dataSource = null; try { context = new InitialContext(); //This is a bit of JNDI - we don't need to know how this works, just that it does. dataSource = (DataSource)context.lookup("java:comp/env/jdbc/connection"); } catch (NamingException e) { e.printStackTrace(); } Connection connection; ResultSet rset = null; try { connection = dataSource.getConnection(); Statement stmt = connection.createStatement(); rset = stmt.executeQuery(query); while(rset.next()){ session.setAttribute("user_name", rset.getString("user_name")); } } …
has title: HTTP Status 404 - /BilalWebtier/WEB-INF/jsp/loginParam.jsp
type: Question
has comment: http://stackoverflow.com/comment/39076174
has comment: http://stackoverflow.com/comment/39076061
score: 0
tagged with: jstl
tagged with: sql
has comment: http://stackoverflow.com/comment/39074826

http://stackoverflow.com/a/25224889
type: AcceptedAnswer
has body: Download a file without buffer: Nio is faster than io? It is unlikely to make any difference to download times whether you use classical I/O streams, or the NIO APIs. The speed of downloads is usually limited by the network. Things like: the raw data rate of the slowest link, the end-to-end network latency, the amount of congestion over the entire route (which affects the chance of packets being dropped), the absence of other factors (e.g. route instability, unreliable links / hardware, "shaping"). Then, there is the issue of whether "the other end" can provide (or consume) the data at the rate that "the network" is capable of carrying. That typically depends on disc and network I/O bandwidth and load at the other end. Generally speaking, your client's ability to move the data from the memory buffer to the local destination file are not the issue. Before you (IMO) waste more time on this, I recommend that you implement the download code "the simple way". Then benchmark / profile it (with real downloads) to determine whether the performance bottleneck is in the code or (as I suspect) in "the network". Only go to the effort of optimizing your code if your measurements suggest that it could be worthwhile. UPDATE - I just noticed that in your original version, you are reading data a byte at a time (using read() from an unbuffered input stream. This definitely is inefficient, and it may be bad enough to impact on download speeds. If you are going to read from a stream (or write to a stream) in small chunks (e.g. one byte at a time), then you should wrap it with the corresponding buffered stream; e.g. BufferedInputStream, BufferedOutputStream, BufferedReader, BufferedWriter. The performance difference between using buffered versus unbuffered streams (for small I/O ops) is orders of magnitude more significant than the difference between classic streams versus NIO.
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/39296568
accepted answer of: http://stackoverflow.com/q/25224604
answers question: http://stackoverflow.com/q/25224604
score: 4

http://stackoverflow.com/comment/39025843
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25082619
has text: You can shuffle a List. Put your cards in a list instead of a map. Because your key is a number you can do the same with the list (list.get(index))
score: 0

http://stackoverflow.com/comment/39213977
type: Comment
has text: Perfect answer, thanks! The behaviour of URI seems indeed inconsistent. getAuthority() works, so I can use it to strip off the username and port by finding : and @ in the string...
score: 0
comment on: http://stackoverflow.com/a/25183935
type: AnswerComment

http://stackoverflow.com/comment/39076949
type: AnswerComment
score: 0
has text: @HukeLau_DABA Well, won't you be surprised when you find out that your algorithm isn't working, because its the same pointer "reference" to the same array list through your entire algorithm, which is because the objects are passed by reference.
comment on: http://stackoverflow.com/a/25109872
type: Comment

http://stackoverflow.com/comment/39028395
type: Comment
type: QuestionComment
has text: You usually integrate Spring and Hibernate. There are several tutorials on the net about it. And they explain how you can use the connection pool from an external datasource.
comment on: http://stackoverflow.com/q/25083537
score: 0

http://stackoverflow.com/q/25130009
has title: Update ContentProvider after sqlite download
has answer: http://stackoverflow.com/a/25130374
has body: Some of my apps content is downoaded from the web in the form of an sqlite database. Once downloaded this database provides a list of stores. The issue I'm running into is that the onCreate() method of the ContentProvider is called at app start up, before the sqlite database is downloaded. I'm just testing now, but when I go to my AutoCompleteTextView and start typing my app crashes, likely because the database was not available when the ContentProvider was initiated. When I reopen the app, everything works as expected. Is there something I can do to reload the database once the download is complete? I'm having trouble because in the fragment where the AutoCompleteTextView is I'm using a CursorLoader, so I don't ever instantiate the ContentProvider ... I just use the loader. So there is no way for me to call something like ContentProvider.reloadDatabase(). One thing I found that does work is closing-reopening the database in my .query() method in the ContentProvider. But this is extremely inefficient, as this is called every time a new character is typed in the AutoCompleteTextView. Any help is much appreciated.
type: Question
tagged with: android-contentprovider
answer count: 1
score: 0
tagged with: android
tagged with: sqlite
type: UnansweredQuestion
tagged with: java

drupal
type: Tag
tag name: drupal
tags question: http://stackoverflow.com/q/25190286

http://stackoverflow.com/comment/39057724
type: Comment
has text: Well, the problem is that it can't see text from inside the ActionListener. Is there a better way to set this up?
comment on: http://stackoverflow.com/a/25098642
score: 0
type: AnswerComment

http://stackoverflow.com/q/25200734
possible better answer: http://stackoverflow.com/a/25200881
has comment: http://stackoverflow.com/comment/39245725
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25200987
type: Question
has body: It may sound stupid but: is it possible to tell Eclipse to change some already compiled code (in a .class file) while debugging? I would like to check a couple of things for some values. I know that if it is compiled I cannot change it, so it makes no sense to try this. Well, in this concrete case it does make sense. I am also aware of the hot code replace functionality of Eclipse but it doesn't work for me because it is for source files. EDIT: In my case I don't want to change the value of a variable. I would like to put a 1 instead of a 0 in this call within a .class file getTabFolder().setSelection(0);
has title: Change compiled code while debugging in Eclipse
tagged with: eclipse
has answer: http://stackoverflow.com/a/25200881
has answer: http://stackoverflow.com/a/25201420
answer count: 3
accepted answer: http://stackoverflow.com/a/25200987

http://stackoverflow.com/comment/39126751
score: 0
type: Comment
type: QuestionComment
has text: My order by is for example ORDER BY (m.mercLatitude + m.mercLongitude) So it depends on the columns. And i'd like to do that not by hql but with jpa
comment on: http://stackoverflow.com/q/25120751

http://stackoverflow.com/comment/139114836
score: 0
type: Comment
comment on: http://stackoverflow.com/a/40606633
type: AnswerComment
has text: It took me way too long trying to figure out what this answer was trying to say, as it didn't seem to actually be true in its contradiction of the top answer. For anyone who comes along later, this answer is set in contrast to dreamtangerine's [answer](https://stackoverflow.com/a/39627823/1541186), not okutane's currently-top answer. The distinction between `method` and `methods` is very relevant, and attempts to modify `method` will have exactly the problem described here. Attempts to modify `methods` will not.

http://stackoverflow.com/a/25227183
downvote count: 0
score: 1
has body: Your problem is to use this code or to solve the problem ? if to solve it you can generate primes using Sieve algorithm then check if the element is prime or not (if it was prime then check if element/10 is also prime)
upvote count: 1
answers question: http://stackoverflow.com/q/25227098
type: Answer

http://stackoverflow.com/comment/39217333
has text: What's the specific problem? Is it that the table isn't there even though you have the SQL to create it in `onCreate()`? If so, chances are the database file already exists without the table. Just uninstall your app to get rid of the old file. http://stackoverflow.com/questions/21881992/when-is-sqliteopenhelper-oncreate-onupgrade-run
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25185650

http://stackoverflow.com/comment/39311615
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25222663
type: QuestionComment
has text: finally I found the problem: The html page was in the fram and I add only this line before locating the element. driver.switchTo().frame(0); and then: driver.findElement(By.xpath("//tbody/tr/td[1]")).click();

http://stackoverflow.com/comment/39143811
comment on: http://stackoverflow.com/q/25145789
has text: Please show us the code you're using to actually call the sort function.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39140490
comment on: http://stackoverflow.com/a/25143069
type: AnswerComment
score: 0
type: Comment
has text: @David I would if I have time. Writing a parser seems not trivial, although I never tried.

http://stackoverflow.com/a/25204709
has comment: http://stackoverflow.com/comment/39253126
score: 0
has body: /url?var is a valid URL which states that you have a parameter var which is not initialized. So by default it is initialized to empty string. That's the framework behavior. If you don't want to see that parameter coming in HttpServletRequest::getParameterMap(), just don't use it with URL (i.e. /url should be your call)
type: Answer
answers question: http://stackoverflow.com/q/25204538

http://stackoverflow.com/comment/39083735
comment on: http://stackoverflow.com/a/25113431
score: 0
type: Comment
type: AnswerComment
has text: @EJP It is expecting the "the `cam` directory under the `c` drive". (Although the wording in the first sentence could be cleaned up.)

http://stackoverflow.com/q/25106118
tagged with: spring
has comment: http://stackoverflow.com/comment/39071087
has comment: http://stackoverflow.com/comment/39069609
answer count: 0
has comment: http://stackoverflow.com/comment/39069805
type: UnansweredQuestion
has title: spring how to stop a bean value being to modified in BeanPostProcessor
tagged with: java
has comment: http://stackoverflow.com/comment/39069912
type: Question
score: 0
has comment: http://stackoverflow.com/comment/39069685
has body: My Bean is &lt;bean class="org.process.EmployeeBeanPostProcessor"/&gt; &lt;bean id="address" class="org.beans.employee.Address" &gt; &lt;property name="id" value="1" /&gt; &lt;property name="city" value="City123" /&gt; &lt;property name="state" value="State123" /&gt; &lt;/bean&gt; And My PostProcess is public class EmployeeBeanPostProcessor implements BeanPostProcessor//, InstantiationAwareBeanPostProcessor { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { System.out.println("Before for the bean " + beanName); if (bean instanceof Address) { ((Address) bean).setCity("New City at Before"); } return bean; } @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { System.out.println("After for the bean " + beanName); if (bean instanceof Address) { ((Address) bean).setCity("New City at After"); } return bean; } } So finally city have a value "New City at After" Now I Don't want my address bean should be modified in post processor. Please let me know how to do it.

http://stackoverflow.com/q/25083550
type: Question
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/25202986
has comment: http://stackoverflow.com/comment/39248258
has title: Mysql 5.5 Access denied <-- Jboss 7
type: AnsweredQuestion
tagged with: java
has body: After reinstalling Mysql 5.5 on my PC mysql refuses all connections made from my Jboss 7 application server. The configuration files have not changed only the database server instance. I can connect using the command line (same user and password as defined in the jboss config, that worked on the previous mysql instance) I set the user and DB as follows: create database business_service; create user 'business_service'@'%' identified by 'xxxx'; create user 'business_service'@'localhost' identified by 'xxxx'; GRANT ALL PRIVILEGES ON business_service.* TO 'business_service'@'%' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON business_service.* TO 'business_service'@'localhost' WITH GRANT OPTION; At this point I am able to login to the above DB using mysql workbench and straight from the cmd line: mysql -u business_service -p However when I start up Jboss 7 using the same files the connected to the previous mysql 5.5 database (New PC, but as JBoss is file system based and all the paths are the same all I needed to do was copy the file system over) it returns: Caused by: java.sql.SQLException: Access denied for user 'business_service'@'localhost' (using password: YES) My assumption is there is some sort of setting saying plain text passwords are not accepted, I first tried with mysql 5.6 but had the same issue, and after messing around with all sorts of mysql settings decided to just revert back to 5.5, but no joy. So my question is: 1) does anything jump out with regard to a switch I have not set to allow an XA JDBC resource to connect? 2) if not can I tell MYSQL to log the password that is coming in (I can see in the logs that JBOSS tries to connect) so I can see maybe it is encrypted. 3) The Mysql to allow connections without passwords (if all else fails) 4) Any other Ideas? Thanks Marc
has answer: http://stackoverflow.com/a/25202986
tagged with: mysql
tagged with: jboss

http://stackoverflow.com/comment/81772313
type: AnswerComment
type: Comment
has text: Hi @icza i have looked on the internet and this post is the closest to an answer i could get. But my problem is a bit different i have a string query line with paramters public static final String TEST_QUERY = "SELECT fin FROM FinantialTable as fin WHERE " + "(fin.debitCredit = ?2)"; DebitCredit being an ENUM, I am passing DebitCredit.DEBIT in parameter 2 but it does not give me the desired results - no errors the reult is that it selects all records from fin table, i want all Debit records, any advice?
comment on: http://stackoverflow.com/a/25114802
score: 0

http://stackoverflow.com/a/25123367
has body: JPA uses JDBC API as low level and from side of jdbc driver there is no difference between error in incorrect query syntax or broken trigger. So generally you cant implement such check. But some database vendors (Oracle for example) provide unique error number in message when exception occurs, which can be used to identify real problem such as broken trigger.
score: 1
has comment: http://stackoverflow.com/comment/39106357
downvote count: 0
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25122088
answers question: http://stackoverflow.com/q/25122088
type: Answer

http://stackoverflow.com/comment/39113193
has text: I cannot create single template - NPE: java.lang.NullPointerException at org.fastcode.util.VelocityUtil.validateVariablesAndMethods(VelocityUtil.java:402) at org.fastcode.preferences.OpenEditTemplateDialog.okPressed(OpenEditTemplateDialog.java:583)
comment on: http://stackoverflow.com/a/25103604
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/25210019
tagged with: java
has title: java conundrum pertinent to lists
type: Question
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/25210136
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25210147
has body: I find myself to be troubled by this unresolved(as of yet) conundrum. . Let's say we have a list of integers l and this list contains objects in the following order : 1,2,3,2,4,2,5,2,6 with the first element i.e. 1 having the index 0 and the last element i.e. 6 having the index 8.. now every time I use l.indexOf(2), the value returned is 1, how do I access the indexes of the other 2s without removing anything from the list?
tagged with: indexing
tagged with: list

http://stackoverflow.com/comment/39028284
type: Comment
comment on: http://stackoverflow.com/a/25077875
score: 0
type: AnswerComment
has text: still no idea what it is.

http://stackoverflow.com/a/25152779
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39156681
has comment: http://stackoverflow.com/comment/39157294
has comment: http://stackoverflow.com/comment/39156914
type: AcceptedAnswer
has body: Your command is a bit off. bash treats ; as a command separator, so everything after the ; in the cp is a command (the separator ";" is for Windows). Then your library is in a subfolder not the root - so this, javac -cp /httpcomponents-client-4.3.4/lib/*.jar;. PostToServer.java Should be, javac -cp httpcomponents-client-4.3.4/lib/*.jar:. PostToServer.java
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/25152625
answers question: http://stackoverflow.com/q/25152625

http://stackoverflow.com/comment/39173710
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25161861
score: 0
has text: The TimerTask should repeat at a fixed interval until you call cancel(), so this code should repeat 10 times. Is it not working that way?

http://stackoverflow.com/comment/39059510
type: QuestionComment
has text: Post your transactional configuration.
score: 0
comment on: http://stackoverflow.com/q/25100535
type: Comment

http://stackoverflow.com/comment/39004786
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25070975
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58459/discussion-between-photographybum-and-stacym).

http://stackoverflow.com/comment/39155873
type: QuestionComment
has text: have you imported the class `Test` in your jsp
score: 1
comment on: http://stackoverflow.com/q/25152312
type: Comment

http://stackoverflow.com/comment/40498624
type: QuestionComment
has text: Bumping this. Ive stripped it down to bare basics and still getting the same. I created a new app in Eclipse called GrailsTester. Added a domain object called com.test.Sample with no fields. Created a service called com.test.SampleService and put static lazyInit = false @PostConstruct def serviceMethod() { println 'Here: ' + Sample.list() } in it. Started the app and get the same error. What am i doing wrong here?
comment on: http://stackoverflow.com/q/25211766
score: 0
type: Comment

http://stackoverflow.com/comment/47433654
comment on: http://stackoverflow.com/a/26213303
type: AnswerComment
score: 0
type: Comment
has text: still had the svn from last eclipse major. update to luna svn did the trick for me! thx.

http://stackoverflow.com/comment/39084632
comment on: http://stackoverflow.com/a/25106976
has text: @mmlooloo oh it's fine! mistakes do happen. thank you for looking into it further and letting me know. really appreciate it. since i don't have two or more device with me right now, i'll check that and let you know asap how it goes and the function you mentioned is publishProgress (Progress... values) if i'm correct. thanks again!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39168344
comment on: http://stackoverflow.com/q/25159416
score: 0
type: Comment
type: QuestionComment
has text: Try looking in the database with some tool first. That lists all tables for instance. First guess: you are in the wrong database scheme. Tools: NetBeans IDE, Toad e.a.

http://stackoverflow.com/comment/39198055
type: Comment
has text: @SotiriosDelimanolis If the string is null , you will get null pointer exception in third line itself..Isn't it?
score: 0
comment on: http://stackoverflow.com/a/25175024
type: AnswerComment

http://stackoverflow.com/comment/39463726
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25152866
has text: @ Brent Worden I didn't get *To critique or request clarification from an author* means. What u r saying to me ?

http://stackoverflow.com/comment/39123684
type: Comment
comment on: http://stackoverflow.com/a/25134976
score: 1
has text: @T.J.Crowder Ah, I was thinking of `String.matches()` which _does_ implicitly wrap the supplied regex in `^$`, e.g. `String.matches("abc", "a") == false`, but `String.matches("abc", ".*a.*") == true`.
type: AnswerComment

http://stackoverflow.com/a/25126536
has comment: http://stackoverflow.com/comment/39110014
score: 10
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25126406
has comment: http://stackoverflow.com/comment/39108849
accepted answer of: http://stackoverflow.com/q/25126406
upvote count: 10
type: Answer
has body: try this: ${project.build.directory} / *.jar Please refer to Guide to creating assemblies for more details.
has comment: http://stackoverflow.com/comment/39109540

http://stackoverflow.com/comment/39241278
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25198417
score: 1
has text: I can tell if it's a enum constant, not sure if that's the same thing...

http://stackoverflow.com/comment/39269740
type: Comment
comment on: http://stackoverflow.com/a/25212778
score: 0
type: AnswerComment
has text: but could you please explain what the lowestIndex=i; does? :D

http://stackoverflow.com/comment/39181323
score: 0
type: QuestionComment
has text: That is because the image is big for the device. Check that the image is not bigger than 1024.
type: Comment
comment on: http://stackoverflow.com/q/25166024

http://stackoverflow.com/q/25132024
has answer: http://stackoverflow.com/a/38079492
has answer: http://stackoverflow.com/a/25136622
tagged with: session
type: UnansweredQuestion
tagged with: servlets
answer count: 3
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39118928
has comment: http://stackoverflow.com/comment/39119156
upvote count: 2
tagged with: java
tagged with: hibernate
has body: When you first attempt to use a session Hibernate will create one and attach it to your local thread. When you commit the transaction in the session Hibernate will automatically close the session meaning it can’t be reused. - got this quote from this site how ever this is what my code looks like ,and i can i do close my hibernateSession every time i commited transaction: Session session = HibernateUtil.getSessionFactory().openSession(); session.setFlushMode(FlushMode.AUTO); session.beginTransaction(); session.getTransaction().commit(); session.close(); All of my code works fine, but there is issue : For example if i add row in to database,saving success,if i add another one after 1-10 seconds. Hibernate Exception occurs saying Session is closed. but this not happen if i add another one if i wait upto 1 minute. Is this somewhat wrong in my code or the server im connecting is slow(I do have this idea because updates on my java servlet code is sometimes delay)? Any idea?
has answer: http://stackoverflow.com/a/25132398
has title: Hibernate session issue
downvote count: 1

http://stackoverflow.com/a/25127465
has comment: http://stackoverflow.com/comment/39111263
score: 0
has comment: http://stackoverflow.com/comment/39110297
has comment: http://stackoverflow.com/comment/39110875
type: Answer
has comment: http://stackoverflow.com/comment/39110665
has comment: http://stackoverflow.com/comment/39111069
answers question: http://stackoverflow.com/q/25126953
has comment: http://stackoverflow.com/comment/39110482
has comment: http://stackoverflow.com/comment/39110421
has body: As mentioned in my comment, the problem is likely that your while-loop doesn't do what you expected (the problem is that for each iteration, it will overwrite buffer from the beginning, producing garbled data in buffer). To properly read all of the input stream into buffer, use the following code: byte[] buffer = new byte[imageBufferSize]; int count = 0; int offset = 0; while ((count = in.read(buffer, offset, imageBufferSize - offset)) != -1) { offset += count; } The reason why bufImg is null is probably just because ImageIO.read(..) returns null for data it doesn't understand.

http://stackoverflow.com/comment/39157563
type: QuestionComment
has text: The solution I found is described here : [Bitronix in Tomcat](http://docs.codehaus.org/display/BTM/Tomcat2x#Tomcat2x-Step4ConfiguretransactionmanageranddatasourcesinitializationinyourMETA-INFcontextxml) but I do not want to define properties related with datasource in tomcat because profiles will not work with that.
score: 0
comment on: http://stackoverflow.com/q/25137385
type: Comment

http://stackoverflow.com/q/25075154
has comment: http://stackoverflow.com/comment/39011674
tagged with: maven-3
has answer: http://stackoverflow.com/a/25075673
has body: I am working on my little OSS project in which I am using Maven as build tool. I split the project into smaller sub-projects to simplify development. Thus I have following structure: project +-- main-module | | | +- pom.xml | +-- submodule1 | | | +- pom.xml | + pom.xml My thought was that main-module should provide interfaces which each submodule should be implementing in order to be plugged into whole application. Therefore submodule1/pom.xml contains compile time dependency reference to main-module. In its turn I also need to be able to test whole application and thus main-module/pom.xml contains test scope dependency reference to submodule1. As the result maven refuses to compile projects saying that they contain cyclic references. My thought was that maven could first compile classes of main-module as it does not require any compile time dependency on any of submodules, then it using compiled classes of main-module could compile classes of submodule1 and after that compile test classes of main-module (to be able run tests). But seems that maven compiler does not take in account the scope of dependency and I somehow need to work around that. The only solution I can see is to move away tests from main-module, which doesn't really make sense for me as only that module provides main logic. My question - is there any other way around this issue except for moving away tests? Or maybe something is wrong with my understanding of how maven-reactor-plugin should work?
has comment: http://stackoverflow.com/comment/39011948
has comment: http://stackoverflow.com/comment/68847772
has comment: http://stackoverflow.com/comment/39012200
has comment: http://stackoverflow.com/comment/39011839
score: 0
has comment: http://stackoverflow.com/comment/39012036
has comment: http://stackoverflow.com/comment/39012320
has comment: http://stackoverflow.com/comment/39012297
has comment: http://stackoverflow.com/comment/39011862
has answer: http://stackoverflow.com/a/25075864
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25075673
linked to: http://stackoverflow.com/q/10174542
tagged with: java
has comment: http://stackoverflow.com/comment/39011671
has comment: http://stackoverflow.com/comment/39012227
possible better answer: http://stackoverflow.com/a/25075864
type: Question
has title: Maven compile multi-module project with cyclic dependencies
answer count: 2
has comment: http://stackoverflow.com/comment/39012010
has comment: http://stackoverflow.com/comment/39012175

http://stackoverflow.com/a/25079123
answers question: http://stackoverflow.com/q/25078548
has body: You probably want to compile the other source code first. The Java compiler is actually written in Java itself. You do not need to invoke the javac.exe, instead take a look at javax.tools.ToolProvider.getSystemJavaCompiler() ToolProvider Javadoc. Once you compiled the source code file with that, you can use the class loader to load the compiler class file and invoke the code from there, probably by means of reflection. Overall you are asking for an advanced use case.
score: 0
type: Answer

http://stackoverflow.com/a/25098227
downvote count: 1
has comment: http://stackoverflow.com/comment/39107696
has comment: http://stackoverflow.com/comment/39070572
has comment: http://stackoverflow.com/comment/39107184
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/39106966
has comment: http://stackoverflow.com/comment/39100668
score: 1
has body: If Expression state is your own class I'd make it implement two different interfaces like so. public class ExpressionState implements InterfaceOne, InterfaceTwo { public void interfaceOneGetterMethod() public void interfaceTwoGetterMethod() } in another file: public interface InterfaceOne { public void interfaceOneGetterMethod(); and final file: public interface InterfaceTwo { public void interfaceTwoGetterMethod(); Now when you create the ExpressionState objects assign them to objects defined as: InterfaceTwo var = new ExperssionState(blah); Or modify your builder to just return interfaces( even better )
answers question: http://stackoverflow.com/q/25094722

http://stackoverflow.com/comment/39090992
comment on: http://stackoverflow.com/a/25117396
type: Comment
score: 0
type: AnswerComment
has text: Thank you very much, I completely get it now :)

http://stackoverflow.com/comment/39127119
score: 0
comment on: http://stackoverflow.com/q/25134920
type: Comment
type: QuestionComment
has text: yes , in my database table there is column which stores date in string format as 'mm/dd/yyyy' and now i want to get the only those tuples through sql query which have been created in this week , month or year.

http://stackoverflow.com/q/25172141
has answer: http://stackoverflow.com/a/25172206
type: Question
answer count: 2
upvote count: 0
has body: I have a problem with this following piece of code: the photo does not show in my JFrame... Please help me. My Java code: public class ImageRead extends JFrame { JPanel pan; Image img1; public ImageRead() throws IOException { this.pan = new JPanel(); final Dimension d = new Dimension(500, 500); this.img1 = ImageIO.read(new File("C:\\Users\\KHALED\\workspace\\" + "Universite Base De Donner\\src\\2.jpg")); this.pan.setPreferredSize(d); this.pan.add(new JButton("entre")); this.pan.setBackground(Color.red); this.getContentPane().add(this.pan); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); this.setSize(500, 500); this.setVisible(true); this.setResizable(false); } public void paintComponents(final Graphics g) { final Graphics2D g2 = (Graphics2D) g; g.drawImage(this.img1, 0, 0, this.pan); g2.finalize(); } public static void main(final String[] args) throws IOException { new ImageRead(); } }
favorite count: 0
has title: The picture does not show in this Frame?
type: UnansweredQuestion
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/25172208
score: -1

http://stackoverflow.com/comment/39218831
has text: What I mean is, how are you determining if the experiment succeeded or failed?
comment on: http://stackoverflow.com/q/25184822
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25224603
has answer: http://stackoverflow.com/a/25224776
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/25224776
answer count: 1
has body: Is it possible to cech sms message before it gets to the main sms app and change it's body?
tagged with: android
has title: Get sms message before it gets to the main sms app and change it's body

http://stackoverflow.com/comment/39299645
comment on: http://stackoverflow.com/q/25228917
has text: what do u build with ? ant / gradle / eclipse
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25083958
tagged with: apache-poi
answer count: 0
upvote count: 2
type: UnansweredQuestion
has title: IllegalArgumentException while Export to Excel Using Apache POI Api
tagged with: excel
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/39031937
type: Question
downvote count: 0
has body: How to resolve The maximum length of cell contents (text) is 32,767 characters When i try to run the export to excel using Apache POI , I am getting the following error root cause java.lang.IllegalArgumentException: The maximum length of cell contents (text) is 32,767 characters org.apache.poi.hssf.usermodel.HSSFCell.setCellValue(HSSFCell.java:548) org.apache.poi.hssf.usermodel.HSSFCell.setCellValue(HSSFCell.java:522) How can i resolve this without limiting the Content to allow more than 32,767 characters I humbly request everyone's Valuable suggestions. Please help
favorite count: 0

http://stackoverflow.com/q/25229685
has answer: http://stackoverflow.com/a/25229922
tagged with: android-wake-lock
downvote count: 0
answer count: 2
has answer: http://stackoverflow.com/a/25229926
tagged with: android
has body: I have got a class, which extends from BroadcastReceiver and gets called from AlarmManager. In the onReceive method I execute an AsyncTask, which fetches some data from the internet and stores the data in the local database of the application. Do I need to acquire wakelock with: @Override public void onReceive(Context context, Intent intent) { PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, ""); mWakeLock.acquire(); // execute AsyncTask } private void asyncTaskDone() { mWakeLock.release(); } in order to stop the CPU from sleeping or is it safe to execute the AsyncTask without a wake lock?
score: 1
favorite count: 0
tagged with: android-asynctask
upvote count: 1
has title: BroadcastReceiver wake lock needed if only AsyncTask is executed?
accepted answer: http://stackoverflow.com/a/25229926
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25229922
type: Question

http://stackoverflow.com/a/43466112
answers question: http://stackoverflow.com/q/25128219
upvote count: 11
has comment: http://stackoverflow.com/comment/76367654
has body: This is the quickest way to solve the problem but it's not recommended because its applicable only for your local system. Download the jar, comment your previous entry for ojdbc6, and give a new local entry like so: Previous Entry: New Entry: com.oracle ojdbc6 1.0 system ${project.basedir}/lib/ojdbc6/ojdbc6.jar
type: Answer
score: 11
downvote count: 0
has comment: http://stackoverflow.com/comment/76296174

http://stackoverflow.com/comment/39018276
comment on: http://stackoverflow.com/q/25077850
type: QuestionComment
score: 1
has text: What isn't so obvious is that in this case no source level is set all; 1.3 is just the default that will be used if you don't specify anything.
type: Comment

http://stackoverflow.com/comment/39208255
score: 1
comment on: http://stackoverflow.com/q/25180950
has text: i'm vorting it down - ask clear questions!
type: QuestionComment
type: Comment

buttonclick
type: Tag
tags question: http://stackoverflow.com/q/25097723
tag name: buttonclick

http://stackoverflow.com/q/25083537
has comment: http://stackoverflow.com/comment/39028514
has comment: http://stackoverflow.com/comment/39028395
tagged with: jdbc
tagged with: spring
score: 2
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39028051
has title: JDBC Connection: Not Recconecting after Timeout
has comment: http://stackoverflow.com/comment/39028835
has comment: http://stackoverflow.com/comment/39028009
has comment: http://stackoverflow.com/comment/39028335
type: Question
has answer: http://stackoverflow.com/a/41483086
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39027572
has comment: http://stackoverflow.com/comment/39028452
has body: After some time without using a connection in my application, the next attempt to retrieve a valid connection raises an JDBC exception: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 81,155,040 milliseconds ago. The last packet sent successfully to the server was 81,155,040 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. I'd like to know which configuration should I change in order to avoid this issue. I'm managing the connections in application level through a Hibernate SessionFactory, in ways that the pooling and connection management is totally invisible at this level. Should I have to do some kind of attempting to check and retrieve a brand new connection while dealing with SessionFactory? In time: I'm using Spring too. Server.xml: <?xml version="1.0" encoding="UTF-8"?> <Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/> <Listener className="org.apache.catalina.core.JasperListener"/> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/> <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase" /> <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" initialSize="20" global="mysql/GestaoProjetos" maxActive="800" maxIdle="20" maxWait="30000" minEvictableIdleTimeMillis="10000" name="mysql/GestaoProjetos" password…
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0

http://stackoverflow.com/q/25145834
has body: In one of my application i'm accessing some files in the sd card. I'm using the below function to determine the mounted sd-card path. File file = new File("/system/etc/vold.fstab"); FileReader fr = null; BufferedReader br = null; String path = ""; try { fr = new FileReader(file); } catch (FileNotFoundException e) { e.printStackTrace(); } try { if (fr != null) { br = new BufferedReader(fr); String s = br.readLine(); while (s != null) { if (s.startsWith("dev_mount")) { String[] tokens = s.split("\\s"); path = tokens[2]; //mount_point } s = br.readLine(); } } } catch (IOException e) { e.printStackTrace(); } finally { try { if (fr != null) { fr.close(); } if (br != null) { br.close(); } } catch (IOException e) { e.printStackTrace(); } } return path; This works for all the devices prior to Kitkat. But in Kitkat version i'm getting FileNotFoundException on line 1, File file = new File("/system/etc/vold.fstab"); I found so many articles about updated sd card permission in Android kitkat version.But still a bit confused about that... Please can anyone help me to sort it out??? Thanks in advance...
tagged with: android-sdcard
favorite count: 0
tagged with: android
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39143781
upvote count: 1
has comment: http://stackoverflow.com/comment/39158103
type: Question
has answer: http://stackoverflow.com/a/25145942
has title: Finding SD-Card Path in Android 4.4 Kitkat
has answer: http://stackoverflow.com/a/31817386
answer count: 2
downvote count: 0
score: 1

http://stackoverflow.com/q/25102518
has comment: http://stackoverflow.com/comment/39068993
has comment: http://stackoverflow.com/comment/39064875
has comment: http://stackoverflow.com/comment/39068816
has body: I am unable to post my form in spring mvc 4 User class public class User { private String Username; private String Password; public User(String username, String password) { Username = username; Password = password; } public User() { // TODO Auto-generated constructor stub } public String getUsername() { return Username; } public void setUsername(String username) { Username = username; } public String getPassword() { return Password; } public void setPassword(String password) { Password = password; } this is my controller method package com.**.web.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.**.dao.*; import com.**.model.User; @Controller public class MainController { @Autowired private UserDAO UserDAO; @RequestMapping(value = {"/hello", "/welcome**" }, method = RequestMethod.GET) public ModelAndView defaultPage() { ModelAndView model = new ModelAndView(); model.addObject("title", "Spring Security Login Form - Database Authentication"); model.addObject("message", "This is default page!"); model.setViewName("hello"); return model; } @RequestMapping(value = "/admin**", method = RequestMethod.GET) public ModelAndView adminPage() { ModelAndView model = new ModelAndView(); model.addObject("title", "Spring Security Login Form - Database Authentication"); model.addO…
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/39076906
has comment: http://stackoverflow.com/comment/39064348
linked to: http://stackoverflow.com/q/25121506
has comment: http://stackoverflow.com/comment/39064114
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39098816
has comment: http://stackoverflow.com/comment/39064241
tagged with: post
upvote count: 1
has comment: http://stackoverflow.com/comment/39068528
favorite count: 0
has title: POST not working in spring mvc 4
downvote count: 0
answer count: 0
type: UnansweredQuestion

cassandra
tags question: http://stackoverflow.com/q/25145980
tags question: http://stackoverflow.com/q/25189832
type: Tag
tag name: cassandra
tags question: http://stackoverflow.com/q/25222738
tags question: http://stackoverflow.com/q/25212700
tags question: http://stackoverflow.com/q/25074373
tags question: http://stackoverflow.com/q/25122000

http://stackoverflow.com/a/25103506
score: 4
has body: Press F11 to close the fullsize mode.
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/25098337

http://stackoverflow.com/q/25095405
linked to: http://stackoverflow.com/q/4948780
has comment: http://stackoverflow.com/comment/39049745
has comment: http://stackoverflow.com/comment/39049869
has comment: http://stackoverflow.com/comment/39049811
has title: Why is the hash code returned by the hashCode() method generated by Eclipse not very good?
has answer: http://stackoverflow.com/a/25095464
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/25095464
downvote count: 0
has comment: http://stackoverflow.com/comment/39049763
favorite count: 0
tagged with: hash
type: Question
has comment: http://stackoverflow.com/comment/39049688
has comment: http://stackoverflow.com/comment/39050685
upvote count: 2
has body: I usually let Eclipse generate the hashCode() method for me, but now I found signs that the generated hash code may not be very good. Using the hash code returned by the Eclipse-generated hashCode() method in a hash set results in about 6 times slower lookups than when using a hand coded hashCode() method. Here is my test: A class with three int fields. The hashCode() and equals() methods has been generated by Eclipse. Fill a HashSet with 1.000.000 instances of the class. Look up each instance in the HashSet Repeat the look up 10 times. The code: import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; public class MyPojo { private final int a; private final int b; private final int c; public MyPojo(int a, int b, int c) { super(); this.a = a; this.b = b; this.c = c; } public static void main(String[] args) { List&lt;MyPojo&gt; listOfPojos = new ArrayList&lt;MyPojo&gt;(); Set&lt;MyPojo&gt; setOfPojos = new HashSet&lt;MyPojo&gt;(); for (int countA = 0; countA &lt; 100; countA++) { for (int countB = 0; countB &lt; 100; countB++) { for (int countC = 0; countC &lt; 100; countC++) { MyPojo myPojo = new MyPojo(countA, countB, countC); listOfPojos.add(myPojo); setOfPojos.add(myPojo); } } } long startTime = System.currentTimeMillis(); for (int count = 0; count &lt; 10; count++) { for (MyPojo myPojo : listOfPojos) { if (!setOfPojos.contains(myPojo)) { throw new RuntimeException(); } } } long endTime = System.currentTimeMillis(); System.out.format("Execution time: %3f s", (endTime - startTime) / 1000.0); } // Generated by Eclipse @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + a; result = prime * result + b; result = prime * result + c; return result; } // Generated by Eclipse @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MyPojo other = (MyPojo) obj; if (a != other.a) return fals…
tagged with: java
tagged with: eclipse
answer count: 1
linked to: http://stackoverflow.com/q/11795104

http://stackoverflow.com/q/25098096
has body: while developing, my brain suddenly came up with a stupid idea and due to that, also a question about understanding. I was writing a method to shut down my database connection and driver and I thought about after cleaning up my used objects and stuff, just doing this = null and I was pretty sure, that this won't work. But I tried anyways and IntelliJ of course presented me a nicely formatted error message "Variable expected" when hovering over "this". So I asked myself how "this" is working (huehue, I like the wordplays). I would be very glad if you could explain it to me. I am basically not a newbie in Java but I didn't thought about "this" (xD) 'til now and just used it. Is it kind of an alias for the current object? Is it final? Is it just a keyword (I know it IS a keyword) with some special behaviour? I would really appreciate understanding one of the most-used words in my source code.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39055021
duplicate of: http://stackoverflow.com/q/3728062
linked to: http://stackoverflow.com/q/3728062
has title: Understanding about "this"
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39055049
type: Question
has comment: http://stackoverflow.com/comment/39054954
upvote count: 2
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/39054909
has comment: http://stackoverflow.com/comment/39055096
has comment: http://stackoverflow.com/comment/39055084
tagged with: this
favorite count: 0
has comment: http://stackoverflow.com/comment/39054929

http://stackoverflow.com/comment/39033279
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25086362
type: QuestionComment
has text: try changing `android:targetSdkVersion="21"` to `android:targetSdkVersion="19"`

http://stackoverflow.com/q/25105175
has body: I have a requirement to write many tests. I have extended Suite Runner of JUnit in order to be able to add new annotations where I can mention several Prerequisite classes which will be executed before any of the tests or setups get executed. My Typical test looks like this. @RunWith(CustomSuiteRunner.class) @BeforeSuite(Prerequisite.class) @AfterSuite(CleanupOperations.class) @Suite.SuiteClasses({ SimpleTests.class, WeatherTests.class }) public class SimpleSuite { } I have overridden public void run(final RunNotifier notifier) to add code the required code to trigger prerequisites and cleanup operations mentioned in BeforeSuite and AfterSuite annotation. Now, I'm trying to find out how I can achieve the same by extending BlockJUnit4Runner? I can't find any method equivalent to run that starts the execution to override the behaviour. There is runChild which gets triggered before a child gets executed. The reason I'm looking for this is I'm trying created several rules in an Interface and make my tests implement that so that they will be available, however as Interface elements are static and final JUnit is ignoring these. In another Question I asked today I got answer that I can make JUnit consider rules mentioned in an Interface by extending BlockJUnit4Runner and overriding getTestRules(). So, Here is what I'm trying find out. Is it possible to extend BlockJUnit4Runner to make it take a list of tests and run them as suite and also run some code before any tests get execute and after all tests are executed? How can I extend Suite Runner to consider TestRules defined in an implemented interface?
tagged with: junit-runner
type: Question
has answer: http://stackoverflow.com/a/25132228
score: 0
has comment: http://stackoverflow.com/comment/39068295
tagged with: junit
has title: Extending from Suite Runner vs BlockJUnit4Runner while defining some TestRules
answer count: 1
type: UnansweredQuestion
tagged with: interface
tagged with: junit-rule
tagged with: java

http://stackoverflow.com/a/25115873
score: 1
answers question: http://stackoverflow.com/q/25115677
has body: You should load the the data with the Thread (ASyncTask) you should display your ProgressDialog with "onPreExecute()" update it with "onProgressUpdate()" and finish the dialog with "onPostExecute()" all of them is running on UI thread already.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/25156540
type: Answer
answers question: http://stackoverflow.com/q/25141585
has comment: http://stackoverflow.com/comment/39175336
has comment: http://stackoverflow.com/comment/39180751
accepted answer of: http://stackoverflow.com/q/25141585
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39215235
has comment: http://stackoverflow.com/comment/39180569
has body: I'm sending out data to a LED Panel using Bluetooth Communication. The documentation for the panel should tell you what encoding to use to convert your characters to bytes. If the answer is UTF-8, then you would send byte 233 then 154 then 165. If the answer is Windows code page 936, you would send byte 235 then 81. Quite possibly the answer is something else, maybe an encoding such as ASCII which does not support Chinese characters. outputStream.write(msg.getBytes()); getBytes without a parameter uses the computer's default encoding, which likely does not match the encoding the panel uses. In general you should avoid using the default encoding in Java because it varies across machines and is usually wrong. Prefer to explicitly specify an encoding, for example if it is UTF-8: outputStream.write(msg.getBytes("UTF-8"));
has comment: http://stackoverflow.com/comment/39193984
upvote count: 1
has comment: http://stackoverflow.com/comment/39212119
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39171518

http://stackoverflow.com/a/25206926
answers question: http://stackoverflow.com/q/25206863
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39257418
score: 1
has body: No you can't assume that. You have to check your database columns types and use appropriate get methods based on that e.g. getString(), getInt(), getDate() etc..

http://stackoverflow.com/comment/39142461
type: QuestionComment
has text: I'm trying the new workspace solution. and now my imports are broken; any recommendations?
type: Comment
comment on: http://stackoverflow.com/q/25085141
score: 0

http://stackoverflow.com/comment/39248977
type: Comment
type: QuestionComment
score: 1
has text: Show us the software you've written that isn't working.
comment on: http://stackoverflow.com/q/25202707

http://stackoverflow.com/a/25145950
has comment: http://stackoverflow.com/comment/39158385
score: 0
answers question: http://stackoverflow.com/q/25138957
has body: I think I did now solve the problem. Thanks to all readers and contributors. HSQLDB provides an option to disable foreign-key-checks at runtime. The SQL-statement is as follows: SET DATABASE REFERENTIAL INTEGRITY FALSE; Turning off this feature has another consequence which is also noted in the HSQLDB Docs. Hibernate doesn't keep track of the changes made at the database anymore, so without further actions incomplete results are returned for the relationships (Subselects). To fix this, EntityManager.refresh() has to be called for every object that is probably detached! I just use the in-memory database to get join-functionality, as the external service doesn't provide such a feature. I remove the entities afterwards, so it's not a big drawback for me. Happy coding!
type: Answer
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/39195298
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25173419
type: Comment
has text: `java.local.` seems unnecessary?

http://stackoverflow.com/a/25091697
has body: First of all those additional services that you're using (non-views) should be visible by Spring. The simplest way to do it is to use @Service annotation. And to make it work you can add &lt;context:component-scan base-package="your.package"&gt; in your configuration. After this, if Spring sees your service as a bean, it should be enough to use @Transactional annotation to have Hibernate session in it.
score: 0
has comment: http://stackoverflow.com/comment/39104296
has comment: http://stackoverflow.com/comment/39043134
has comment: http://stackoverflow.com/comment/39106613
type: Answer
answers question: http://stackoverflow.com/q/25090377
has comment: http://stackoverflow.com/comment/39043258

http://stackoverflow.com/a/29551851
upvote count: 18
has body: I had this problem because the project facet associated with my project was the wrong java version. To fix this is I did the following: Right click on the project and select Properties Select 'Project Facets' and change version of java to something greater than 1.4. Click [Apply] This will rebuild your project and hopefully the error will be resolved.
downvote count: 0
type: Answer
score: 18
answers question: http://stackoverflow.com/q/25222811

exception
tags question: http://stackoverflow.com/q/25087257
tags question: http://stackoverflow.com/q/25126869
tags question: http://stackoverflow.com/q/25071688
tags question: http://stackoverflow.com/q/25224018
tags question: http://stackoverflow.com/q/25117834
tags question: http://stackoverflow.com/q/25129848
tags question: http://stackoverflow.com/q/25146155
tags question: http://stackoverflow.com/q/25077997
tags question: http://stackoverflow.com/q/25221698
tags question: http://stackoverflow.com/q/25221823
tags question: http://stackoverflow.com/q/25211133
tags question: http://stackoverflow.com/q/25073728
type: Tag
tags question: http://stackoverflow.com/q/25130557
tags question: http://stackoverflow.com/q/25093242
tags question: http://stackoverflow.com/q/25104867
tags question: http://stackoverflow.com/q/25127203
tags question: http://stackoverflow.com/q/25122088
tags question: http://stackoverflow.com/q/25229717
tags question: http://stackoverflow.com/q/25106756
tags question: http://stackoverflow.com/q/25119957
tags question: http://stackoverflow.com/q/25098815
tags question: http://stackoverflow.com/q/25160584
tags question: http://stackoverflow.com/q/25104691
tags question: http://stackoverflow.com/q/25221843
tags question: http://stackoverflow.com/q/25220364
tags question: http://stackoverflow.com/q/25186653
tags question: http://stackoverflow.com/q/25223496
tags question: http://stackoverflow.com/q/25103191
tags question: http://stackoverflow.com/q/25178586
tags question: http://stackoverflow.com/q/25177819
tags question: http://stackoverflow.com/q/25125882
tag name: exception
tags question: http://stackoverflow.com/q/25194570
tags question: http://stackoverflow.com/q/25108870
tags question: http://stackoverflow.com/q/25174761
tags question: http://stackoverflow.com/q/25108665
tags question: http://stackoverflow.com/q/25094410
tags question: http://stackoverflow.com/q/25204031
tags question: http://stackoverflow.com/q/25164932
tags question: http://stackoverflow.com/q/25205201
tags question: http://stackoverflow.com/q/25111239
tags question: http://stackoverflow.com/q/25099642
tags question: http://stackoverflow.com/q/25196938

http://stackoverflow.com/comment/39044345
comment on: http://stackoverflow.com/a/25092370
score: 0
type: AnswerComment
has text: one more thing i want to ask , to make it work to start with aplhabet , is this valid regex , or i have ti put ' ^ ' in start of regex ?
type: Comment

http://stackoverflow.com/q/25155701
has comment: http://stackoverflow.com/comment/39163197
tagged with: dictionary
has comment: http://stackoverflow.com/comment/39161849
tagged with: enums
tagged with: java
has body: I've got a strange problem. I have a java class which looks like this: public class VagueDate { private static String DAY = "D"; private static String TO_YEAR = "-Y"; public enum Type { DAY(VagueDate.DAY), TO_YEAR(VagueDate.TO_YEAR); private String string; private Type(String string) { this.string = string; } public String getStringRepresentation() { return string; } } public static final Map&lt;String, Type&gt; typeMapping; static { HashMap&lt;String, Type&gt; myMap = new HashMap&lt;String, Type&gt;(); myMap.put(DAY, Type.DAY); myMap.put(TO_YEAR, Type.TO_YEAR); typeMapping = Collections.unmodifiableMap(myMap); }; private LocalDate startDate; private LocalDate endDate; private Type type; public VagueDate(LocalDate start, LocalDate end, Type type) { this.startDate = start; this.endDate = end; this.type = type; } public VagueDate(LocalDate start, LocalDate end, String dateType) { this(start, end, typeMapping.get(dateType)); } // getter, setter, etc } Everythink seems to work fine, I can create VagueDate objects with both constructors. But when I use the class in a webapp, sometimes a strange thing happens: the map typeMapping looks after some time like this: "D" -> null, "-Y" -> null . If this happen once, it stays like this. How can entries in an unmodifable map be modified? Or is it not allowed to use enums as a map value? Regards Daniel
has answer: http://stackoverflow.com/a/25155982
has title: java unmodifiableMap with enum as values "loses" values
type: Question
has comment: http://stackoverflow.com/comment/39162108
answer count: 1
has comment: http://stackoverflow.com/comment/39162001
score: 0
has comment: http://stackoverflow.com/comment/39162208
type: UnansweredQuestion

http://stackoverflow.com/q/25213686
tagged with: java
has answer: http://stackoverflow.com/a/25218043
has answer: http://stackoverflow.com/a/25213706
has body: How can i include a JSP page in another JSP with the IF structure: Can i use this part of code in a JSP file: &lt;% UtilisateurAction useraction = new UtilisateurAction(); String statut = useraction.Connect(); //System.out.println(statut); if(statut=="ADMIN"){ %&gt; &lt;%@ include file="menu.jsp"%&gt; &lt;%} else {if(statut=="USER"){%&gt; &lt;%@ include file="menu.jsp"%&gt; &lt;%}} %&gt;
has comment: http://stackoverflow.com/comment/39270284
type: Question
has answer: http://stackoverflow.com/a/25214205
has answer: http://stackoverflow.com/a/25218900
tagged with: if-statement
has comment: http://stackoverflow.com/comment/39279420
score: 0
has comment: http://stackoverflow.com/comment/39270250
has comment: http://stackoverflow.com/comment/39270380
upvote count: 1
downvote count: 1
tagged with: jsp
favorite count: 0
has title: include a JSP file in another with cases
type: UnansweredQuestion
answer count: 4

http://stackoverflow.com/comment/39098899
score: 0
has text: @IllegalArgumemt: 1000 recursions seems to be pretty typical limit for the number of recursive calls you can do before getting a stack overflow in desktop java vm, assuming that number, the maximum string size you can print is 4000*1000 chars, that's about 4 MBs. You're only safe as long as your string is below that size. Then again, printing that amount of text to logcat would probably not be a good idea in the first place.
type: Comment
comment on: http://stackoverflow.com/a/25120882
type: AnswerComment

http://stackoverflow.com/q/25073675
tagged with: spring-integration
has answer: http://stackoverflow.com/a/25080931
has body: I need to send request and receive response synchronously (in the same thread) using http-outbound-gateway in multi-threaded environment (multiple threads doing the same). I am thinking to use DirectChannel as request and response channels in http-outbound-gateway. If I do that, will the following scenario occurs: thread1 pushed request1 into channel thread1 subscribed for response using subscriber1 with context of request1 thread2 pushed resquest2 into channel thread2 subscribed for response using subsciber2 with context of request2 response2 received and processed by thread2 using subscriber1 with context of request1 Note: The request/response channels are same for both the threads. If this occurs how to resolve this problem. My requirement is, always the thread that generated the request should process the corresponding response.
type: Question
tagged with: java
score: 0
answer count: 1
has title: Channels for request-reply pattern using http-outbound-gateway
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/25207548
answer count: 1
has comment: http://stackoverflow.com/comment/39258741
has comment: http://stackoverflow.com/comment/39258846
favorite count: 0
accepted answer: http://stackoverflow.com/a/25208088
tagged with: android
has title: Android How to execute a method every x hours or minutes
type: AnsweredQuestion
has body: Im trying to run a method called Updater() with the alarm service and for testing i want it to update every 1 minutes and eventually every 2 hours. The Sceduled task excuted itself on a timer if a toggle button is on and stops the timer when the toggle button is off this is my code so far. Can someone show my what i'm doing wrong please? public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Updater(); } } public void autoUpdateClick(View view) { AlarmManager alarmManager=(AlarmManager) this.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(this,AlarmReceiver.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0); boolean on = ((ToggleButton) view).isChecked(); if (on) { alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,System.currentTimeMillis(),30000,pendingIntent); Toast.makeText(getBaseContext(),"Check-In will be done every 2 hours",Toast.LENGTH_SHORT).show(); } else { alarmManager.cancel(pendingIntent); Toast.makeText(getBaseContext(),"Manual Check-In enabled",Toast.LENGTH_SHORT).show(); } }
tagged with: java
downvote count: 1
type: Question
score: 3
linked to: http://stackoverflow.com/q/10221996
has answer: http://stackoverflow.com/a/25208088
has comment: http://stackoverflow.com/comment/39258858
duplicate of: http://stackoverflow.com/q/10221996
upvote count: 4

http://stackoverflow.com/a/25230017
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: This can be accomplished, as long as you know your subtypes you want to use in advance. (You're using the visitor pattern, so you need to know all the element types in advance, anyway.) The important thing is to build your Visitor interface from the bottom up, not the top down: public interface ElementVisitor&lt;R&gt; extends SpecificVisitor&lt;R&gt;, FancyVisitor&lt;R&gt; { } public interface Element { public &lt;R&gt; R accept(ElementVisitor&lt;R&gt; visitor); } Now Element subtypes will need a little boilerplate, so that they can implement the Element interface: public abstract class FancyElement implements Element { public abstract &lt;R&gt; R accept(FancyVisitor&lt;R&gt; visitor); public &lt;R&gt; R accept(ElementVisitor&lt;R&gt; visitor) { return accept((FancyVisitor&lt;R&gt;) visitor); } } And then we can define the specific subtype visitors and elements: public class FancyElement1 extends FancyElement { public &lt;R&gt; R accept(FancyVisitor&lt;R&gt; visitor) { return visitor.visit(this); } } public interface FancyVisitor&lt;R&gt; { public R visit(FancyElement1 e); // ... } … and repeat for SpecificVisitor. Now you can define either a FancyVisitor that can only visit FancyElements, a SpecificVisitor that can only visit SpecificElements, or an ElementVisitor that can visit all Elements.
accepted answer of: http://stackoverflow.com/q/25226014
answers question: http://stackoverflow.com/q/25226014

http://stackoverflow.com/comment/39121483
score: 1
has text: not sure why you want to do that in a thread? there are no loops/recur and you may not save much as there is some time spent in creating thread
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25133950

http://stackoverflow.com/q/25200531
has body: I emitted 2 D double array as value from mapper and tried to access that in reducer.converted back to double for getting sum of all 2D array. public static class DoubleTwoDArrayWritable extends TwoDArrayWritable { public DoubleTwoDArrayWritable () { super (DoubleWritable.class) ; } } Reducer public class ReducerSvm extends Reducer&lt;Text, DoubleTwoDArrayWritable, Text, Text&gt;{ public void reduce(Text key,Iterable&lt;DoubleTwoDArrayWritable&gt; values,Context context){ System.out.println("key------"+key.toString()); Writable [][] getArray = null; double C[][] = new double[3][1]; for (DoubleTwoDArrayWritable value : values) { getArray = value.get(); for (int i=0; i&lt;3 ; i++ ) { for (int j=0 ; j&lt;1 ; j++ ){ System.out.println("v--&gt; "+((DoubleWritable)getArray[i][j]).get()); C[i][j] = ((DoubleWritable)getArray[i][j]).get(); } } System.out.println("C array"); for (int i=0; i&lt;3 ; i++ ){ for (int j=0 ; j&lt;1 ; j++ ){ System.out.println(C[i][j]+" "); } System.out.println(""); } } I am able to get my double array in Reducer .But I hardcoded my row and values. How to get row and column count in reducer while using TwoDArrayWritable EDIT: As Balduz adviced I edited the code public void reduce(Text key,Iterable&lt;DoubleTwoDArrayWritable&gt; values,Context context){ for (DoubleTwoDArrayWritable value : values) { Writable[][] currentArray = value.get(); int rowSize = currentArray.length; int columnSize = currentArray[0].length; System.out.println("row size: "+rowSize); double[][] myArray = new double[rowSize][columnSize]; for (int i = 0; i &lt; currentArray.length; i++) { for (int j = 0; i &lt; currentArray[i].length; j++) { myArray[i][j] = ((DoubleWritable)currentArray[i][j]).get(); } } System.out.println("myArray array"); for (int i=0; i&lt;myArray.length ; i++ ){ for (int j=0 ; j&lt;myArray[0].length ; j++ ){ System.out.println(myArray[i][j]+" "); } System.out.println(""); } } } } I am able to get the rowsize correctly. But showing java.lang.ArrayIndexOutOfBound…
type: AnsweredQuestion
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25201554
tagged with: reduce
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/25201396
accepted answer: http://stackoverflow.com/a/25201554
tagged with: mapreduce
has answer: http://stackoverflow.com/a/25201396
tagged with: hadoop
has title: Row column value in TwoDArrayWritable

http://stackoverflow.com/a/47523870
answers question: http://stackoverflow.com/q/25177177
downvote count: 0
type: Answer
score: 2
has body: match(where("_id").is(rs.id)) Doesn't work in Mongo Aggregation. You have to convert rs.id to ObjectId match(where("_id").is(new ObjectId(rs.id)))
upvote count: 2

http://stackoverflow.com/comment/39296606
type: QuestionComment
has text: Thanks Buddy it is supporting jpg n png :)
comment on: http://stackoverflow.com/q/25224792
score: 0
type: Comment

http://stackoverflow.com/a/25152606
accepted answer of: http://stackoverflow.com/q/25152498
has body: You can use phonegap. PhoneGap is a free and open source framework that allows you to create mobile apps using standardized web APIs for the platforms you care about. http://phonegap.com Phonegap Doc. http://docs.phonegap.com/en/edge/guide_platforms_index.md.html How to use phonegap via comandline tools to intall phoengap and plugins. http://docs.phonegap.com/en/edge/guide_cli_index.md.html#The%20Command-Line%20Interface
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25152498

http://stackoverflow.com/comment/39284058
has text: Why do you want to do this? There are a lot of components involved.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25217504

http://stackoverflow.com/comment/39113689
has text: Look into the keywords `clone object java`.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25129557

http://stackoverflow.com/q/25111085
favorite count: 0
has comment: http://stackoverflow.com/comment/133132113
has comment: http://stackoverflow.com/comment/39079081
has body: I have an application where I need to measure how many bits of randomness an algorithm consumes. I have instrumented a subclass of Random to do this by overriding Random.next(int) to increment a counter before calling its parent's method. I have run into some issues with the implementation of the nextInt(int) method, because it will always draw 32 bits even when the range is a power of two. For other ranges there are even more problems: the method is not uniform---it only retries once for the case where the original value drawn is greater than the greatest multiple of the range lower than Integer.MAX_VALUE--- and it still uses more bits of randomness than are needed. How can I implement a better version of nextInt(int) that uses only the bare minimum number of random bits needed to determine a value within the range, while being perfectly uniform? It does not need guaranteed termination (not possible anyway), just termination with probability 1. Edit: Here is what I have so far: int nextInt(int max){ int n = Integer.numberOfTrailingZeros(max); return next(n) + nextOddInteger(max &gt;&gt; n) &lt;&lt; n; } This might not exactly be correct, but essentially this factors out all n twos from num, generates a random number with n bits, and prepends nextOddInteger(num) to the resulting bits. nextOddInteger would generate a random integer up to a number whose prime factorization contains no twos. How can I implement this part in a very randomness-efficient way?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39079169
score: 3
downvote count: 0
tagged with: java
has title: A more randomness-efficent way to generate random integers
type: Question
upvote count: 3
has answer: http://stackoverflow.com/a/25111101
linked to: http://stackoverflow.com/q/6046918
tagged with: random
answer count: 1

http://stackoverflow.com/comment/39108598
has text: The one thing I would suggest is JS is hard to read when everything is defined as `$(function (){` and nothing is a named function like `function x(){` If you had made the function that calls the Ajax and the success handler func named functions you could call them at different points rather than having to copy and paste their code twice. That might also make it easier to tell what's going on and thus fix the problem. Just a thought.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25125620

http://stackoverflow.com/q/25157153
has body: I want to read property file on Server side. I have DBConfig.java, useDBConfig.java and DBConfig.properties all placed in server package. I can't read the values from property file on Server Side. Your help is highly appreciated. public interface DBConfig extends Constants { @DefaultStringValue("host") String host(String host); @DefaultStringValue("port") String port(String port); @DefaultStringValue("username") String username(String username); @DefaultStringValue("password") String password(String password); } public void useDBConfig() { DBConfig constants = GWT.create(DBConfig.class); Window.alert(constants.host()); host = constants.host(host); port = constants.port(port); username = constants.username(username); password = constants.password(password); } property file... host=127.0.0.1 port=3306 username=root password=root Thanks in advance.
has comment: http://stackoverflow.com/comment/39170916
linked to: http://stackoverflow.com/q/22269623
answer count: 1
accepted answer: http://stackoverflow.com/a/25159118
tagged with: gwt
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39164535
score: 0
tagged with: java
has title: Can't read property file on Server side with GWT
type: Question
has answer: http://stackoverflow.com/a/25159118

http://stackoverflow.com/comment/39164646
has text: listener calls when the button is clicked and at that time the method `actionPerformed()` is called.
type: Comment
comment on: http://stackoverflow.com/a/25157063
score: 1
type: AnswerComment

http://stackoverflow.com/a/25187836
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39223806
has comment: http://stackoverflow.com/comment/39223378
has comment: http://stackoverflow.com/comment/39221857
has comment: http://stackoverflow.com/comment/39223920
has body: The error is errorText.setText(ae.toString()); You are not initializing that variable. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list); //////////////////////////////////////////////////////Solution errorText = (TextView)findViewById(R.id.yourTextView); Bundle extras = getIntent().getExtras(); if(extras!=null){ petrolPriceURL =extras.getString("URLString"); } // Get the TextView object on which to display the results response = (TextView)findViewById(R.id.title); try { // Get the data from the RSS stream as a string result = petrolPriceString(petrolPriceURL); // Do some processing of the data to get the individual parts of the RSS stream // At some point put this processing into a separate thread of execution // Display the string in the TextView object just to demonstrate this capability // This will need to be removed at some point response.setText(result); } catch(IOException ae) { // Handle error response.setText("Error"); // Add error info to log for diagnostics errorText.setText(ae.toString()); //////////This variable is not intialized. } }
type: Answer
has comment: http://stackoverflow.com/comment/39222078
has comment: http://stackoverflow.com/comment/39221465
has comment: http://stackoverflow.com/comment/39222127
accepted answer of: http://stackoverflow.com/q/25187097
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39221751
has comment: http://stackoverflow.com/comment/39222783
has comment: http://stackoverflow.com/comment/39223934
has comment: http://stackoverflow.com/comment/39224026
has comment: http://stackoverflow.com/comment/39222005
has comment: http://stackoverflow.com/comment/39221572
has comment: http://stackoverflow.com/comment/39221934
answers question: http://stackoverflow.com/q/25187097
has comment: http://stackoverflow.com/comment/39221723
has comment: http://stackoverflow.com/comment/39222462
has comment: http://stackoverflow.com/comment/39222644
has comment: http://stackoverflow.com/comment/39222736
has comment: http://stackoverflow.com/comment/39223169
has comment: http://stackoverflow.com/comment/39221704

http://stackoverflow.com/comment/39141801
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25136301
has text: My point was; If you share with us the reason you believe you need to do this, we might be able to offer a better solution.
score: 0

http://stackoverflow.com/a/25107917
has comment: http://stackoverflow.com/comment/39073915
has comment: http://stackoverflow.com/comment/39073438
has comment: http://stackoverflow.com/comment/39073361
has body: If i understand what you want, you can do this with Java 8 : for (int z = 0; z &lt; list.size() - 4; z++) System.out.println(list.subList(z, z + 4).stream().reduce((i,j) -&gt; i*j)); Edit : Since you can't use Java 8, this one doesn't use lambdas : List&lt;Integer&gt; list = Arrays.asList(1,2,3,6,9,4,2,9,7,2,8); for (int z = 0; z &lt; list.size() - 4; z++) { List&lt;Integer&gt; sublist = list.subList(z, z + 4); int prod = 1; for (int i : sublist) prod *= i; System.out.println(prod); }
has comment: http://stackoverflow.com/comment/39073299
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25107869
upvote count: 2
answers question: http://stackoverflow.com/q/25107869
type: Answer
has comment: http://stackoverflow.com/comment/39073353
has comment: http://stackoverflow.com/comment/39073210
score: 2

http://stackoverflow.com/a/25260702
type: Answer
accepted answer of: http://stackoverflow.com/q/25227125
answers question: http://stackoverflow.com/q/25227125
has comment: http://stackoverflow.com/comment/39435128
has body: You have to add progressBar.setVisibility(View.VISIBLE); in your getView() like this : @Override public View getView(int position, View convertView, ViewGroup parent) { View vi = convertView; if (convertView == null) vi = inflater.inflate(R.layout.list_row, null); ImageView imageView = (ImageView) vi.findViewById(R.id.imageView); final ProgressBar progressBar = (ProgressBar) vi.findViewById(R.id.progressBar); TextView textView = (TextView) vi.findViewById(R.id.textView); textView.setText("" + position); progressBar.setVisibility(View.VISIBLE); Picasso.with(activity.getApplicationContext()).load(imagePath).resize(100, 100).centerCrop() .into(imageView, new Callback() { @Override public void onSuccess() { progressBar.setVisibility(View.GONE); } @Override public void onError() { //error } }); return vi; } To know more details about view recycling, follow this link.
has comment: http://stackoverflow.com/comment/39434511
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/25180634
has body: I saw a Factory Method Pattern example, in which the Client class is defined as abstract class and includes an abstract method (i.e. the factory method) that is something like this: abstract createCourse(String scheduleType); So, I need to extend the abstract Client class and implement the createCourse method. Below an example that represents the Client: public abstract class CourseProvider { public Course startCourse(String scheduleType){ Course course = createCourse(scheduleType); course.setAvailability(true); return course; } abstract createCourse(String scheduleType); } Each time I want to use a different factory I have to extend it. However, I found another way for implementing this pattern, here. In that article the abstract factory method is not defined inside the client (it is not more abstract: may be abstract, but it is not required), but it is defined inside another class that represents the base class for the Factory. public abstract class AbstractCourseFactory { publicAbstractCourse createCourse(String scheduleType) { Course objCourse = this.getCourse(ScheduleType); objCourse.createCourseMaterial(); objCourse.createSchedule(); return objCourse; } public abstract Course getCourse(String scheduleType); } So each time I want define a different Factory, I just need to extend this base class, and implement the factory method. And then the Client should have a reference to the Factory base class (AbstractCourseFactory). So now my Client class should look like this: public class CourseProvider { AbstractCourseFactory factory; public CourseProvider(AbstractCourseFactory factory){ this.factory = factory; } public Course startCourse(String scheduleType){ Course course = factory.getCourse(); course.start(); } } But this implementation of the Client class (CourseProvider) seems to be a "Simple Factory Pattern". So, is the last way of implementing the Factory Method Pattern right? Which is the most correct?
has comment: http://stackoverflow.com/comment/39211539
type: UnansweredQuestion
tagged with: design-patterns
tagged with: c#
tagged with: oop
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39210981
answer count: 2
has comment: http://stackoverflow.com/comment/39211570
has answer: http://stackoverflow.com/a/25182244
has comment: http://stackoverflow.com/comment/39209698
has comment: http://stackoverflow.com/comment/39210439
tagged with: factory-pattern
has comment: http://stackoverflow.com/comment/39211224
score: 0
has comment: http://stackoverflow.com/comment/39209409
has title: Different ways of implementing Factory Method Pattern
has answer: http://stackoverflow.com/a/25181779

http://stackoverflow.com/a/25175075
has comment: http://stackoverflow.com/comment/39213648
has comment: http://stackoverflow.com/comment/39380237
has body: You can use this regex: (\w+\s*)=(\s*\d+) Working demo Check the substitution section. You can use the same approach to replace the content you want as I did using capturing group index.
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39199134
answers question: http://stackoverflow.com/q/25174420
downvote count: 0
has comment: http://stackoverflow.com/comment/39200305

http://stackoverflow.com/comment/39233481
type: Comment
score: 2
has text: It's somehow unclear how exactly are the values related. Could you replace `Value SecondValue ThirdValue` by some real data and relate the rows to each other?
comment on: http://stackoverflow.com/q/25194100
type: QuestionComment

http://stackoverflow.com/a/25510599
type: Answer
has body: I have managed to fix my problem. There was a pretty big image (1280x1024) set as a background of base layout of my app (that image was covered by other layouts all the time, so it was unnecesary, it wasn't visible). After setting background color to invisible instead of that image, problem got solved.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25076968
answers question: http://stackoverflow.com/q/25076968

http://stackoverflow.com/comment/40917505
comment on: http://stackoverflow.com/a/25232742
score: 1
type: AnswerComment
has text: updating scala plugin to the latest version fixed problem, thanks
type: Comment

http://stackoverflow.com/q/25151097
type: AnsweredQuestion
tagged with: java
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/39153921
tagged with: minecraft
answer count: 2
has answer: http://stackoverflow.com/a/28523960
has body: I have been working on grabbing html source for a client I made, so I decided that I would like to get the status of the minecraft login and session servers. There is already a website that does this, so I figured I could just grab the HTML and search through it with Java. After a test run, I noticed the output was not what I am looking for. I'm hoping to be able to achieve an output of something more like on this site. MC Status public class Status { private static Minecraft mc = Minecraft.getMinecraft(); public static void toggle(String s) { if (s.contentEquals("-status")) { Variables.status = !Variables.status; if (Variables.status) { enable(); } else { disable(); } } else { update(); } } public static void enable() { mc.thePlayer.addChatMessage(Variables.ChatTeal + "Minecraft Status enabled."); } public static void disable() { mc.thePlayer.addChatMessage(Variables.ChatTeal + "Minecraft Status disabled."); } @SuppressWarnings("unchecked") public static void update() { BufferedReader br; String line; String s; int i = 1; try { URL url = new URL("http://xpaw.ru/mcstatus/"); HttpURLConnection httpcon = (HttpURLConnection) url.openConnection(); httpcon.addRequestProperty("User-Agent", "Mozilla/4.76"); httpcon.connect(); br = new BufferedReader(new InputStreamReader((InputStream) httpcon.getContent())); Variables.statusList.clear(); while ((line = br.readLine()) != null) { if (i == 65 || i == 72 || i == 79 || i == 86 || i == 93) { s = line.replaceAll("&lt;div class=\"name\"&gt;", "").trim(); line = s.replaceAll("&lt;/div&gt;", "").trim(); Variables.statusNameList.add(line); System.out.println(line); } if (i == 66 || i == 73 || i == 80 || i == 87 || i == 94) { s = line.replaceAll("&lt;h2 class=\"status\"&gt;", "").trim(); line = s.replaceAll("â€¦&lt;/h2&gt;", "").trim(); Variables.statusList.add(line); System.out.println(line); } i++; } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25151240
tagged with: http://stackoverflow.com/tag/html
has title: Grabbing HTML source, how can I grab the HTML in the state it would be in after the page loads?
score: -2
possible better answer: http://stackoverflow.com/a/25151240
accepted answer: http://stackoverflow.com/a/28523960

http://stackoverflow.com/a/43234817
downvote count: 0
type: Answer
has body: I have discovered, it seems, that a mapped network drive is not available to IIS as it runs as a service. In addition, I have been unable to create a DSN entry with a UNC path. So, I created the DSN with a local database, then changed the path in Regedit. What a pain. Be sure to provide proper credentials (UID and PWD).
score: 1
answers question: http://stackoverflow.com/q/25222061
upvote count: 1

http://stackoverflow.com/comment/39274679
has text: We are using about the same configuration as you do, but we use spring and it works fine. I can't see how you configure the securityManager, are you sure it uses the same hash/salt settings as when you create the user?
score: 0
comment on: http://stackoverflow.com/q/25215274
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39047919
type: AnswerComment
comment on: http://stackoverflow.com/a/25093415
score: 0
type: Comment
has text: private long id; in the class Cart is the corresponding field to cart_id in the table

http://stackoverflow.com/q/25213963
has title: saving of entity in the database causes unexpected behaviors
has comment: http://stackoverflow.com/comment/39271238
type: UnansweredQuestion
score: 0
tagged with: spring
tagged with: spring-mvc
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25214439
has body: When I try persist the entity below in the database, in a application which uses spring and hibernate, in the way it's presented, I get the error object references an unsaved transient instance - save the transient instance before flushing; but if I add the value cascade = CascadeType.ALL to the annotation @OneToOne (or add the annotation @Cascade), for each attribute I don't fill it's inserted an empty record in the database. @Entity @Table(name="cliente") public class Cliente { @Id @Column(name = "id") @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; @OneToOne(fetch = FetchType.EAGER) @JoinColumn(name="usuario") @Order(value=1) private Usuario usuario; @OneToOne(fetch = FetchType.EAGER) @JoinColumn(name="pessoa_fisica") @Order(value=2) private PessoaFisica pessoaFisica; @OneToOne(fetch = FetchType.EAGER) @JoinColumn(name="pessoa_juridica") @Order(value=3) private PessoaJuridica pessoaJuridica; @OneToOne(fetch = FetchType.EAGER) @JoinColumn(name="endereco_entrega") @Order(value=4) private Endereco endereco_entrega; @OneToOne(fetch = FetchType.EAGER) @JoinColumn(name="endereco_cobranca") @Order(value=5) private Endereco endereco_cobranca; @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name="pedidos_do_cliente", joinColumns={@JoinColumn(name="fk_cliente")}, inverseJoinColumns={@JoinColumn(name="fk_pedido")}) @Order(value=6) private List&lt;Pedido&gt; pedido; } Anyone can tell me how to fix this problem? ps.: below the related method which handle this process: controller @RequestMapping(value="cadastra", method=RequestMethod.POST) @ResponseBody public String cadastra(@ModelAttribute("object") E object, BindingResult result, @RequestParam(value="file", required=false) MultipartFile file, @RequestParam(value="icone", required=false) MultipartFile icone) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, IOException { serv.cadastra(object); serv.upload_picture(object, file, "picture"); serv.upload_picture(object, ico…
type: Question
answer count: 1

http://stackoverflow.com/comment/39027526
score: 1
comment on: http://stackoverflow.com/q/25083433
type: Comment
type: QuestionComment
has text: Google "How to use Swing Timers"

http://stackoverflow.com/comment/39133468
type: Comment
has text: When i remove myfile.mkdirs(); dont create any thing.
type: AnswerComment
comment on: http://stackoverflow.com/a/25140402
score: 0

http://stackoverflow.com/q/25158751
type: Question
tagged with: layout
has comment: http://stackoverflow.com/comment/39167130
has body: As the title says, I need to manually set the popup location of the JMenuItem. jMenuItem1.getPopupLocation(null).setLocation(null); I tried the above, but I can't proceed because it gives me compile errors. I think it is with the "null" values. Please give me an answer with an example. I need to change the x coordinate ,because my "look and feel" is changing the x coordinate. IS there any help.
has comment: http://stackoverflow.com/comment/39168000
has comment: http://stackoverflow.com/comment/39167868
has comment: http://stackoverflow.com/comment/39167094
has title: How to set the JMenuItem's PopupLocation
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39168134
tagged with: swing
tagged with: jpopupmenu
score: 0
tagged with: java

http://stackoverflow.com/comment/95909458
comment on: http://stackoverflow.com/a/25072883
type: AnswerComment
score: 0
type: Comment
has text: Explore more on overloadded method of 'Gson.fromJson()'

http://stackoverflow.com/q/25163328
type: Question
tagged with: appium
has comment: http://stackoverflow.com/comment/40808497
score: 4
upvote count: 4
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/28360621
favorite count: 0
tagged with: xpath
type: UnansweredQuestion
tagged with: android
has body: An Android 4.4.4 physical smart phone device is sitting on USB tether, ADB enabled. Attempts are being made to automate a hybrid android application on this device via Appium (Java). We are experiencing trouble reconciling elemental discovery and access behavior. For example: List&lt;WebElement&gt; buttons = driver.findElements(By.xpath("//android.widget.Button[@text='Something']")); System.out.println("Found " + buttons.size() + " buttons."); for ( WebElement el : buttons ) { System.out.println(el.getAttribute("text")); } One (1) button is discovered. The button found clearly has a "text" attribute containing "Something". However, when trying to print the contents of the "text" attribute the result is empty; just a line return. Additionally, when the .click(); method is invoked, the element "clicked" is NOT the element found. In fact, according to the UI xml of the app, the element clicked isn't even an android.widget.Button. Any ideas regarding what could be causing this unexpected behavior? Thanks in advance.
tagged with: java
has title: Appium xpath attribute text

http://stackoverflow.com/q/25076696
has body: Bit of context... In my project I have one embedded for loop that outputs data whereby for each category show the item and within each item show its property so in reality the output I generated is 3 columns of data in the console (headings: Category/Item/Property) The for loop to show this data looks like this (Variables are set earlier on in the method): for... (picks up each category) for...(picks up items in category) for (String propertyName : item.getPropertyNames()) { out.println(category.getName() + "\t" + itemDesc.getName() + "\tProperty:" + propertyName); } } } The purpose of the project is to provide a more dynamic documentation of the properties of set components in the system. (The /t making it possible to separate them in to individual columns on a console and even in a file in say an excel spreadsheet should I choose to set the file on the printstream (Also at the start of this method.)) The Problem Now for the problem, after the for loops specified above I have generated another for loop separate from the data but shows the list of all the functions and operators involved in the components: //Outside the previous for loops for (Function function : Functions.allFunctions) { out.println(function.getSignature()); } What I want is to set this list as the 4th column but the positioning of the for loop and the way it is set leaves it fixed on the first column with the categories. I cant add it after property names as the functions are more generic to everything in the lists and there maybe repetitions of the functions which I am trying to avoid. Is there a way to set it as the forth column? Having trouble finding the sufficient research that specifies what I am looking for here. Hope this makes sense.
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39014845
upvote count: 0
accepted answer: http://stackoverflow.com/a/25076759
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25076759
tagged with: java
score: -1
has title: Java: showing the output of a separate for loop as an extra column shown in a console
tagged with: for-loop
answer count: 1
tagged with: println

http://stackoverflow.com/comment/39245036
has text: @CBHacking Order is not important, the important thing is that I can combine objects that have the same of any identifier.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25200245

http://stackoverflow.com/comment/39045668
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25093097
has text: @StephenC, I can't think of these many things, which is why I asked the question.

http://stackoverflow.com/a/25226029
upvote count: 2
has comment: http://stackoverflow.com/comment/39292817
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39292816
type: AcceptedAnswer
has body: Use .equals() to compare String objects. { System.out.println(s1.equals(s2)); System.out.println(s1.equals(s4)); } This is because the == operator on Object (here String) checks for same object references, for String equality you must use .equals(). The + concatenation operator is effectively compiled down from: a + b (a, b type String) to: new StringBuffer(a).append(b) (loading String in the common pool) On the other hand, in the following code: String s1 = "java"; String s2 = "ja" + "va"; // "ja" appends to "va". As the compiler optimization pass realizes // that "ja" + "va" is literal "java", it burns down the two strings into // the same literal as s1. String s3 = "ja"; String s4 = s3 + "va"; // s3 appends to "va". As the compiler cannot effectively study the literal, // It is allowed to be concatenated at run-time. This allows "java" to be // created from the heap, instead of from the common pool.
accepted answer of: http://stackoverflow.com/q/25226021
type: Answer
answers question: http://stackoverflow.com/q/25226021
has comment: http://stackoverflow.com/comment/41109479
has comment: http://stackoverflow.com/comment/39537445
has comment: http://stackoverflow.com/comment/41109571

http://stackoverflow.com/q/25074744
accepted answer: http://stackoverflow.com/a/25074904
type: Question
tagged with: ant
tagged with: java
answer count: 1
downvote count: 0
tagged with: shell
favorite count: 0
has title: ant fails unknown argument: -buildfile=build.xml
has body: This question might be a basic one but I'm not sure why I'm getting this error: Unknown argument: -buildfile=build.xml when try to run ant in shell script. I'm using: Ant-Version: 1.9.3 Os: Linux Java Version: 1.7.0_65 I'm trying to run ant in a shell script file as follows: ant -Dfile1=file1 -Dfile2=file2 -buildfile=build.xml -verbose. Thanks and regards, Vijay Reddy.
has answer: http://stackoverflow.com/a/25074904
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/a/25163119
type: Answer
has body: Hi you could have a ETL tool. extract transform load. Pentaho has free version of this. Hope it helps.
upvote count: 1
answers question: http://stackoverflow.com/q/25162967
downvote count: 1
score: 0

monads
tags question: http://stackoverflow.com/q/25218585
type: Tag
tag name: monads

http://stackoverflow.com/comment/39278501
has text: @user3789200 - If the method was static, then the lock would be on the *class object* i.e, `ExamQ32.class` , So, it is fine . If `say()` wasn't static, then you have to use one object as *lock* (check naveenjr's answer) and both threads try to access `say()` using the same lock. Whichever thread gets the lock,will execute. So output can be either `abc123` or `123abc`. Synchronizing on `this` will lock on **2** objects (each thread will lock on itself), so, the output is guaranteed.
comment on: http://stackoverflow.com/a/25217516
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25133418
has comment: http://stackoverflow.com/comment/39120702
upvote count: 5
has comment: http://stackoverflow.com/comment/39120801
downvote count: 0
has comment: http://stackoverflow.com/comment/39120575
has comment: http://stackoverflow.com/comment/39120621
answers question: http://stackoverflow.com/q/25133364
score: 5
type: Answer
has body: When you call System.out.println(values); Java will call the toString() method on values, and output the returned String. We can call toString() manually, and then modify the returned String as we would any other. As such, providing ", " doesn't appear in your list, the following should work fine: System.out.println(values.toString().replace(", ", ",");

http://stackoverflow.com/q/25186748
score: 2
downvote count: 0
type: UnansweredQuestion
type: Question
has title: How to create a folder and write a simple .txt file in that folder on Internal Storage on Android
has comment: http://stackoverflow.com/comment/39221228
tagged with: java
upvote count: 2
has body: I cant seem to get the following code to work; i've tried diffrent methods but none work, i wanna create a folder int he internal storage and a create and write to a simple .txt file within that folder. Can someone please provide a robust example of how to do it, and show me what i'm getting wrong String DataIn = PhoneNumber + "," + dataLong + "," + dataLat; FileOutputStream outputStream; String filename = "LegionData"; try { outputStream = openFileOutput(filename, Context.MODE_PRIVATE); outputStream.write(DataIn.getBytes()); outputStream.close(); } catch (Exception e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/39219948
answer count: 1
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/25187033

http://stackoverflow.com/comment/39119363
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25132734
score: 1
has text: @AlexR maybe the OP is looking for a way to auto-generate holiday reading?

android-activity
tags question: http://stackoverflow.com/q/25188156
tags question: http://stackoverflow.com/q/25121726
tags question: http://stackoverflow.com/q/25151627
tags question: http://stackoverflow.com/q/25105494
tags question: http://stackoverflow.com/q/25205813
tags question: http://stackoverflow.com/q/25126650
tags question: http://stackoverflow.com/q/25082770
tags question: http://stackoverflow.com/q/25219381
tag name: android-activity
tags question: http://stackoverflow.com/q/25109460
tags question: http://stackoverflow.com/q/25172302
tags question: http://stackoverflow.com/q/25206812
tags question: http://stackoverflow.com/q/25124188
tags question: http://stackoverflow.com/q/25171207
tags question: http://stackoverflow.com/q/25224226
tags question: http://stackoverflow.com/q/25107766
tags question: http://stackoverflow.com/q/25111867
tags question: http://stackoverflow.com/q/25156543
tags question: http://stackoverflow.com/q/25127659
tags question: http://stackoverflow.com/q/25222623
tags question: http://stackoverflow.com/q/25099291
tags question: http://stackoverflow.com/q/25199733
tags question: http://stackoverflow.com/q/25127720
tags question: http://stackoverflow.com/q/25130196
tags question: http://stackoverflow.com/q/25214926
tags question: http://stackoverflow.com/q/25195503
tags question: http://stackoverflow.com/q/25163735
tags question: http://stackoverflow.com/q/25192955
tags question: http://stackoverflow.com/q/25172654
tags question: http://stackoverflow.com/q/25213758
tags question: http://stackoverflow.com/q/25109027
tags question: http://stackoverflow.com/q/25193919
tags question: http://stackoverflow.com/q/25125333
type: Tag

http://stackoverflow.com/a/25189126
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25187749
score: 1
has body: This is what I came with (This is Visual FoxPro) (Yes, I know) *!* GENERARCHECKSUM Lparameters pString Local checksum, lnx m.checksum = 0 For m.lnx = 1 To Len(m.pString) m.checksum = m.checksum + Asc(Substr(m.pString, m.lnx, 1)) Endfor Return Chr(0x30 + Bitrshift(Bitand(m.checksum, 0xf0), 4)) + Chr(0x30 + Bitand(m.checksum, 0x0f))
downvote count: 0

filesystemwatcher
type: Tag
tags question: http://stackoverflow.com/q/25178582
tag name: filesystemwatcher

http://stackoverflow.com/comment/39016735
has text: I believe it is really obvious: you have set the source compatibility to 1.3 instead of >=1.5. Check in POM what is the `source` setting in `maven-compiler-plugin` configuration
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25077850
type: QuestionComment

http://stackoverflow.com/a/38393600
score: 0
has body: user1017413 is maybe right that you can use the documentation of the C# EWS API, but if you still looking for the documentation for that api: The API is available in Maven repository, so you can still use the Maven generated javadoc.
type: Answer
answers question: http://stackoverflow.com/q/25162623

http://stackoverflow.com/q/25198389
has title: Get class in which method of object is implemented
has comment: http://stackoverflow.com/comment/39241287
type: AnsweredQuestion
upvote count: 5
tagged with: java
type: Question
score: 5
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39241271
favorite count: 0
has answer: http://stackoverflow.com/a/25198526
has comment: http://stackoverflow.com/comment/39241240
has comment: http://stackoverflow.com/comment/39241250
has comment: http://stackoverflow.com/comment/39241379
has body: I have an object object and I'm going to call it's method toString. How do I know in what exact class this method is implemented last? For example if we have hierarchy: class A /*extends Object */{ } class B extends A{ public String toString() { return "representation"; } } class C extends B{ } class D extends C{ } and the object Object object = new SomeClass(); //(A/B/C/D/Object) then for toString() I should get Object for Object and A but B for B, C and D
accepted answer: http://stackoverflow.com/a/25198526
has comment: http://stackoverflow.com/comment/39241551
tagged with: reflection
linked to: http://stackoverflow.com/q/12934675

http://stackoverflow.com/comment/39052094
score: 0
type: Comment
type: QuestionComment
has text: @keyser yeah you are correct , I also posted another Solution as answer.
comment on: http://stackoverflow.com/q/25096634

http://stackoverflow.com/a/25189124
has body: It sounds like your ip/port is getting blocked/dropped. That's typically the case when a connection does nothing (as opposed to getting refused or failed login). Make sure your Security Group is set up properly. http://aws.amazon.com/rds/faqs/#31
has comment: http://stackoverflow.com/comment/39224514
answers question: http://stackoverflow.com/q/25188970
upvote count: 3
has comment: http://stackoverflow.com/comment/39224115
has comment: http://stackoverflow.com/comment/39224459
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25188970
has comment: http://stackoverflow.com/comment/39224376
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/39224316
has comment: http://stackoverflow.com/comment/39224488
score: 3

http://stackoverflow.com/comment/39176394
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25162902
has text: Not that I needed Wikipedia to know this. It is just one of the first results in Google and I wanted to provide some "further reading" ... :D
score: 0

http://stackoverflow.com/comment/39068177
has text: @Unihedron I mean id the initializing value is always some fixed value then it is not a problem to have a such a way. You can change it using setter later.
type: Comment
comment on: http://stackoverflow.com/a/25105342
score: 0
type: AnswerComment

http://stackoverflow.com/q/25195954
score: 0
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/39238850
has comment: http://stackoverflow.com/comment/39240005
has answer: http://stackoverflow.com/a/25196039
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39238785
has answer: http://stackoverflow.com/a/25196007
has answer: http://stackoverflow.com/a/25197821
has comment: http://stackoverflow.com/comment/39238863
has title: Adding to my TextView
possible better answer: http://stackoverflow.com/a/25196007
has comment: http://stackoverflow.com/comment/39237708
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39236779
accepted answer: http://stackoverflow.com/a/25197821
type: Question
tagged with: android
has body: so I believe I am overthinking this but I want to double check. I am getting my TextView from my EditText widget. addMileage.setOnClickListener(new OnClickListener() { @Override public void OnClick(View v) { if (isErase) { nextMileage.setText(mileageInput.getText().toString()); } else { nextMileage.setText(""); } isErase = !isErase; } How can I take what the user enters in the EditText then automatically take the number entered and + 3500. Then display in TextView?
has comment: http://stackoverflow.com/comment/39237805
tagged with: android-edittext

http://stackoverflow.com/q/25081710
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/39027733
has comment: http://stackoverflow.com/comment/39024444
has comment: http://stackoverflow.com/comment/39024127
answer count: 1
has comment: http://stackoverflow.com/comment/39024259
has comment: http://stackoverflow.com/comment/39024268
has comment: http://stackoverflow.com/comment/39024348
has comment: http://stackoverflow.com/comment/39024226
has comment: http://stackoverflow.com/comment/39023995
has comment: http://stackoverflow.com/comment/39024005
accepted answer: http://stackoverflow.com/a/25554527
has body: I am getting an OutOfMemoryError using Apache POI. I am extracting over 400,000 records from the data base to an excel sheet. Currently my eclipse.ini file looks like: -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20130521-0416 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx512m I know I have to increase my memory but I am not sure how much should I change it too. Also should I be changing it in other places too? I'm sure there are links about this so if someone could direct me, that would be great. Thanks in advance, Sonny
has title: Increasing memory to avoid OutOfMemory error
has comment: http://stackoverflow.com/comment/39024065
favorite count: 0
has comment: http://stackoverflow.com/comment/39024442
has answer: http://stackoverflow.com/a/25554527
has comment: http://stackoverflow.com/comment/39024601
tagged with: excel
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39025149
tagged with: eclipse

http://stackoverflow.com/q/25221430
has comment: http://stackoverflow.com/comment/39284736
tagged with: replaceall
favorite count: 0
has comment: http://stackoverflow.com/comment/39284689
upvote count: 2
has answer: http://stackoverflow.com/a/25221700
has answer: http://stackoverflow.com/a/25221621
has comment: http://stackoverflow.com/comment/39284631
has comment: http://stackoverflow.com/comment/39284813
tagged with: regex
downvote count: 1
type: AnsweredQuestion
has title: How to double escape double quote?
possible better answer: http://stackoverflow.com/a/25221621
score: 1
tagged with: java
has body: Say I have this String in java: This a "text". This is inches 30". And another 20\" I want to find all inches (double quotes after a number) and add a second escape for it, if it doesn't have yet. So after the change, the string would be like this, printed in console: This is a "text". This is inches 30\". And another 20\" So the regex must check if there is a number before the double quote and if there is not a escape character already... thanks!!
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25221700

http://stackoverflow.com/comment/39196380
type: Comment
comment on: http://stackoverflow.com/q/25174021
has text: "As you can see on the second line, I do it correctly". With that I meant the line: `O[ID].code.MapFile = new short[data.length / 4][4];`
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39247204
comment on: http://stackoverflow.com/q/25201482
score: 0
type: Comment
has text: EACCESS when port already in use? Try another port.
type: QuestionComment

http://stackoverflow.com/q/25107860
has comment: http://stackoverflow.com/comment/39073047
tagged with: math
tagged with: java
tagged with: partition
type: Question
has comment: http://stackoverflow.com/comment/39073303
has comment: http://stackoverflow.com/comment/39073348
has answer: http://stackoverflow.com/a/25108084
has comment: http://stackoverflow.com/comment/39073214
has answer: http://stackoverflow.com/a/27458576
has comment: http://stackoverflow.com/comment/39073148
downvote count: 0
has comment: http://stackoverflow.com/comment/39073107
possible better answer: http://stackoverflow.com/a/25108028
has body: I am working in an Authomata and need three numbers that suumed equal n For example, if n = 2 the numbers I need are: 200 020 002 110 101 011 It doesn´t matter if the combination are repeated. If n = 3 I need: 300 030 003 210 201 021 120 012 102 111 So I read thar this was similar to the partition in the theory of numbers but I can get the particular case where only 3 numbers give me the target value (n). (The code is from a example I get here) package automata2; import java.util.ArrayList; /** * * @author jaime */ public class Automata2 { /** * @param args the command line arguments */ public static void main(String[] args) { int N = 14; partition(N); } public static void partition(int n) { partition(n, n, ""); } public static void partition(int n, int max, String prefix) { if (n == 0) { System.out.println(prefix); return; } for (int i = Math.min(max, n); i &gt;= 1; i--) { partition(n-i, i, prefix + " " + i); } } } But I only need al the combinations with three digits, not all since 14 until 1 1 1 1 1 1 1 1 1 1 1 1 1 1
favorite count: 0
has answer: http://stackoverflow.com/a/25108028
accepted answer: http://stackoverflow.com/a/25108084
has title: How to find 3 numbers in all combinations possible that in a sum the result equals n?
has comment: http://stackoverflow.com/comment/39073533
has comment: http://stackoverflow.com/comment/39072972
has comment: http://stackoverflow.com/comment/39073735
has answer: http://stackoverflow.com/a/25109067
answer count: 4
has comment: http://stackoverflow.com/comment/39075166
type: AnsweredQuestion
score: 2
linked to: http://stackoverflow.com/q/25109050
upvote count: 2

http://stackoverflow.com/comment/121948683
type: AnswerComment
score: 0
has text: This is less complex code for checking armstrong number
type: Comment
comment on: http://stackoverflow.com/a/69000781

http://stackoverflow.com/a/25086807
score: 5
answers question: http://stackoverflow.com/q/25086785
upvote count: 5
downvote count: 0
type: Answer
has body: That's what map is for : List&lt;Person&gt; persons = strings.stream() .map(s -&gt; new Person(s)) .collect(Collectors.toList());

http://stackoverflow.com/comment/39261129
has text: what is an acivePage exactly? I tried to change the focused window using a robot , but it didn't work.
type: Comment
comment on: http://stackoverflow.com/a/25208232
score: 0
type: AnswerComment

http://stackoverflow.com/q/25146737
has title: How the order_updates property can avoid deadlocks in Hibernate
tagged with: java
tagged with: hibernate
has body: As per Hibernate Documentation, the details for the property hibernate.order_updates is given as follows: Forces Hibernate to order SQL updates by the primary key value of the items being updated. This will result in fewer transaction deadlocks in highly concurrent systems. e.g. true | false So by setting this property to false, how the deadlocks can occur. Please help me in understanding this.
score: 2
has answer: http://stackoverflow.com/a/25148735
downvote count: 0
type: AnsweredQuestion
favorite count: 0
accepted answer: http://stackoverflow.com/a/25148735
type: Question
upvote count: 2
answer count: 1

http://stackoverflow.com/a/46323891
has comment: http://stackoverflow.com/comment/94087100
has comment: http://stackoverflow.com/comment/106193170
has body: There are a lot of good answers, so here is mine (not work in jdk12): import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.net.HttpURLConnection; import java.net.URL; import java.util.Arrays; import java.util.LinkedHashSet; import java.util.Set; public class SupportPatch { public static void main(String... args) throws IOException { allowMethods("PATCH"); HttpURLConnection conn = (HttpURLConnection) new URL("http://example.com").openConnection(); conn.setRequestMethod("PATCH"); } private static void allowMethods(String... methods) { try { Field methodsField = HttpURLConnection.class.getDeclaredField("methods"); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(methodsField, methodsField.getModifiers() &amp; ~Modifier.FINAL); methodsField.setAccessible(true); String[] oldMethods = (String[]) methodsField.get(null); Set&lt;String&gt; methodsSet = new LinkedHashSet&lt;&gt;(Arrays.asList(oldMethods)); methodsSet.addAll(Arrays.asList(methods)); String[] newMethods = methodsSet.toArray(new String[0]); methodsField.set(null/*static field*/, newMethods); } catch (NoSuchFieldException | IllegalAccessException e) { throw new IllegalStateException(e); } } } It also uses reflection, but instead of hacking into every connection object we're hacking HttpURLConnection#methods static field which is used in the checks internally.
has comment: http://stackoverflow.com/comment/133390405
has comment: http://stackoverflow.com/comment/94083143
score: 76
has comment: http://stackoverflow.com/comment/102031860
has comment: http://stackoverflow.com/comment/102032178
has comment: http://stackoverflow.com/comment/122215875
answers question: http://stackoverflow.com/q/25163131
downvote count: 3
has comment: http://stackoverflow.com/comment/89467042
type: Answer
has comment: http://stackoverflow.com/comment/84214468
upvote count: 79

http://stackoverflow.com/a/25229894
accepted answer of: http://stackoverflow.com/q/25228178
upvote count: 7
type: Answer
has comment: http://stackoverflow.com/comment/90175456
has comment: http://stackoverflow.com/comment/83418572
downvote count: 0
has comment: http://stackoverflow.com/comment/90175425
score: 7
has comment: http://stackoverflow.com/comment/39300822
has comment: http://stackoverflow.com/comment/39301325
has comment: http://stackoverflow.com/comment/90175441
has body: When you prepare the statement, you have to use a flag. e.g. ps = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
answers question: http://stackoverflow.com/q/25228178
type: AcceptedAnswer

http://stackoverflow.com/q/25114294
has comment: http://stackoverflow.com/comment/39084949
score: 19
type: AnsweredQuestion
upvote count: 19
tagged with: enums
has answer: http://stackoverflow.com/a/25114802
tagged with: java
tagged with: hibernate
has body: I have got a working query, which I need to modify by filtering with constant enum value. Now it looks this way: public static final String venueQuery = "select distinct v from package.Venue v " + "&lt;some joins here&gt; " + "WHERE v.venueType = package.enums.VenueType.VOUCHER_PROVIDER "; Changing data this way causes org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token Column definition is like this: @Enumerated(EnumType.STRING) @Column(name = "venue_type") private VenueType venueType; Enum definition looks this way: public enum VenueType { RESTAURANT, BAR, CAFE, FUN_CLUB, VOUCHER_PROVIDER } I am sure that other parts of query works fine, because after removing it, no exceptions are thrown. Are there tricks for setting constant enum value in HQL query?
tagged with: hql
has title: constant enum value in HQL
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/25114802
answer count: 1
has comment: http://stackoverflow.com/comment/39085404
favorite count: 0

http://stackoverflow.com/comment/39015047
score: 0
type: Comment
type: QuestionComment
has text: See also http://stackoverflow.com/questions/24497765/accessing-inner-enum-in-another-class-for-testing
comment on: http://stackoverflow.com/q/25076468

http://stackoverflow.com/q/25117724
has answer: http://stackoverflow.com/a/42340397
score: 4
tagged with: java
has answer: http://stackoverflow.com/a/25117959
upvote count: 4
tagged with: httpclient
accepted answer: http://stackoverflow.com/a/25117959
type: AnsweredQuestion
downvote count: 0
tagged with: apache-commons-httpclient
favorite count: 0
has body: I am using Apache Http client for making use of ElasticSearch Rest Api, but I am always getting HTTP error code as 200. Please help Java code import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.util.Scanner; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; public class ApacheHttpClientPost { public static void main(String[] args) { String path="C:\\Tools\\ElasticSearchApi\\javadoc.txt", filecontent=""; ApacheHttpClientPost apacheHttpClientPost = new ApacheHttpClientPost(); try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost postRequest = new HttpPost("http://localhost:9200/versioneg/message/_percolate"); filecontent=apacheHttpClientPost.readFileContent(path); System.out.println(filecontent); StringEntity input = new StringEntity(filecontent); input.setContentType("application/json"); postRequest.setEntity(input); HttpResponse response = httpClient.execute(postRequest); if (response.getStatusLine().getStatusCode() != 201) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); } BufferedReader br = new BufferedReader(new InputStreamReader((response.getEntity().getContent()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { System.out.println(output); } httpClient.getConnectionManager().shutdown(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } private String readFileContent(String pathname) throws IOException { File file = new File(pathname); StringBuilder fileContents = new StringBuilder((int)file.length()); Scanner scanner = new Scanner(file); String lineSeparator = System.getProperty("line.separator"); try { while(scanner.hasNextLine())…
tagged with: apache-httpclient-4.x
type: Question
has comment: http://stackoverflow.com/comment/56642344
answer count: 2
possible better answer: http://stackoverflow.com/a/42340397
tagged with: elasticsearch
has title: How to use Elasticsearch Rest api in java?

http://stackoverflow.com/comment/39093601
comment on: http://stackoverflow.com/q/25118451
score: 0
has text: Is there any reason not to make the complexType part in `MyHeader` a named type, and maybe even move it to a seperate XSD that you import to the other ones?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39213817
type: Comment
type: QuestionComment
has text: @ljgw If I input -number one two three -letter A B C it runs, printing me the toStrings of both. If I just do -number one two three it says its missing the other enum value
comment on: http://stackoverflow.com/q/25183635
score: 0

http://stackoverflow.com/a/25091028
upvote count: 5
has comment: http://stackoverflow.com/comment/111733472
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/25089362
type: Answer
has body: If you want the phone number then use: String phNo = "(123) 456-7890".replaceAll("\\D+", ""); This regex will mark all characters that are not digits, and replace them with an empty string. The regex: \D+ Match a single character that is not a digit. \D Between one and unlimited times, as many times as possible. +

http://stackoverflow.com/comment/39127468
has text: You are using single quotes where you should be using backticks. I consider this a typographical error and vote to close these questions.
score: 0
comment on: http://stackoverflow.com/q/25137332
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/87465068
type: AnswerComment
comment on: http://stackoverflow.com/a/40049018
score: 0
type: Comment
has text: Adding threading to the mix, typically the primary thread will be the thread that is interrupted, and will be the thread that runs the signal handler. That primary thread will then need to notify the thread that is utilizing that IO channel in the case of blocking IO, waking that thread from it's sleep to continue processing the data. In the case of non-blocking IO, the primary thread signal handler will simply change the flag on the file handle and return, leaving the work to the other thread to check the file handle for available IO.

http://stackoverflow.com/comment/39255078
comment on: http://stackoverflow.com/q/25204852
score: 0
has text: Yes, sorry you are right. I skipped the setupDatabase method call.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25209166
downvote count: 0
has comment: http://stackoverflow.com/comment/39262131
score: 13
has body: You can have a superclass called Version. Version1 and Version2 extend this superclass. Then you can do as follows: Version version = null; // superclass reference if (input == 1){ version = new Version1(); // instance of subclass Version1 } else{ version = new Version2(); // instance of subclass Version2 } // Now you can use the object version. This is called Runtime Polymorphism in Java - using superclass reference to point to the sub classes. (Because of this, you don't need to know ahead of time which object will be used, as you mentioned in your question :)). Alternatively, You can also use an Interface called Version instead of the superclass Version. In this case Version1 and Version2 implement Version instead of extend it. Note: I suggest you read about Inheritance and Polymorphism in Java. Also try to clearly understand what are Interfaces, Superclasses, etc. Here is a SO link which answers the question 'when to use a superclass vs Interface'.
has comment: http://stackoverflow.com/comment/39262632
has comment: http://stackoverflow.com/comment/39262386
upvote count: 13
has comment: http://stackoverflow.com/comment/39262080
answers question: http://stackoverflow.com/q/25209100
has comment: http://stackoverflow.com/comment/39261859
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25209100
type: Answer
has comment: http://stackoverflow.com/comment/39262208
has comment: http://stackoverflow.com/comment/39261793

http://stackoverflow.com/comment/39024226
score: 0
type: Comment
type: QuestionComment
has text: @Renan what do you suggest? I have removed all of the formatting of the cells. I had disabled autocolumnsize to cut down on execution time. It just runs out of memory when writing to the actual excel file
comment on: http://stackoverflow.com/q/25081710

http://stackoverflow.com/a/25094712
type: Answer
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/25094642
upvote count: 5
has body: Java interprets 345839052304598 as an integer. In Java an Integer is 4 bytes long and therefore has a value range from –2 147 483 648 to 2 147 483 647. (your number is obviously not in that range) To make Java treat the number as a double, you must write: double d = 345839052304598D; /* or */ double d1 = 345839052304598.0; (Same goes for a long, you have to write L instead of D in that case)

http://stackoverflow.com/comment/39297144
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25218521
has text: Sorry, I fixed that. The app starts, but the timer doesn´t. Something must be still missing.

http://stackoverflow.com/q/25136103
tagged with: textfield
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39125387
upvote count: 1
tagged with: swing
downvote count: 1
tagged with: java
has body: I would like to control when a string form my textfield is empty or not. Here there's the code with a simple Swing interface: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Try{ public static void main(String[] args) { JFrame frame = new JFrame(); JPanel panel = new JPanel(); panel.setLayout(null); JTextField text = new JTextField(); JButton button = new JButton("ok"); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String get = ""; get = text.getText(); if ( get == "" ) System.out.println("Is not empty"); else System.out.println("Is empty"); } }); panel.add(text); text.setBounds(0, 0, 50, 20); panel.add(button); button.setBounds(60, 0, 50, 20); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(100,100); frame.getContentPane().add(panel); frame.setVisible(true); } } but also if you fill something in the texfield and then push the ok button, the if goes always on "is empty" ... so, the if is always false What's wrong?!
type: Question
answer count: 2
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/25136146
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/25136166
duplicate of: http://stackoverflow.com/q/513832
tagged with: listener
has title: Java TextField getText() give me a string that I can't compare

http://stackoverflow.com/comment/39011987
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25074807
has text: If he doesn't have permission to open a socket he certainly won't have permission to change the security manager.

http://stackoverflow.com/comment/39223150
type: AnswerComment
score: 0
type: Comment
has text: Sorry . i got carried away by the result but i have figured out the issue. It was not due to invalidate, but in the above code tv.SetLayoutParams was the one causing the issue. As soon as i removed it, it started working for me without invalidate as well. Not sure how that could be solving the issue but works for me. Can anyone answer how this solved the issue or else i will have to google .. :)
comment on: http://stackoverflow.com/a/25147313

http://stackoverflow.com/comment/39219948
comment on: http://stackoverflow.com/q/25186748
has text: what is the exact error you are getting?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25225201
has answer: http://stackoverflow.com/a/25225216
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: Finding total value of a given portfolio: Java
tagged with: java
downvote count: 3
type: Question
score: -1
has body: I know we are not allowed to let someone do homework questions. I did mine, I just need someone to check my java work. These are hand-written work, don't have the classes on computer: these are the APIs: https://i.sstatic.net/SRaiO.jpg https://i.sstatic.net/n9bs1.jpg The question asked to "Write a code fragment in JAVA that will determine the total value of the given Portfolio." Money totalValue = new Money(); Portfolio investments = new Portfolio(); totalValue = investments.getCash(); Not sure if this is a trick question or not, because its worth a lot of mark. but it seems straight forward. Can someone tell me if my code is right? If I disobey any rule, dont ban me just delete this :/
answer count: 1

http://stackoverflow.com/q/25191547
score: 0
tagged with: multipart
has comment: http://stackoverflow.com/comment/39231573
type: UnansweredQuestion
tagged with: apache-commons
answer count: 0
tagged with: java
has body: UPDATE: I forgot to mention that my multiple combox box is a "transfer type" selction, wherein you select multiple options from one box and I have a ">" button to transfer the selected values to another multiple combobox. The problem was the transferred values need to be highlighted before submission. It was just not natural from a user's POV having to need to highlight his selection again after transferring, so I just added a script to automatically do that when submitting the form. I have a form that is enctype="multipart/form-data". One of the elements is a multi-value SELECT combo box: &lt;select multiple name="fromBox" id="fromBox"&gt; Now in my servlet, I use the Apache Common File Upload to parse and iterate through the request. It iterates fine on the other regular form fields and I'm able to get their values, but it doesn't seem to include the multiple value combo box above. I displayed all the field names that it iterates through via the code below and the field name "fromBox" is not being listed. if (item.isFormField()) { try { System.out.println("***THE FIELD NAME: " + item.getFieldName()); ..... } Any ideas?
type: Question
has comment: http://stackoverflow.com/comment/39332285
has comment: http://stackoverflow.com/comment/39230606
has title: How to extract "Multi-value Select Combo Box" in Apache Commons File Upload?
tagged with: servlets

http://stackoverflow.com/a/25105289
score: 2
downvote count: 0
has body: You should use setJobName(String name) which sets the name of the document to be printed. printJOB.setJobName("YourPrintName");//You can specify your appName here
accepted answer of: http://stackoverflow.com/q/25105263
answers question: http://stackoverflow.com/q/25105263
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/25109222
has comment: http://stackoverflow.com/comment/39075603
possible better answer: http://stackoverflow.com/a/25109565
favorite count: 0
has comment: http://stackoverflow.com/comment/39075479
tagged with: jframe
has comment: http://stackoverflow.com/comment/39075542
has comment: http://stackoverflow.com/comment/39076980
accepted answer: http://stackoverflow.com/a/25110578
has comment: http://stackoverflow.com/comment/39075506
type: AnsweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39075623
has title: How can I set the components of my JFrame to be organized neatly instead of jammed together?
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/25110578
has comment: http://stackoverflow.com/comment/39075489
score: -2
has comment: http://stackoverflow.com/comment/39075577
has body: My credit card program uses JFrames and all the Panel/Text/Label stuff and I am having trouble with understanding Layouts. How can I modify the components of my Jframe/label to make them look something like this? (randomly pulled a form off of Google): (source: patterntap.com) Now my "form" doesn't really look anything like this, nor have I tried to make it look like this. I tried reading about Layouts and I don't really get the specifics of it. Currently my program just kinda blobs all the components on top of eachother, and if the components hit the end of the JFrame it starts a new line. So, my question is how do I orgnize my JFrame's components to look neat like the image? Here is a little snippet of my code, I can add more if need be: public CreditGraphics() { frame = new JFrame("MES Banking App"); panel = new JPanel(); label = new JLabel(); cardTypes = new String[4]; cardTypes[0] = "Visa"; cardTypes[1] = "American Express"; cardTypes[2] = "Master Card"; cardTypes[3] = ""; cardTypesDD = new JComboBox(cardTypes); cardTypesDD.setSelectedIndex(3); text = new JTextField(16); panel.add(label); panel.add(cardTypesDD); panel.add(text); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel.setPreferredSize(new Dimension(500, 500)); frame.getContentPane().add(panel); frame.pack(); frame.setVisible(true); label.setText(" Please enter your credit card 'Master Card' 'Visa' or 'American Express' ");
has comment: http://stackoverflow.com/comment/39075656
has answer: http://stackoverflow.com/a/25109565
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/39075518
tagged with: layout

http://stackoverflow.com/comment/39219412
type: Comment
type: QuestionComment
has text: The issue is not that you do not have enough memory, the issue "GC overhead limit exceeded" means that the garbage collection is taking too long.
comment on: http://stackoverflow.com/q/25184911
score: 0

httpsurlconnection
type: Tag
tags question: http://stackoverflow.com/q/25119207
tags question: http://stackoverflow.com/q/25199257
tags question: http://stackoverflow.com/q/25207268
tag name: httpsurlconnection

http://stackoverflow.com/comment/39278304
has text: Sorry I think I misunderstood your question. Did you mean you wanted to be able to trigger the scheduling in your program? The answer I have below doesn't do that.
score: 0
comment on: http://stackoverflow.com/q/25217504
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39133069
has text: use this: view.setOnClickListener(this)
score: 0
comment on: http://stackoverflow.com/q/25140203
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25107490
score: 1
upvote count: 1
has body: Instead of reading your file twice to get the line count (which is slow, annoying, and will not work if the file changes between the two calls), read the lines into a variable-sized list: private void readAndProcessWords() { try { FileReader _fr = new FileReader(FILEPATH); BufferedReader textReader = new BufferedReader(_fr); List&lt;String&gt; words = new ArrayList&lt;&gt;(); String line; while ((line = textReader.readLine()) != null) { words.add(line); } textReader.close(); for (String word : words) { System.out.println(word); } } catch (IOException e) { throw new RuntimeException(e); } } Good news: this functionality already exists, so you don't need to rewrite it. private void readAndProcessWords() { try { List&lt;String&gt; words = Files.readAllLines(Paths.get(FILEPATH)); for (String word : words) { System.out.println(word); } } catch (IOException e) { throw new RuntimeException(e); } }
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25107335

http://stackoverflow.com/comment/73615622
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25222294
has text: @Carla Stabile what if I need to pass string to do Join for multiple tables having same string as field.

http://stackoverflow.com/q/25104536
accepted answer: http://stackoverflow.com/a/25104846
has comment: http://stackoverflow.com/comment/39068568
tagged with: text
type: AnsweredQuestion
tagged with: file
has comment: http://stackoverflow.com/comment/39067465
has title: Deleting a set of data in text file
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/25104846
has body: I'm creating a program in Java(GUI) that when you fill out the TextFields and click enter; the name,age,email,nationality and cell number will be saved in a textfile named StoredInfo.txt . The program I created didn't delete the data you entered if you fill out the textfields again. What I want want to do is to use the Clear Data button I created and it will delete all the data stored in the text file (StoredInfo.txt). Here's my program: import java.util.*; import java.io.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class SignUp extends JFrame implements ActionListener { //Variables private JButton enter,clear; private JLabel header,name,age,email,nationality,cellno; private JTextField nameTF,ageTF,emailTF,nationalityTF,cellnoTF; private Container container; private PrintWriter pwriter; //Constructor public SignUp() { setTitle("Form"); setSize(500,500); setResizable(false); setDefaultCloseOperation(this.EXIT_ON_CLOSE); setLocationRelativeTo(null); setLayout(null); container = this.getContentPane(); container.setBackground(Color.GRAY); enter = new JButton("Enter"); clear = new JButton("Clear Data"); header = new JLabel("Form"); name = new JLabel("Name: "); age = new JLabel("Age: "); email = new JLabel("Email Address: "); nationality = new JLabel("Nationality: "); cellno = new JLabel("Cellphone #: "); nameTF = new JTextField(20); ageTF = new JTextField(20); emailTF = new JTextField(20); nationalityTF = new JTextField(20); cellnoTF = new JTextField(20); nameTF.addActionListener(this); ageTF.addActionListener(this); emailTF.addActionListener(this); nationalityTF.addActionListener(this); cellnoTF.addActionListener(this); enter.addActionListener(this); clear.addActionListener(this); //Add section this.add(header); this.add(name); this.add(age); this.add(email); this.add(nationality); this.add(cellno); this.add(header); this.add(nameTF); this.add(ageTF); this.add(emailTF); this.add(nationalityTF); this.add(cellnoTF); this.add(clear); this.add…
tagged with: java
score: 0
tagged with: user-interface
answer count: 1

http://stackoverflow.com/q/25087983
has comment: http://stackoverflow.com/comment/39037129
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/39037253
score: 1
tagged with: java
type: Question
has body: I hope you can help me with something that is driving me crazy I have this simple Json here: {"2":{"picture":"0","id":52,"bought_date":"2014-08-01","mileage":0,"bike_id":21861,"hours":0,"name":"YZ450F","pictures":"","year":2013,"user_id":34,"cost":8000},"1":{"picture":"140","id":51,"bought_date":"2014-07-28","mileage":0,"bike_id":21130,"hours":0,"name":"Yamaha WR450F 2013","pictures":"","year":2013,"user_id":34,"cost":0},"0":{"picture":"0","id":53,"bought_date":"2014-08-01","mileage":0,"bike_id":18310,"hours":0,"name":"MX 300","pictures":"","year":2011,"user_id":34,"cost":0}} I'm sending this JSONObject to Display_Bikes() which should iterate each element of the JSONObject and then pick every id value in order to fire another method in pseudo code it would look like this foreach Json as bike{ get bike.id then call anothermethod(bike.id) } In the reality I have no idea what I'm doing wrong, it's my fourth day with Java so it's understandable, but I'm really frustrated this is the childish method I'm working on, any help would be greatly appreciated: public static void Display_Bikes(JSONObject Bikes){ Log.v("Bikes", Bikes.toString()); Iterator&lt;String&gt; iter = Bikes.keys(); while (iter.hasNext()) { String key = iter.next(); try { Object Bike = Bikes.get(key).toString(); Log.v("Bike", Bike.toString()); //Now, how to get Bike.id? } catch(JSONException e){ //error } } }
has comment: http://stackoverflow.com/comment/39036862
has title: Iterate multidimensional JSONObject and get a specific value of inner object
upvote count: 1
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/39036542
favorite count: 0
has answer: http://stackoverflow.com/a/25088427
accepted answer: http://stackoverflow.com/a/25088427

http://stackoverflow.com/a/25253920
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25148584
answers question: http://stackoverflow.com/q/25148584
has body: It turns out that i had to DELETE my temporary internet files from IE. After the delete, everything worked fine. Thank you again for all your help!

http://stackoverflow.com/comment/39212952
type: QuestionComment
has text: your last idea works. Well, at least the exception is gone. It's not working anyway but I think that would be another question. So what does your line do? Is it something similar to `org.osgi.framework.syste.packages.extra=com.sun.xml.internal.bind` ?
comment on: http://stackoverflow.com/q/25178582
score: 0
type: Comment

http://stackoverflow.com/comment/39297618
type: QuestionComment
comment on: http://stackoverflow.com/q/25228505
type: Comment
has text: Not worked,still same error.
score: 0

http://stackoverflow.com/comment/39124345
comment on: http://stackoverflow.com/a/25135100
score: 0
type: AnswerComment
has text: where I insert it in the provider for authentication?
type: Comment

http://stackoverflow.com/comment/39243501
has text: 3 MB might be anything, like some good compressable image like an imported .bmp bitmap. Rename the xlsx as .zip and check manually. `getCompressedSize()` is the portion added to the .xlsx. What is the entry name?
comment on: http://stackoverflow.com/q/25199520
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25192561
has answer: http://stackoverflow.com/a/25192600
tagged with: singleton
has comment: http://stackoverflow.com/comment/39230915
favorite count: 0
has title: When is a static nested class (and static members therein) loaded into memory?
linked to: http://stackoverflow.com/q/70324
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25192600
has comment: http://stackoverflow.com/comment/39230604
tagged with: java
accepted answer: http://stackoverflow.com/a/25192602
linked to: http://stackoverflow.com/q/20468856
has body: Here, I was trying to implement a singleton class for my Database connectivity using the inner static helper class : package com.myapp.modellayer; public class DatabaseConnection { private DatabaseConnection() { //JDBC code... } private static class ConnectionHelper { // Instantiating the outer class private static final DatabaseConnection INSTANCE = new DatabaseConnection(); } public static DatabaseConnection getInstance() { return ConnectionHelper.INSTANCE; } } However, my doubt is when does this static inner class, ConnectionHelper, gets loaded in to the JVM memory: At time when DatabaseConnection class gets loaded, or At a time when getInstance() method is called ?
score: 12
type: Question
tagged with: nested-class
answer count: 2
upvote count: 12
downvote count: 0
has answer: http://stackoverflow.com/a/25192602
tagged with: static-members
has comment: http://stackoverflow.com/comment/39230781

http://stackoverflow.com/a/25097400
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25097378
answers question: http://stackoverflow.com/q/25097378
has body: UNIX timestamp should be in milliseconds so multiply the Long value by 1000. So your value 1386889262 would be 1386889262000:
type: Answer
upvote count: 3

http://stackoverflow.com/a/25154077
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: Consider List&lt;String&gt; allWords = new ArrayList&lt;&gt;(); allWords.add("Book"); allWords.add("Pen"); allWords.add("Pencil") ; If you can able to Split your Subset into three different lists instead of a single arrayList, Do split Like list1 [Book,Pen] list2 [Book,Pencil] list3 [Pen,Pencil] You can follow this without doing loops Set&lt;String&gt; results1 = new HashSet&lt;String&gt;(allWords); results1.removeAll(list1); System.out.println("result1 : "+ list1 +" ===&gt; "+ results1); Set&lt;String&gt; results2 = new HashSet&lt;String&gt;(allWords); results2.removeAll(list2); System.out.println("result2 : "+ list2 +" ===&gt; "+ results2); Set&lt;String&gt; results3 = new HashSet&lt;String&gt;(allWords); results3.removeAll(list3); System.out.println("result3 : "+ list3 +" ===&gt; "+ results3); Output result1 : [Book, Pen] ===&gt; [Pencil] result2 : [Book, Pencil] ===&gt; [Pen] result3 : [Pen, Pencil] ===&gt; [Book] Hope this helps
accepted answer of: http://stackoverflow.com/q/25153208
score: 1
answers question: http://stackoverflow.com/q/25153208

http://stackoverflow.com/comment/39127586
has text: why downvote,please give a reason before downvote(whoever did it)?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25136412
type: Comment

http://stackoverflow.com/a/25129571
accepted answer of: http://stackoverflow.com/q/25124139
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25124139
type: Answer
score: 1
has body: Set cell color: https://developers.google.com/apps-script/reference/spreadsheet/range#setBackground(String) google-apps-script (JavaScript) is the only option as far as I know. It can't be done with the spreadsheet-API (gdata)
has comment: http://stackoverflow.com/comment/138520770
upvote count: 1

import
type: Tag
tag name: import
tags question: http://stackoverflow.com/q/25145672
tags question: http://stackoverflow.com/q/25156831
tags question: http://stackoverflow.com/q/25070975
tags question: http://stackoverflow.com/q/25129781
tags question: http://stackoverflow.com/q/25193973
tags question: http://stackoverflow.com/q/25200052
tags question: http://stackoverflow.com/q/25124767
tags question: http://stackoverflow.com/q/25202223
tags question: http://stackoverflow.com/q/25090933

http://stackoverflow.com/comment/39104024
type: Comment
comment on: http://stackoverflow.com/a/25124241
score: 0
type: AnswerComment
has text: An invisible button doesnt work when clicked..What actually do you need???Can you please specify it clearly..

http://stackoverflow.com/q/25072867
has answer: http://stackoverflow.com/a/25072973
accepted answer: http://stackoverflow.com/a/25072935
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25072932
possible better answer: http://stackoverflow.com/a/25072901
tagged with: if-statement
has title: Java simple calculator, understanding switch and method compatibility
tagged with: java
has answer: http://stackoverflow.com/a/25072901
tagged with: methods
tagged with: switch-statement
type: Question
has answer: http://stackoverflow.com/a/25072935
score: 0
has body: I have an assignment in my summer class to make a simple calculator and I'm having trouble with a couple things. There is a menu in the beginning that asks what the user would like to do and one of the options is quit and one of the options is to square the user input. The problem I'm having is I couldn't figure out a way to exit the program with the switch so I took it out of the switch and made a conditional and thats working. So, I guess that's not a big deal unless someone would like to show me how I would've included it in the switch. The problem I'm having now is squaring the user input. The problem is the program asks the user for what they'd like to do then asks them to input two operands. However, I only want it to ask for the one operand. So, I put it in the conditional and it only asks for the one operand but it no longer seems to be working with the method for square and computing the results. Any help is greatly appreciated!! import java.util.Scanner; public class Driver { public static void main(String[] args) { Menu m = new Menu(); m.getMenu(); } } class Menu { public void getMenu() { Scanner scan = new Scanner(System.in); System.out.println("Welcome to 00 Calculator menu, this calculator has the following options:"); System.out.println("1 - Add " + "\n" + "2 - Subtract" + "\n" + "3 - Multiply" + "\n" + "4 - Divide" + "\n" + "5 - Square" + "\n" + "6 - Modulus" + "\n" + "0 - Quit" ); int optionInt = scan.nextInt(); if (optionInt == 0) { System.out.println("Goodbye!"); return; }else if (optionInt == 5) { System.out.println("Enter the first number :"); double num1 = scan.nextDouble(); }else { System.out.println("Enter the first number :"); double num1 = scan.nextDouble(); System.out.println("Enter the second number :"); double num2 = scan.nextDouble(); double result; Action option = new Action(); switch (optionInt) { case 1: result = option.addValues(num1, num2); option.displayResult(result); break; case 2: result = option.subtractValues(num1, num2); opt…

http://stackoverflow.com/q/25083804
answer count: 1
has answer: http://stackoverflow.com/a/25083892
score: 0
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/25083892
has body: I have XML similar to this contained in a Document object (org.w3c.dom.Document) in my code: <?xml version="1.0" encoding="UTF-8"?> 13 I would like to be able to access each key node and print out its value, and be able to print out each value with its corresponding keyname I have never worked with XML using keyname before, how do I access these values?
type: AnsweredQuestion
has title: Accessing values using XML keyname
tagged with: java
type: Question
tagged with: xml-parsing

http://stackoverflow.com/q/25108234
linked to: http://stackoverflow.com/q/2056221
score: 0
answer count: 3
tagged with: file-io
has title: Trying to use Java file.getAbsolutePath() to get the absolute path of a file
has body: I'm working on a simple project, and i'm trying to get the absolute path of a file. This is what i'm trying: String s = "file.txt"; System.out.println(new File(s).getAbsoluteFile().getAbsolutePath()); The output is: C:\Users\Marcello\Desktop\Java Workspace\Simple Project\file.txt Where "Simple Project" is the name of the project where the code is. But the output should be: C:\Users\Marcello\Desktop\file.txt That is where i created the .txt file. I also tryed with file.getCanonicalFile() and "file.getCanonicalPath()". And i've had the same issue. In this project i'm using a text file, but i want it to work with folders too. So if someone knows a solution also for folder, i'd like to see it. Sorry for my english but it's not my mother-tongue, thanks in advance. EDITED: I think the absolute path should be: C:\Users\Marcello\Desktop\file.txt Because i created the .txt file by right-clicking on the desktop.... Here is a screenshot of my desktop:
has answer: http://stackoverflow.com/a/25108408
accepted answer: http://stackoverflow.com/a/25109371
possible better answer: http://stackoverflow.com/a/25108408
type: AnsweredQuestion
tagged with: java
tagged with: file
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39073708
type: Question
has answer: http://stackoverflow.com/a/27199152
has answer: http://stackoverflow.com/a/25109371
has comment: http://stackoverflow.com/comment/39073674

http://stackoverflow.com/q/25150750
tagged with: android-support-library
linked to: http://stackoverflow.com/q/6503189
has comment: http://stackoverflow.com/comment/39153318
accepted answer: http://stackoverflow.com/a/25167887
type: AnsweredQuestion
tagged with: android-layout
tagged with: android-fragments
tagged with: java
type: Question
answer count: 1
has body: What I am trying to do Create a ListFragment (that will be inside a ViewPager) that will replace itself with a new ListFragment containing new data based off of the click position of the previous list. The issue I am running into After onListItemClick, the screen does not display anything. I considered just clearing the ListAdapter instead of initializing multiple ListFragments, but I want to retain backStack (I do not know how I would retain backStack without Fragment Transactions) MainActivity.java import android.os.Bundle; 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; public class MainActivity extends FragmentActivity { private ViewPager mPager; private MainPagerAdapter mPagerAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mPagerAdapter = new MainPagerAdapter(this.getSupportFragmentManager()); mPager = (ViewPager) this.findViewById(R.id.fragment_container); mPager.setAdapter(mPagerAdapter); } private class MainPagerAdapter extends FragmentPagerAdapter { public MainPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { return new MyListFragment(); //Simplified for the post } @Override public int getCount() { return 1; //Simplified for the post } } } MyListFragment.java import java.util.ArrayList; import android.os.Bundle; import android.support.v4.app.ListFragment; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; public class MyListFragment extends ListFragment { private ArrayList&lt;String&gt; titles; public MyListFragment() { titles = new ArrayList&lt;String&gt;(); titles.add("one");titles.add("two");titles.add("three"); } public MyListFragment(ArrayList&lt;String&gt; titles) { this.titles = titles…
has comment: http://stackoverflow.com/comment/39153080
score: 0
has title: ListFragment displays empty screen after Transaction when in ViewPager
tagged with: android
has answer: http://stackoverflow.com/a/25167887

http://stackoverflow.com/comment/39289419
type: AnswerComment
score: 1
type: Comment
has text: @mac that is an over simplification. Making a field final doesn't make the object referenced immutable, not does having an immutable object guaranteed thread safety. However, most developer use thread safe means of passing data between threads, e.g. a thread safe collection such as a BlockingQueue, and using this ensures a thread safe view of the object whether `final` is used or not.
comment on: http://stackoverflow.com/a/25224075

picasso
tags question: http://stackoverflow.com/q/25110279
type: Tag
tags question: http://stackoverflow.com/q/25116411
tags question: http://stackoverflow.com/q/25225327
tags question: http://stackoverflow.com/q/25227125
tag name: picasso
tags question: http://stackoverflow.com/q/25218853

http://stackoverflow.com/comment/39293036
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25218042
has text: but if do `ArrayList<Employee> employeeList = new ArrayList(p.getEmployeeList());` and call `System.out.println(employeeList.size());` , `employeeList.stream().forEach((Employee e) -> System.out.println(e.getType()));` and `employeeList.stream().anyMatch(emp-> (emp.getType()==EmployeeType.AUDITOR));//returns true` it returns the correct value.

http://stackoverflow.com/a/78382485
type: Answer
answers question: http://stackoverflow.com/q/25222061
score: 0
has body: This is only for Windows hosting setup: I was doing this with Windows Server using Plesk and after going through some trouble getting the path right, i finally managed to do it. So, basically, go to your file folder system and get the entire path of your database and put it in the database path like this: C:\inetpub\vhosts\websitefolder\subdomain.domain.com\DataFolder\databasename.mdb I had hoped there is a way to shorten it like this ~\Datafolder\databasename.mdb but I wasn't successful. So I will use the one that works for me for now. I am also still curious why I couldn't use .accdb...? Also not that the correct Access Database Engine should be installed in your server

http://stackoverflow.com/comment/39147347
score: 0
comment on: http://stackoverflow.com/q/25147565
type: Comment
type: QuestionComment
has text: Recursion with respect to what? Also, writing a custom writeObject method with guaranteed no recursion in that method does not change anything.

http://stackoverflow.com/comment/39007096
type: QuestionComment
comment on: http://stackoverflow.com/q/25072595
score: 1
has text: Take a look at [Working with Manifest Files](http://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html), you need to specify a `class-path` and `main-class` entry for it
type: Comment

http://stackoverflow.com/comment/39212617
type: QuestionComment
comment on: http://stackoverflow.com/q/25173208
score: 1
has text: This has been already answered for the question [What JVM synchronization practices can I ignore assuming I know I will run on x64 cpus?](http://stackoverflow.com/a/24973890/2711488)
type: Comment

http://stackoverflow.com/q/25105153
has answer: http://stackoverflow.com/a/25105439
accepted answer: http://stackoverflow.com/a/25105439
has title: How to get message using websocket?
type: AnsweredQuestion
tagged with: spring-websocket
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: websocket
has body: I am using websocket. I want to send "message" to server. ex) at Client function do_sync() { stompClient.send("/action/test", {}, "message"); } but i don't know how to get "message" at Controller. @MessageMapping("/test") public void sync() throws Exception { String message = ex) message from client. } how get message at Controller?

cryptography
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/25208799
tags question: http://stackoverflow.com/q/25181029
tags question: http://stackoverflow.com/q/25197158
tags question: http://stackoverflow.com/q/25128256
tags question: http://stackoverflow.com/q/25193635
tags question: http://stackoverflow.com/q/25220101
tags question: http://stackoverflow.com/q/25118863
tags question: http://stackoverflow.com/q/25220492
tags question: http://stackoverflow.com/q/25105305

http://stackoverflow.com/comment/39217395
type: QuestionComment
has text: But they will fail in hashmap because Objects equals method will do reference equality check not the content equality.
comment on: http://stackoverflow.com/q/25185679
score: 0
type: Comment

http://stackoverflow.com/comment/39259317
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25207802
type: QuestionComment
has text: could you edit with a question (...?) It will force the crux of your problem to come to light. I'm a bit in the open as to what you want. thx.

http://stackoverflow.com/a/42707723
upvote count: 4
score: 2
has comment: http://stackoverflow.com/comment/139885724
downvote count: 2
answers question: http://stackoverflow.com/q/25163131
has comment: http://stackoverflow.com/comment/92264957
type: Answer
has body: Using the answer: HttpURLConnection Invalid HTTP method: PATCH I'm created a sample request and work like a charm: public void request(String requestURL, String authorization, JsonObject json) { try { URL url = new URL(requestURL); httpConn = (HttpURLConnection) url.openConnection(); httpConn.setRequestMethod("POST"); httpConn.setRequestProperty("X-HTTP-Method-Override", "PATCH"); httpConn.setRequestProperty("Content-Type", "application/json"); httpConn.setRequestProperty("Authorization", authorization); httpConn.setRequestProperty("charset", "utf-8"); DataOutputStream wr = new DataOutputStream(httpConn.getOutputStream()); wr.writeBytes(json.toString()); wr.flush(); wr.close(); httpConn.connect(); String response = finish(); if (response != null &amp;&amp; !response.equals("")) { created = true; } } catch (Exception e) { e.printStackTrace(); } } public String finish() throws IOException { String response = ""; int status = httpConn.getResponseCode(); if (status == HttpURLConnection.HTTP_OK || status == HttpURLConnection.HTTP_CREATED) { BufferedReader reader = new BufferedReader(new InputStreamReader( httpConn.getInputStream())); String line = null; while ((line = reader.readLine()) != null) { response += line; } reader.close(); httpConn.disconnect(); } else { throw new IOException("Server returned non-OK status: " + status); } return response; } I hope it help you.

http://stackoverflow.com/comment/39188373
type: Comment
has text: Messed situation about symbolic links and shortcuts
comment on: http://stackoverflow.com/a/25169378
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39104210
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25124385
has text: how can i get the stackstrace?
score: 0

http://stackoverflow.com/comment/39271276
has text: Even after changing the code, I still get the same error. Eclipse opens ViewRootImpl.java and there is an instruction pointer here @Override public boolean canResolveTextAlignment() { return true; }
comment on: http://stackoverflow.com/a/25213785
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39150715
score: 0
type: AnswerComment
has text: Thread.sleep is working because it changed to the final Icon. Posted a runnable code just now
type: Comment
comment on: http://stackoverflow.com/a/25143726

http://stackoverflow.com/a/25176520
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25176449
answers question: http://stackoverflow.com/q/25176449
has body: If I change this String pattern = "%%s%%0%dd%%s"; // &lt;-- THIS SHOULD BE FIXED to this String pattern = "%%s%%d%%s"; I get the output aaaa[0] aaaa[1] aaaa[2] aaaa[3] aaaa[4] aaaa[5] aaaa[6] aaaa[7] aaaa[8] aaaa[9] aaaa[10] aaaa[11]
upvote count: 1

http://stackoverflow.com/q/25204019
tagged with: orm
tagged with: jboss
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/30183918
has title: How to use the pooled-lo optimizer with Hibernate
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25324107
tagged with: optimization
score: 8
favorite count: 0
has body: I have a JBoss 7.1.1 running an EAR that uses the JPA. With the JPA annotation, I use the strategy GenerationType.Table which is mapped to the org.hibernate.id.enhanced.TableGenerator. Does anyone know how to configure the persistence.xml when using the "pooled-lo" optimizer?
type: UnansweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/39164845
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25139716
has text: see private Layer target; and where it is set
score: 0

http://stackoverflow.com/a/25166056
type: Answer
accepted answer of: http://stackoverflow.com/q/25165047
answers question: http://stackoverflow.com/q/25165047
has comment: http://stackoverflow.com/comment/39185763
has comment: http://stackoverflow.com/comment/39181660
has comment: http://stackoverflow.com/comment/39181375
has comment: http://stackoverflow.com/comment/39181393
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39181832
has body: You don't use if(session==null) to determine if someone is logged in. Sessions are generally created automatically, and besides, you might want to use a session for something even before login. You check for a specific session attribute. String userid = (String)session.getAttribute("userid"); if(userid!=null) { out.print("logged in as:" + userid); } Of course in the login code you have to set it: session.setAttribute("userid", userid); There is also no need to call request.getSession in JSP. In a servlet you would need to, but in JSP the session object is already populated with request.getSession for you. Edit: When you do the session=false directive then the session object isn't declared so you'll need not just to set it but actually declare it: HttpSession session = request.getSession(false); Then you will get session=null, but its dangerous to rely on this for security, as going to a page where you didn't set session=false will create the session, and your code will then think someone was validly logged in, when they were not. Even if you are certain that you put session=false everywhere, you might miss a spot, or more likely, the next developer after you will not understand you did it this way, and a security disaster is just waiting to happen. Using session=false is intended for performance boost not security. E.g. you have a faq page that doesn't care about sessions, set session=false so people going to that link doesn't create sessions and waste memory.
has comment: http://stackoverflow.com/comment/39181862
has comment: http://stackoverflow.com/comment/39198899

http://stackoverflow.com/a/71352083
has body: My 100% JavaScript solution with O(N) time complexity (should be pretty self-explanatory): function solution(A) { let left = 0; let right = A.reduce((sum, cur) =&gt; sum + cur, 0); let min = Infinity; for (let p = 0, len = A.length - 1; p &lt; len; p++) { left += A[p]; right -= A[p]; min = Math.min(min, Math.abs(left - right)); } return min; }
score: 0
answers question: http://stackoverflow.com/q/25198726
type: Answer

http://stackoverflow.com/comment/39226931
comment on: http://stackoverflow.com/a/25190174
type: Comment
has text: I tried `for(String x : bean.getTelefones()){ System.out.println(x); }` and same exception is return
type: AnswerComment
score: 0

http://stackoverflow.com/q/25078527
tagged with: bluej
has title: Boolean line error
has comment: http://stackoverflow.com/comment/39017783
downvote count: 4
has answer: http://stackoverflow.com/a/25078816
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39017932
has body: So basically, I had to write a little java programm that assigns student scores. It works fine, I can enter H (Higher) grades fine, but when I choose S(standart) it throws me back to the editor and I just don't udnerstand whats wrong. boolean isHigher = getInput().charAt(0) == 'H' || getInput().charAt(0) == 'h';
has comment: http://stackoverflow.com/comment/39017817
has comment: http://stackoverflow.com/comment/39017747
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25078816
score: -4
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/39017680

mysql
tags question: http://stackoverflow.com/q/25117501
tags question: http://stackoverflow.com/q/25071068
tags question: http://stackoverflow.com/q/25218086
tags question: http://stackoverflow.com/q/25094459
tags question: http://stackoverflow.com/q/25209532
tags question: http://stackoverflow.com/q/25128457
tags question: http://stackoverflow.com/q/25109576
tags question: http://stackoverflow.com/q/25163488
tags question: http://stackoverflow.com/q/25190342
tags question: http://stackoverflow.com/q/25138039
tags question: http://stackoverflow.com/q/25075997
tags question: http://stackoverflow.com/q/25114994
tags question: http://stackoverflow.com/q/25123373
tags question: http://stackoverflow.com/q/25105345
tag name: mysql
tags question: http://stackoverflow.com/q/25102726
tags question: http://stackoverflow.com/q/25092695
tags question: http://stackoverflow.com/q/25225503
tags question: http://stackoverflow.com/q/25095192
tags question: http://stackoverflow.com/q/25115053
tags question: http://stackoverflow.com/q/25211094
tags question: http://stackoverflow.com/q/25096209
tags question: http://stackoverflow.com/q/25095507
tags question: http://stackoverflow.com/q/25077665
tags question: http://stackoverflow.com/q/25196926
tags question: http://stackoverflow.com/q/25163252
tags question: http://stackoverflow.com/q/25152110
tags question: http://stackoverflow.com/q/25077654
tags question: http://stackoverflow.com/q/25157895
tags question: http://stackoverflow.com/q/25184571
tags question: http://stackoverflow.com/q/25110419
tags question: http://stackoverflow.com/q/25208324
tags question: http://stackoverflow.com/q/25075281
tags question: http://stackoverflow.com/q/25183948
tags question: http://stackoverflow.com/q/25083550
tags question: http://stackoverflow.com/q/25165049
tags question: http://stackoverflow.com/q/25131303
tags question: http://stackoverflow.com/q/25221542
tags question: http://stackoverflow.com/q/25075145
tags question: http://stackoverflow.com/q/25189026
tags question: http://stackoverflow.com/q/25188108
tags question: http://stackoverflow.com/q/25077004
tags question: http://stackoverflow.com/q/25222020
tags question: http://stackoverflow.com/q/25115733
tags question: http://stackoverflow.com/q/25075054
tags question: http://stackoverflow.com/q/25196522
tags question: http://stackoverflow.com/q/25132986
tags question: http://stackoverflow.com/q/25195586
tags question: http://stackoverflow.com/q/25111116
tags question: http://stackoverflow.com/q/25145716
tags question: http://stackoverflow.com/q/25191664
tags question: http://stackoverflow.com/q/25102397
tags question: http://stackoverflow.com/q/25158746
tags question: http://stackoverflow.com/q/25224852
tags question: http://stackoverflow.com/q/25193401
tags question: http://stackoverflow.com/q/25147841
tags question: http://stackoverflow.com/q/25119447
tags question: http://stackoverflow.com/q/25100122
tags question: http://stackoverflow.com/q/25179180
tags question: http://stackoverflow.com/q/25191992
tags question: http://stackoverflow.com/q/25086027
tags question: http://stackoverflow.com/q/25088818
tags question: http://stackoverflow.com/q/25227197
tags question: http://stackoverflow.com/q/25141461
tags question: http://stackoverflow.com/q/25187052
tags question: http://stackoverflow.com/q/25084517
tags question: http://stackoverflow.com/q/25096127
tags question: http://stackoverflow.com/q/25184332
tags question: http://stackoverflow.com/q/25210908
tags question: http://stackoverflow.com/q/25198367
tags question: http://stackoverflow.com/q/25172453
type: Tag
tags question: http://stackoverflow.com/q/25171562
tags question: http://stackoverflow.com/q/25123843
tags question: http://stackoverflow.com/q/25156395
tags question: http://stackoverflow.com/q/25082054
tags question: http://stackoverflow.com/q/25176860
tags question: http://stackoverflow.com/q/25111422
tags question: http://stackoverflow.com/q/25211930
tags question: http://stackoverflow.com/q/25225970

http://stackoverflow.com/q/25161073
tagged with: servlets
has title: file path cannot take the string after space
has answer: http://stackoverflow.com/a/25161514
score: 0
has body: My task is to upload a file... For that, to download the uploaded code I need file location, for that my code has href as following: out.write("Download "+fileItem.getName()+""); but what I got in the URL portion of my browser is: http://localhost:8090/FileUpload/com/com/UploadDownloadFileServlet?fileName=C:\Documents%20and%20Settings\All%20Users\Documents\My%20Pictures\Sample%20Pictures\Sunset.jpg and it shows a HTTP 404 error... Where did I go wrong? Why does it take space as %20?
possible better answer: http://stackoverflow.com/a/25161186
answer count: 3
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/25161186
accepted answer: http://stackoverflow.com/a/25161514
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39171689
tagged with: file
has comment: http://stackoverflow.com/comment/39171753
has answer: http://stackoverflow.com/a/25178790
type: Question
tagged with: upload

http://stackoverflow.com/q/25101595
type: AnsweredQuestion
has body: I am referencing the following stack overflow question. Lucene NGram tokenizer with Queryparser It appears that the Query Parser will tokenize the query string based on white space, and then call the custom analyzer tokenizer. Is there anyway to prevent the Query Parser from doing the initial white space tokenization on the query string?
has title: Prevent Lucene Query Parser from Initial whitespace Tokenization
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/23121571
has answer: http://stackoverflow.com/a/25104515
tagged with: lucene
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25104515

spongycastle
type: Tag
tags question: http://stackoverflow.com/q/25129822
tag name: spongycastle

http://stackoverflow.com/comment/39068905
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25105476
has text: @user3692435: Don't you think `c.getPanel()` is creating a new instance of `JPanel` for each call. Now since you added the `JButton` on this new `JPanel` it will obviously be removed from the previous `JPanel` it is on and placed on the new `JPanel` that is being created with the call to `getPanel()`. But now when you calling `c.getPanel().requestFocusInWindow()` this newly created `JPanel` is never added to the already laid components, hence you are unable to see what is going on.
type: Comment

http://stackoverflow.com/q/25173177
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/39209434
upvote count: 1
type: Question
tagged with: charts
tagged with: java
has title: How to generate array of text labels for date interval chart programmatically
tagged with: arrays
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25177776
favorite count: 0
accepted answer: http://stackoverflow.com/a/25177776
tagged with: android
has body: I'm trying to implement a chart to show some interval based data. For the orizontal axis labels I need an array that contains all text labels. The problem is that: I have to generate this array programmatically according the passed GregorianCalendar startDate, GregorianCalendar endDate (and months havent all the same days number) eg assuming I need a chart from 7th July to 5 August like this in the picture the needed array of labels must be String labels[]={"lug 7","","","","","","","","lug 14","","","","","","","lug 21","","","","","","","lug 28","","","","ago 4",""} Any help would be most welcome

http://stackoverflow.com/a/25184095
has body: The Java Media Framework (jmf) is what you are looking for.
downvote count: 0
has comment: http://stackoverflow.com/comment/39214019
has comment: http://stackoverflow.com/comment/39214592
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/25183968
has comment: http://stackoverflow.com/comment/40212400
score: 5
has comment: http://stackoverflow.com/comment/39214329

http://stackoverflow.com/comment/39267451
type: Comment
has text: the opening < is present in the actual file, I missed it while copy-pasting. should I simply rename the file appengine-web-app?
comment on: http://stackoverflow.com/a/25194331
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39055244
has text: @ChrisJester-Young I was talking about putting this line `cache = new OneValueCache(i, factors); ` in `synchronised` block?
comment on: http://stackoverflow.com/q/25098138
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25122367
upvote count: 1
answers question: http://stackoverflow.com/q/25121026
has comment: http://stackoverflow.com/comment/39100911
has body: This works for your example (- but not checked for edge case), It uses the idea that dag's (directed acyclic graphs) have a natural ordering. This is the case for your example. An impossible scenario in statements would result in a cycle in the graph hence we can use that to throw an error. This works if all your statements are strict library(igraph) f &lt;- function(X) { d &lt;- do.call("rbind", strsplit(X , "&lt;")) g &lt;- graph.data.frame(d) if(is.dag(g)) V(g)$name[topological.sort(g)] else stop("Graph has cycles") } f(c("A&lt;B", "C&lt;B", "A&lt;C")) f(c("C&lt;B", "A&lt;C", "A&lt;B")) f(c("A&lt;B", "B&lt;C", "C&lt;A")) About the code: # this splits the string into two columns # interpreted as from -&gt; to by graph do.call("rbind", strsplit(X , "&lt;")) # generate graph from edges (d) g &lt;- graph.data.frame(d) is.dag(g) # checks if the graph is acyclic # if there are no cycles return the vertice names in topological order V(g)$name[topological.sort(g)] EDIT To include the case where vertices are equivalent restricts the use of the above. But we can still use graphical method (although it is less natural and not the R way to do it) - by describing equal vertices with bidirectional edges. If model / statements are fully specified (which it should be),we have a complete graph, and we can use the fact that if two vertices are equal they should have the same set of vertices greater than them and the same less than them - otherwise throw an error. So we use the ideas of parents and children and compare these between equivalent vertices (A &lt; B &lt;=> parent &lt; child). The first part of the function is for the cases where the statements are all strictly less or greater than. The second part compares the parent and children of nodes that have equivalence statement. f &lt;- function(X) { l &lt;- do.call("rbind", strsplit(X[grepl("&lt;", X)] , "&lt;")) if(!any(grepl("==", X))) { g &lt;- graph.data.frame(l) if(is.dag(g)) V(g)$name[topological.sort(g)] else stop("Imp…
has comment: http://stackoverflow.com/comment/39100705
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39100374
type: Answer
has comment: http://stackoverflow.com/comment/39100770
has comment: http://stackoverflow.com/comment/39101676
has comment: http://stackoverflow.com/comment/39102106
has comment: http://stackoverflow.com/comment/39100554
has comment: http://stackoverflow.com/comment/39100435

http://stackoverflow.com/comment/39263519
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25210193
has text: Are the key's name dynamic?

http://stackoverflow.com/comment/39155939
comment on: http://stackoverflow.com/a/25131692
has text: yes, i want to save to both database in one transaction method, so if one operation fails to save, both database will be rolled back, dao1 save operation doesnt have any problem, but when it goes to dao2, i always get an "No Session found for current thread" error. sorry for my bad english
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25089313
has body: If you want to load resources from within an exported .jar file, you cannot statically reference their location like you do when they are outside the jar. Depending on the path of the gif use either one of these: final String internalImagePath = "res/images/animation.gif"; //example one Toolkit.getDefaultToolkit().createImage(this.getClass().getClassLoader().getResource(internalImagePath)); //example two Toolkit.getDefaultToolkit().createImage(MainClass.class.getResource(internalImagePath)); If the images are relative to the class containing this code, use the first loader example. If the images are relative to some class other than the one in which this code exists, use the second example. Hope this helps. Cheers.
answers question: http://stackoverflow.com/q/25084664
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/39128830
has text: possible duplicate of [Unit testing on code that uses the Database](http://stackoverflow.com/questions/391249/unit-testing-on-code-that-uses-the-database)
comment on: http://stackoverflow.com/q/25135395
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39062403
has text: Have you tried using `setOnCheckedChangeListener()` for radio buttons instead of radiogroups. Or else you can also try `android:onClick` for your radio buttons in your xml. http://developer.android.com/guide/topics/ui/controls/radiobutton.html
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25102156

http://stackoverflow.com/comment/39200954
type: QuestionComment
comment on: http://stackoverflow.com/q/25176814
score: 4
has text: What exactly do you want to achieve?
type: Comment

http://stackoverflow.com/q/25187319
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39220596
type: Question
has body: I have a simple pair of client / server FTP classes using TCP protocol. I'm able to transfer small text files, but when I try a larger file like this, the file appears corrupted (editors are locked up trying to open it, less gets stuck jumping to the end.) I have a feeling I'm not closing it correctly, or reading and saving it correctly from the socket. Here are both get() functions from client and server. Hopefully someone can catch what I'm doing wrong. Server: public void get(){ // get file path from client try { this.filePath = controlIn.readLine(); } catch (IOException e) { controlOut.println(ERROR); dataOut.println("Server Error: Unable to read file path"); System.out.println("error reading filepath"); return; } // if client sends 0, abort GET (file exists in client directory) if(filePath == "-1"){ return; } // check if file exists File f = new File(filePath); if(!f.exists()){ controlOut.println(ERROR); dataOut.println("Server Error: File does not exist: " + filePath); return; } // send file size as success msg int fileSize = (int)f.length(); controlOut.println(fileSize); //read file to buffer, write buffer to socket byte [] buf = new byte [fileSize]; try { FileInputStream fis = new FileInputStream(f); BufferedInputStream bis = new BufferedInputStream(fis); bis.read(buf,0,buf.length); OutputStream os = dataSocket.getOutputStream(); os.write(buf,0,fileSize); fis.close(); bis.close(); os.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } Client: public void get(String filePath){ // check if file exists. If not, send ERROR to server File f = new File(filePath); if(f.exists()){ controlOut.println(ERROR); System.out.println("Client Error: File: " + filePath + " already exists"); return; } // send file path to server controlOut.println(filePath); // read status from server. Status &gt; 0 = file size int status = readStatus(); if(s…
answer count: 1
has comment: http://stackoverflow.com/comment/39220907
has comment: http://stackoverflow.com/comment/39220799
score: 0
tagged with: sockets
tagged with: io
has answer: http://stackoverflow.com/a/25187578
has title: Error opening files read from socket

http://stackoverflow.com/comment/39165123
comment on: http://stackoverflow.com/a/25096465
type: Comment
has text: Could you please also post where files where added by updating the screenshot or just writing files structure? I need also to know your web app context path? What is the package final name? What _wps_ and _PA_3m0jpe4o_ stands for in your projects structure?
score: 0
type: AnswerComment

http://stackoverflow.com/a/57947098
type: Answer
has body: Try this example in IDE: ArrayList&lt;ArrayList&lt;String&gt;&gt; ext = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); String[] arr = {"1","2","3","4","5","6"}; int n=arr.length; for(int i=0;i&lt;n;i++){ ArrayList temp = new ArrayList&lt;String&gt;(); for(int j=i;j&lt;n;j++){ temp.add(arr[j]); // this the line that needs to look at. Rather than pointing to the same memory reference creating a new ArrayList will store it in a different memory location. If you just add temp then it will point to same memory location. ext.add(new ArrayList&lt;String&gt;(temp)); // Comment above line and uncomment below to see the difference //ext.add(temp); } } System.out.println(ext);
answers question: http://stackoverflow.com/q/25147799
score: 0

http://stackoverflow.com/comment/39137281
score: 0
type: QuestionComment
type: Comment
has text: Post your full activity class including imports
comment on: http://stackoverflow.com/q/25142522

http://stackoverflow.com/q/25111864
type: AnsweredQuestion
tagged with: playframework-2.0
has body: I am want to create simple form for searching records via one parameter (for example, name). Seems like creating a class with one property (name) and than use helpers for forms - is not a best way. Is there any examles how can I get POST data from request and fetch property value from that data? Thanks a lot for wasting your time.
has answer: http://stackoverflow.com/a/25114248
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25114248
has title: What is the best way to get one param from form (Play2 Framework)?
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/25118572
favorite count: 0
has answer: http://stackoverflow.com/a/25118572
has comment: http://stackoverflow.com/comment/39080773

http://stackoverflow.com/a/25188596
type: Answer
answers question: http://stackoverflow.com/q/25188538
has body: Storing raw passwords in a text file isn't very safe for your users. It's a lot better to salt your passwords first - systematically convert them into hash that you write to file. Then instead of comparing password to password, you take salt the password the user gives you and compare that to what's written to file. Take a look here (and many other places) for how to do that.
score: 0

http://stackoverflow.com/comment/39007548
type: AnswerComment
comment on: http://stackoverflow.com/a/25072660
has text: Also, it helps naming your variables better: `String ipAddress = getIpAddress()` and `String[] ipPrefixes = ...`
score: 0
type: Comment

http://stackoverflow.com/a/25085036
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25082148
downvote count: 2
type: Answer
has body: I think a solution might be to avoid using @SendToUser and use raw SimpMessagingTemplate and to send messages to a destination that you control for open sessions. For eg. assuming that you had some identity for a new websocket session, you can subscribe to a queue with that identifier in the queue name: stomp.subscribe("/queue/chats" + "-" + mycustomidentifier, onmessage); Now, on the Spring websocket listener side, you can direct your responses using SimpMessagingTemplate: @Controller public class MyController { @Autowired private SimpMessagingTemplate simpMessagingTemplate; @MessageMapping("/chats") public void handleChat(@Payload ChatMessage message) { this.simpMessagingTemplate.convertAndSend("/queue/chats-" + "mycustomidentifier", "[" + getTimestamp() + "]:" + message.getMessage()); } ....
has comment: http://stackoverflow.com/comment/39048065
has comment: http://stackoverflow.com/comment/39122426
upvote count: 12
score: 10
answers question: http://stackoverflow.com/q/25082148
has comment: http://stackoverflow.com/comment/48108563

http://stackoverflow.com/comment/39297027
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25226014
has text: Can you give an example of code you want to write that uses an `Element` or `Visitor` generically? That might help in finding a workaround.

http://stackoverflow.com/a/25120605
has body: XML configuration used to be the only way to do it, but if I remember correctly, the usual usage was to have one method per controller. There's a fairly nice implementation of what you're looking for in the third-party springmvc-router project, which will let you configure your routes something like: GET /user/? userController.listAll GET /user/{&lt;[0-9]+&gt;id} userController.showUser DELETE /user/{&lt;[0-9]+&gt;id} userController.deleteUser POST /user/add/? userController.createUser
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25120065
type: Answer
accepted answer of: http://stackoverflow.com/q/25120065
score: 2
upvote count: 2

http://stackoverflow.com/a/25187447
type: Answer
has comment: http://stackoverflow.com/comment/39221390
has comment: http://stackoverflow.com/comment/39222117
answers question: http://stackoverflow.com/q/25107427
has comment: http://stackoverflow.com/comment/39221983
has comment: http://stackoverflow.com/comment/39220910
has comment: http://stackoverflow.com/comment/39221740
score: 0
has comment: http://stackoverflow.com/comment/39220690
has comment: http://stackoverflow.com/comment/39220983
has body: You don't need to do it twice. You can have it one call. extern "C" { JNIEXPORT jint JNICALL Java_org_opencv_samples_NativeActivity_CvNativeActivity_grayimg(JNIEnv* env, jobject,jint width, jint height, jintArray in, jintArray out) { // process } JNIEXPORT jint JNICALL Java_org_opencv_samples_NativeActivity_CvNativeActivity_eqhist(JNIEnv* env, jobject,jint width, jint height, jintArray in, jintArray out) { // process } } int tobrightness(Mat mSrc, Mat&amp; bgra) { // process } int toGray(Mat mSrc, Mat&amp; bgra) { // process } Now in your CvNativeActivity you need to define following functions. public native int grayimg(int w, int h, int[] in, int[] out); public native int eqhist(int w, int h, int[] in, int[] out); And it seems that you are getting error while writing Bitmap to .png file. Update your question with OutputBitmapToFile function. One more possible solution would be to call this function in a new thread. public class ProcessTask extends AsyncTask&lt;Void, Void, Boolean&gt; { @Override protected Boolean doInBackground() { // this happens in a background thread eqhist(bmInImg.getHeight(), bmInImg.getWidth(), mPhotoIntArray, mCannyOutArray); } @Override protected void onPostExecute(Boolean result) { // save image, show image etc // This happens on the UI thread } } And your onClick call, Button button= (Button) findViewById(R.id.NextButton); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ProcessTask task = new ProcessTask(); task.execute(); } })

http://stackoverflow.com/q/25127339
answer count: 2
has answer: http://stackoverflow.com/a/25203272
tagged with: rest
type: UnansweredQuestion
has title: "Java Heap Space" error when I'm trying to get the response from a webservice
score: 0
tagged with: web-services
type: Question
has comment: http://stackoverflow.com/comment/39109666
tagged with: java
has body: Java Heap Space error. I want to get a large String result from a webpage, please check the example below. But String response = resource.get(String.class); will always return a "java.lang.OutOfMemoryError: Java heap space" error. The problem is the webpage too large. Is there a streaming solution or other solution that I could use instead of "String response"? Thanks. import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.WebResource; public class helloWorldClient { public helloWorldClient() { super(); } public static void main(String[] args) { Client c = Client.create(); WebResource resource = c.resource("http://localhost:7101/RESTfulService-Project1-context-root/jersey/helloWorld"); String response = resource.get(String.class); } }
has answer: http://stackoverflow.com/a/25127428
tagged with: response

http://stackoverflow.com/comment/39274567
type: Comment
type: QuestionComment
has text: You might want to check this answer: http://stackoverflow.com/questions/17289829/reset-a-value-to-zero-upon-refresh
comment on: http://stackoverflow.com/q/25215379
score: 0

http://stackoverflow.com/comment/39274531
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25215701
type: AnswerComment
has text: I have editted the code, a look at it. Could you help me get how to make my window focusable. No element in window is getting focus. I know this because focus is still outside of that window, as when I typed a key even after clicking on my window the output is on my last focused window i.e. Netbeans window.

http://stackoverflow.com/comment/39227339
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25190286
has text: 500 means server error. If the server tell you there is a error, look at least in the error.log. The brwoser may ignores it because it can not do anything. But you can do something, look into the error.log !
score: 0

http://stackoverflow.com/a/25153707
has comment: http://stackoverflow.com/comment/39166261
type: Answer
has comment: http://stackoverflow.com/comment/39166087
has comment: http://stackoverflow.com/comment/39166041
has comment: http://stackoverflow.com/comment/39166065
has comment: http://stackoverflow.com/comment/39167757
has comment: http://stackoverflow.com/comment/39163572
has comment: http://stackoverflow.com/comment/39166018
has comment: http://stackoverflow.com/comment/39166227
score: 0
has comment: http://stackoverflow.com/comment/39165118
has body: Now after you edited your post, it works perfectly. I read the XML with the following code, and in the end it prints the same "ABCDEF" string: Path path = Paths.get("trivial.xml"); TokenCollection tc = JAXB.unmarshal(path.toFile(), TokenCollection.class); // Prints "ABCDEF" System.out.println(new String(tc.getTokenCollection().get(0), StandardCharsets.UTF_8));
has comment: http://stackoverflow.com/comment/39161323
has comment: http://stackoverflow.com/comment/39167691
has comment: http://stackoverflow.com/comment/39166723
has comment: http://stackoverflow.com/comment/39167218
has comment: http://stackoverflow.com/comment/39161552
has comment: http://stackoverflow.com/comment/39163776
answers question: http://stackoverflow.com/q/25152731

http://stackoverflow.com/comment/39285895
comment on: http://stackoverflow.com/q/25222087
type: Comment
type: QuestionComment
has text: if you are already using a Handler, use a HandlerThread to run your tssk in non ui thread
score: 0

http://stackoverflow.com/comment/70970554
type: QuestionComment
has text: @ikradex Hi, thank you for the solution, but one thing that i am still having issues in is that the node manager is still unable to connect to the resource manager, even though i set the value of "yarn.nodemanager.bind-host" to 0.0.0.0. Any suggestions to this??
comment on: http://stackoverflow.com/q/25135183
score: 0
type: Comment

http://stackoverflow.com/comment/39075467
has text: What are you getting the pixel color from? If it's an image or something, you could just try reading the appropriate bytes from the image directly and then casting the bytes to an int. Keep in mind that if you're reading the images from disk or something, file I/O is going to be expensive and slow
type: Comment
comment on: http://stackoverflow.com/a/25109037
score: 0
type: AnswerComment

http://stackoverflow.com/a/25284238
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/39403843
has comment: http://stackoverflow.com/comment/39403941
has comment: http://stackoverflow.com/comment/39404117
score: 4
has comment: http://stackoverflow.com/comment/39404574
has comment: http://stackoverflow.com/comment/39404609
type: AcceptedAnswer
has body: According to json.org (which must qualify as a credible/official source), JSON strings (as used in your JSON array, as names and values), must be quoted using double quotes: A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. Maybe you or someone else misread this to mean that you should use backslash escapes instead of double quotes? What it really means is that you must use double quotes (") around your string. The backslash character is used only as an escape character within the quoted string, should you want to use a double quote, a backslash, a control character or a Unicode character in hexadecimal form, as part of your string. You can read more about the JSON format in the Ecma 404 standard document, although I doubt you'll ever need more than the syntax and examples from json.org. In any case, your input is invalid according to the JSON format. The exception you get is correct, and expected for this input. Here's your entire JSON array on human readable and correct form: [ { "DoctorId": 3, "UserId": 0, "FirstName": "Nitish", "MiddleName": "", "LastName": "Rana", "Qualification": null, "Description": null, "Experience": null, "Email": "d@d.com", "Phone": "3245", "AddressId": 66, "LocationId": 51 }, { "DoctorId": 4, "UserId": 0, "FirstName": "Nitish ", "MiddleName": "", "LastName": "Rana", "Qualification": null, "Description": null, "Experience ": null, "Email": "d@d.com", "Phone": "3245", "AddressId": 67, "LocationId": 52 }, { "DoctorId ": 5, "UserId": 0, "FirstName": "Nitish", "MiddleName": "", "LastName": "Rana", "Qualification ": null, "Description": null, "Experience": null, "Email": "d@d.com", "Phone": "3245", "AddressId ": 68, "LocationId": 53 }, { "DoctorId": 6, "UserId": 0, "FirstName": "wefwe", "MiddleName ": "", "LastName": "rthyt", "Qualification": "", "Description": "", "Experience": "", "Email ": "w@w.com", "Phone": "43256", "AddressId": 69, "LocationId": 54 }, { "DoctorId": 7, "UserId ":…
accepted answer of: http://stackoverflow.com/q/25161387
answers question: http://stackoverflow.com/q/25161387
type: Answer

http://stackoverflow.com/comment/39142145
score: 0
comment on: http://stackoverflow.com/q/25144912
type: Comment
type: QuestionComment
has text: Thanks! yes, i can use MAVEN or ANT, i was checking if there was something provided by IDE like myeclipse for development mode.

http://stackoverflow.com/comment/39105190
score: 0
type: Comment
type: QuestionComment
has text: can you write the value of the constant `PROFILE_PLAYER`?
comment on: http://stackoverflow.com/q/25124968

2d-games
tags question: http://stackoverflow.com/q/25184089
type: Tag
tags question: http://stackoverflow.com/q/25226694
tags question: http://stackoverflow.com/q/25136491
tag name: 2d-games

http://stackoverflow.com/q/25174354
score: -11
has comment: http://stackoverflow.com/comment/39291844
has title: Synchronization - Difference between locks
answer count: 1
linked to: http://stackoverflow.com/q/20906548
has comment: http://stackoverflow.com/comment/39196933
has comment: http://stackoverflow.com/comment/39197009
favorite count: 0
has answer: http://stackoverflow.com/a/25174460
has comment: http://stackoverflow.com/comment/39196973
has comment: http://stackoverflow.com/comment/39196958
type: AnsweredQuestion
has body: What is the difference between the following approaches of placing a lock with concurrency? public synchronized ArrayList&lt;Player&gt; getPlayers() { return players; } public ArrayList&lt;Player&gt; getPlayers() { synchronized(players) { return players; } } public ArrayList&lt;Player&gt; getPlayers() { synchronized(GameHandler.class) { return players; } } How do we decide which one should be used in which scenarios? Edit: I have edited my thread title and post to prove this is not a duplicate. Thank you.
downvote count: 14
upvote count: 3
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/25174460
has comment: http://stackoverflow.com/comment/39196970
linked to: http://stackoverflow.com/q/574240
type: Question
has comment: http://stackoverflow.com/comment/39196966
has comment: http://stackoverflow.com/comment/39200701
tagged with: java
duplicate of: http://stackoverflow.com/q/574240
has comment: http://stackoverflow.com/comment/39196925

http://stackoverflow.com/q/25132318
has body: This is simple project. that I create to illustrate this issue: https://bitbucket.org/sharc/tadamlist Intro: I have two entity: TDList and TDTask (TDTask is mapped to list as ManyToOne @ManyToOne(fetch = FetchType.EAGER) private TDList list; ) so, when I remove the list, I set list field in TDTask to null TDListDAOImpl: public void remove(int id) { Session session = sessionFactory.getCurrentSession(); TDList tdList = (TDList) session.load(TDList.class, id); if(tdList != null){ tdTaskDAO.changeList(tdList, null); session.delete(tdList); } } TDTaskDAOImpl: public void changeList(TDList from, TDList to) { if(from == null) { Query query = sessionFactory.getCurrentSession().createQuery("update TDTask set list = :newList where list = null"); query.setEntity("newList", to); query.executeUpdate(); } else if(to == null) { Query query = sessionFactory.getCurrentSession().createQuery("update TDTask set list = null where list = :oldList"); query.setEntity("oldList", from); query.executeUpdate(); } else { Query query = sessionFactory.getCurrentSession().createQuery("update TDTask set list = :newList where list = :oldList"); query.setEntity("oldList", from); query.setEntity("newList", to); query.executeUpdate(); } } Problem: When I do test, list does not set to null for in TDTask, but after test it is like it must be: Test code: public void deleteListTest(){ TDList list = new TDList(); list.setTitle("First test list"); tdListDAO.put(list); TDTask task = new TDTask(); task.setTask("Bla-bla-bla"); task.setDone(false); task.setList(list); tdTaskDAO.put(task); task = tdTaskDAO.get(task.getId()); System.out.println(task); tdListDAO.remove(list.getId()); Assert.assertNull(tdListDAO.get(list.getId())); task = tdTaskDAO.get(task.getId()); System.out.println(task); Assert.assertNull(task.getList()); } Test logs: Hibernate: insert into TDList (title) values (?) Hibernate: insert into TDTask (done, list_id, task) values (?, ?, ?) Hibernate: select tdtask0_.id as id1_1_, tdtask0_.done as don…
has answer: http://stackoverflow.com/a/25166497
has title: Issue with hibernate when I do integration testing (probably with transactions)
accepted answer: http://stackoverflow.com/a/25166497
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
answer count: 1
score: 0
tagged with: junit

http://stackoverflow.com/comment/39249755
type: QuestionComment
has text: That's still not what you want, because 10^1200 starts with a "1" which I suggest you don't want. It would really help if you'd give a *simple* example of input and expected output - with just (say) 4 digits in the input, and adding an extra 5.
score: 1
comment on: http://stackoverflow.com/q/25203022
type: Comment

http://stackoverflow.com/a/25182955
answers question: http://stackoverflow.com/q/25155668
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25155668
type: Answer
has body: Finally I have changed the way of doing it. Instead of coding the HTTP client by hand I have used Apache OLTU. Much easier this way and it works.
score: 1
upvote count: 1

http://stackoverflow.com/comment/39089522
type: QuestionComment
score: 5
has text: in `(int i = 0; i <= rsMD.getColumnCount(); i++)`, remove `=`
comment on: http://stackoverflow.com/q/25116783
type: Comment

http://stackoverflow.com/comment/39138555
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25143195
has text: possible duplicate of [How do I compare strings in Java?](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java)
type: Comment

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/25225649
tags question: http://stackoverflow.com/q/25117115
tags question: http://stackoverflow.com/q/25196138
type: Tag
tags question: http://stackoverflow.com/q/25220091
tags question: http://stackoverflow.com/q/25226162
tags question: http://stackoverflow.com/q/25097116

http://stackoverflow.com/comment/39302496
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25213058
has text: I have the cullface attribute because without it the back faces seem to render on top of front faces. So if the temporary removal of the attribute has no effect then removing it complete should have no effect too?Or am I wrong? If so why? Theres more on why the cull face is needed in this question: http://stackoverflow.com/questions/24724359/trouble-batching-cubes-in-libgdx?noredirect=1#comment38436228_24724359 .I'm sorry if I'm being a pain in the ass. I just don't want to spend a lot of time (because I don't know how to do it)trying to rewind cube vertices if that won't make any difference.
score: 0

http://stackoverflow.com/a/52183989
answers question: http://stackoverflow.com/q/25135042
downvote count: 1
upvote count: 0
score: -1
has body: change the location of the project folder and set system path and path properties accordingly .It works in our case.But we are unable to find the exact reason.
type: Answer

http://stackoverflow.com/comment/89699094
score: 0
type: Comment
type: QuestionComment
has text: Heh... I like your PipedInputStream variable name... "pis"
comment on: http://stackoverflow.com/q/25097668

nexus
type: Tag
tags question: http://stackoverflow.com/q/25120485
tags question: http://stackoverflow.com/q/25165567
tags question: http://stackoverflow.com/q/25123918
tag name: nexus

http://stackoverflow.com/q/25192142
score: 0
has answer: http://stackoverflow.com/a/25192376
accepted answer: http://stackoverflow.com/a/25200142
tagged with: synchronization
answer count: 5
has answer: http://stackoverflow.com/a/25198961
has title: Wait till a Blocking Queue is full
has answer: http://stackoverflow.com/a/25200142
has answer: http://stackoverflow.com/a/25196404
possible better answer: http://stackoverflow.com/a/25192376
tagged with: multithreading
type: AnsweredQuestion
has body: Im looking for a way to synchronize multiple asynchronous operations. I'd like to use a BlockingQueue with a size equal to my operations but who can i wait till the Queue is full? Im looking for something like a reversed Blocking Queue. I need to gather the Results of each Thread at the End. The AsyncHandler is fixed, its already a ThreadExecutor underlying, i cannot start new Threads. //3 Times makeAsync(new AsyncHandler() { onSuccess() { .. queue.put(result) } onFailure() { .. } }); //Blocking till the Queue is full List&lt;Results&gt; = queue.takeAll() Bonus Question: I need a way to end the wait when one of my Requests fails
tagged with: blockingqueue
has answer: http://stackoverflow.com/a/76986810
tagged with: java
type: Question

http://stackoverflow.com/q/25144072
answer count: 1
linked to: http://stackoverflow.com/q/5805843
favorite count: 0
duplicate of: http://stackoverflow.com/q/5805843
type: UnansweredQuestion
has body: In a project I am working with a custom configuration file to allow for custom cards to be loaded into a game. (similar to a .properties file except it holds information for more than one item, as well as different types of items). File is set up like this: # Pound Signs denote comments # Empty lines are also ignored by the parser. # Here are three example items CARD_TYPE_ONE { name = item one name species = robot isMoveable = false } CARD_TYPE_TWO { name = foo attackType = bar } CARD_TYPE_TWO { name = foo2 special = true attackType = bar2 } All cards will have default values for any unassigned attributes (i.e. "special" defaults to "false" under CARD_TYPE_TWO), but as you can see, differnt cards of the same type can have different lengths The code I have for reading the attributes looks like this: private int createCardType2(String cardFile, int expectedLineNumber) { // Builds Card type 2. //cardFile is the location (with extension) of the .cards file //expectedLineNumber is where the main program currently sits in reading the program int i = 0; Scanner in = null; try { in = new Scanner(new File(cardFile)); } catch (java.io.IOException e) { System.out.println(e); } int x = 1; while (in.hasNext()){ //loops through the previous lines in the file while( i &lt; expectedLineNumber) { in.nextLine(); i++; } if (i != expectedLineNumber) { //Something went wrong, and that can't be right System.out.println("We have encountered an error, aborting now."); break; } String &lt;some dynamic name&gt; = in.nextLine(); if (dynamicallyNamedString.equals("}") { //find key pairs and set attributes. } if (!dynamicallyNamedString..trim().equals("}") &amp;&amp; !in.hasNext()) { //malformed file, throw an error break; } } in.close(); return i; //so that the main program knows where to go to to continue. } I will use String.split() with " = " as my delimiter to get my key pairs. I am also aware that Java does not have dynamic variable naming, but I don't think hash-tables are right, and I c…
has answer: http://stackoverflow.com/a/25144097
tagged with: dynamic-variables
tagged with: java.util.scanner
tagged with: java
score: -4
has title: How to name variables when reading from a custom config file with an unknown number of attributes? Java
type: Question
downvote count: 4
upvote count: 0

auto-increment
type: Tag
tags question: http://stackoverflow.com/q/25229597
tag name: auto-increment

http://stackoverflow.com/q/25109336
tagged with: dependency-injection
tagged with: guice
accepted answer: http://stackoverflow.com/a/25109481
answer count: 1
has body: I have two implementations of my service interface, public interface Service { public ServiceResponse get(); } One being a Mock implementation which returns a stubbed ServiceResponse and the other doing some real work with some unavailable downstream services. Although both my RealService and MockService are ready I can only use the mock. And I want that instance to be injected depending on an environment variable. My question is how to achieve this? Thanks
score: 0
has title: Guice dependency injection choosing one of two implementations based on configuration
has answer: http://stackoverflow.com/a/25109481
has comment: http://stackoverflow.com/comment/39075645
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/39199255
comment on: http://stackoverflow.com/q/25175288
score: 0
type: Comment
type: QuestionComment
has text: Please add the **full stack trace** to you question together with the **rest** of your code. From the link above **Provide all parts needed to reproduce the problem**

http://stackoverflow.com/a/25220404
score: 1
has comment: http://stackoverflow.com/comment/39282898
upvote count: 1
has body: Overridden methods may contain only the same checked exceptions in their throws clause as the super-method, or derived types at most. For example if you say class Base { public void foo(int y) throws IOException { // ... } } and class Derived extends Base { public void foo(int y) throws Exception { // ... } } then your compiler will say that the foo method inside Derived is incompatible with the throws clause in its superclass. The other way around works because if I say class Base { public void foo(int y) throws Exception { // ... } } and class Derived extends Base { public void foo(int y) throws IOException { // ... } } it's OK. Why. Think about the usage of your methods. Java expects you to be using the method polymorphically such as Base a = new Derived(); a.foo(3); As such, the compiler will force you to catch the exception thrown by foo in your declared type of the variable (Base). So your code will become Base a = new Derived(); try { a.foo(3); } catch (Exception e) { // ... } Therefore, the subtype of Exception you declared in the Derived type is OK with your code above (a catch for an Exception will work for any of its subtypes as well) and as such, Java will allow you to declare IOException in derived, because it will cause no worries later on.
answers question: http://stackoverflow.com/q/25220364
type: Answer
has comment: http://stackoverflow.com/comment/39282815
downvote count: 0
has comment: http://stackoverflow.com/comment/39282944

http://stackoverflow.com/q/25111464
tagged with: android
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/25111635
has body: I need to get the information transfered from the NFC READER to my phone to be Arrange in each line wth for eg.Event ID,Event Name,DateTime,Venue. At the moment when I tap my phone to the reader using my android app,all i get is a string of text.I want to break the text to be able to identify Event Id,EventName,DateTime,Venue to be able to getText seperately for each text to submit to database. here is my code package com.techblogon.loginexample; import java.nio.charset.Charset; import java.util.Arrays; import com.techblogon.loginexample.R; import android.app.Activity; import android.content.Intent; import android.nfc.NdefMessage; import android.nfc.NdefRecord; import android.nfc.NfcAdapter; import android.nfc.NfcEvent; import android.nfc.NfcAdapter.CreateNdefMessageCallback; import android.nfc.NfcAdapter.OnNdefPushCompleteCallback; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.Parcelable; import android.provider.Settings; import android.text.format.Time; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.TextView; import android.widget.Toast; public class UserScreen extends Activity implements CreateNdefMessageCallback, OnNdefPushCompleteCallback{ private static final int MESSAGE_SENT = 1; NfcAdapter mNfcAdapter; TextView mInfoText; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.userscreen); mInfoText = (TextView) findViewById(R.id.textView); // Check for available NFC Adapter mNfcAdapter = NfcAdapter.getDefaultAdapter(this); if (mNfcAdapter == null) { mInfoText = (TextView) findViewById(R.id.textView); mInfoText.setText("NFC is not available on this device."); } // Register callback to set NDEF message mNfcAdapter.setNdefPushMessageCallback(this, this); // Register callback to listen for message-sent success mNfcAdapter.setOnNdefPushCompleteCallback(this, this); }…
type: Question
has title: Break up A Single TextView into Different line
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25111635
has comment: http://stackoverflow.com/comment/39080830
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39101176

http://stackoverflow.com/comment/39200842
type: QuestionComment
comment on: http://stackoverflow.com/q/25139716
has text: oh my God... why do you decodeResource in the loop? why do you createScaledBitmap in the loop? why do you createScaledBitmap ar all? why dont you create ONE Bitmap in onCreate and draw it?
score: 0
type: Comment

http://stackoverflow.com/comment/39264878
type: Comment
type: QuestionComment
has text: It would be helpful to post the code here so we don't have to switch back and forth. Just a suggestion...
comment on: http://stackoverflow.com/q/25210024
score: 0

http://stackoverflow.com/a/57977188
downvote count: 1
has body: This solution is independent of JPA implementation. Once you collect result of native query as List&lt;Object[]&gt; = em.createNativeQueryBar(QUERY, "foo").getResultList(); and if you need to map each List element to a Person e.g. Class Person { String name; Int age; } where List element[0] is name and element [ 1] is age. You can convert Object[] to Person using ObjectMapper. You need to add @JsonFormat annotation on the class. @JsonFormat(shape = JsonFormat.Shape.ARRAY) Class Person { String name; Int age; } and convert Object[] to Person as ObjectMapper mapper = new ObjectMapper(); JSONArray jsonArray = new JSONArray(Arrays.asList(attributes)).toString(); Person person = mapper.readValue(jsonArray, Person.class);
answers question: http://stackoverflow.com/q/25188939
upvote count: 0
type: Answer
score: -1

http://stackoverflow.com/a/25213392
answers question: http://stackoverflow.com/q/25213264
type: Answer
score: 1
upvote count: 1
has body: You can think about a color as composed of 3 components. RGB. In your example you have 0xffffff. The first ff is the red component, the second ff is green component the third FF is the blue component. Change those hexadecimal values you can get your colors. e.g. use int color = Color.rgb(255, 255, 175);
downvote count: 0

http://stackoverflow.com/q/25220522
has comment: http://stackoverflow.com/comment/39283271
has title: Getting crash in Android on onResume() in my activity - Why?
has comment: http://stackoverflow.com/comment/39283095
type: UnansweredQuestion
has body: The error is: Unable to resume activity: java.lang.NullPointerException Here is the stack trace: 0 java.lang.RuntimeException: Unable to resume activity {com.sortitapps.movies/com.sortitapps.movies.SettingsActivity}: java.lang.NullPointerException 1 at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2944) 2 at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2973) 3 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2408) 4 at android.app.ActivityThread.access$600(ActivityThread.java:165) 5 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373) 6 at android.os.Handler.dispatchMessage(Handler.java:107) 7 at android.os.Looper.loop(Looper.java:194) 8 at android.app.ActivityThread.main(ActivityThread.java:5391) 9 at java.lang.reflect.Method.invokeNative(Native Method) 10 at java.lang.reflect.Method.invoke(Method.java:525) 11 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 12 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 13 at dalvik.system.NativeStart.main(Native Method) 14 Caused by: java.lang.NullPointerException 15 at com.sortitapps.movies.SettingsActivity.onResume(SettingsActivity.java:149) 16 at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1259) 17 at android.app.Activity.performResume(Activity.java:5200) 18 at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2931) And here is the code. Line 149 is adapter.notifyDataSetChanged();: @Override public void onResume() { super.onResume(); // Always call the superclass method first SharedPreferences settings = getSharedPreferences("prefs", 0); int numberDesktop = settings.getInt("desktop", 0); Log.i("Desktop purchased:", String.valueOf(numberDesktop)); int numberScans = settings.getInt("scanning", 0); Log.i("Number of scans:", String.valueOf(numberScans)); if (settingsitems.contains("Unlock Desktop Apps") &amp;&amp; numberDesktop == 2) { settingsitem…
tagged with: android
has comment: http://stackoverflow.com/comment/39282982
has comment: http://stackoverflow.com/comment/39283103
has comment: http://stackoverflow.com/comment/39283141
tagged with: java
type: Question
tagged with: crash
has comment: http://stackoverflow.com/comment/39283041
has comment: http://stackoverflow.com/comment/39283126
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25220576
tagged with: onresume

http://stackoverflow.com/a/25104515
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25101595
answers question: http://stackoverflow.com/q/25101595
type: AcceptedAnswer
has body: It turns out to be really simple. All you need to do is wrap your query string in double quotes like this. "Example Query String"

http://stackoverflow.com/q/25134468
tagged with: android
tagged with: alarm
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25134812
has body: I am trying to laod some tasks from DB on BOOT_COMPLETED and set alarm for each of them. Alarm Manager is configured to receive BOOT_COMPLETED in AndroidMAnifest File. Sometime I get these task via SMS, so i have a brodcastreceiver for sms receiving and processing, which builds task list and calls AlarmManager.setAlarms(). I am wondering that setAlarams works fine when called from OnReceive() method og SMSReceiver, but does not work properly when called from OnReceive() method of AlarmManager on Boot_Completed. it just sets one Alarm and ignores the rest of the list! any help on this? thanks in advance public class AlarmManager extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { List &lt;Task&gt; taskList= db.loadFromDB(); setAlarms(context, taskList); } public static void setAlarms(Context context, List&lt;Task&gt; taskList) { for each task in taskList{ int pendingIntentRequestCode = task.getid();; Intent myIntent = new Intent(context, AlarmReceiver.class); myIntent.putExtra("taskName", task.getName()); myIntent.putExtra("taskHour", task.getHour)); myIntent.putExtra("taskMinute", task.getMinute()); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, pendingIntentRequestCode, myIntent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP,alarmTime, pendingIntent ); } } } public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String taskName = intent.getStringExtra("taskName"); int taskHour = intent.getIntExtra("taskHour", -1); int taskMinute = intent.getIntExtra("taskMinute", -1); Intent alarmIntent = new Intent(AlarmClock.ACTION_SET_ALARM); alarmIntent.putExtra(AlarmClock.EXTRA_MESSAGE, taskName); alarmIntent.putExtra(AlarmClock.EXTRA_HOUR, ataskHour); alarmIntent.putExtra(AlarmClock.EXTRA_MINUTES, taskMinute); alarmIntent.putExtra…
tagged with: bootcompleted
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has title: Set Multiple Alarms on BOOT_COMPLETED in Android
type: UnansweredQuestion

http://stackoverflow.com/q/25134348
has answer: http://stackoverflow.com/a/25134905
type: Question
upvote count: 2
tagged with: regex
has answer: http://stackoverflow.com/a/25134798
tagged with: quotes
tagged with: java
answer count: 4
has title: Java regex to extract fields with or without quotes
linked to: http://stackoverflow.com/q/25134798
downvote count: 0
accepted answer: http://stackoverflow.com/a/25134798
has answer: http://stackoverflow.com/a/25137511
tagged with: key-value
has answer: http://stackoverflow.com/a/25134434
score: 2
type: AnsweredQuestion
tagged with: string
has body: I am trying to extract key-value pairs from a long string in two basic forms, one with and one without quotes, like ... a="First Field" b=SecondField ... using the Java regular expression \b(a|b)\s*(?:=)\s*("[^"]*"|[^ ]*)\b However, running the following test code public static void main(String[] args) { String input = "a=\"First Field\" b=SecondField"; String regex = "\\b(a|b)\\s*(?:=)\\s*(\"[^\"]*\"|[^ ]*)\\b"; Matcher matcher = Pattern.compile(regex).matcher(input); while (matcher.find()) { System.out.println(matcher.group(1) + " = " + matcher.group(2)); } } the output is a = "First b = SecondField instead of the desired (without quotes) a = First Field b = SecondField In a more generalized input, like a ="First Field" b=SecondField c3= "Third field value" delta = "" e_value = five! the output should be (again, without quotes and with varying amounts of white space before and after the = sign) a = First Field b = SecondField c3 = Third field value delta = e_value = five! Is there a regular expression to cover the above use case (at least the version with the 2 keys), or should one resort to string processing? Even trickier question: if there is such a regex, is there also any way of keeping the index of the matcher group corresponding to the value constant, so that both the quoted field value and the unquoted field value correspond to the same group index?
favorite count: 0
possible better answer: http://stackoverflow.com/a/25134905

http://stackoverflow.com/q/25171533
tagged with: android
has comment: http://stackoverflow.com/comment/39192484
has comment: http://stackoverflow.com/comment/39192588
score: 0
answer count: 2
has body: I have a ListView, titled myListView, that I would like to populate with 3 LinearLayout elements, titled layout1.xml, layout2.xml, and layout3.xml. All 3 LinearLayout elements are very similar; here is one of them: <?xml version="1.0" encoding="utf-8"?> <TextView android:layout_width="0dip" android:layout_weight="1" android:layout_height="wrap_content" android:text="Los Angeles" /> <TextView android:layout_width="0dip" android:layout_weight="1" android:layout_height="wrap_content" android:text="California" /> My goal is to populate a the ListView (myListView) with these three LinearLayout elements. Does anyone know how I would go about doing this?
has answer: http://stackoverflow.com/a/25171708
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25172078
has title: Android: set LinearLayout to be a value in a Listview
type: Question

http://stackoverflow.com/a/25111690
downvote count: 0
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25111593
type: Answer
has body: I don't think this question can be answered without knowing exactly how your partners are going to use your wrapper. Design an API that's suitable for them and then just delegate the calls to the appropriate (series of) SDK calls. You might call that a facade if you wish, but I think your task is bigger. I'd say it's a new layer in a layered architecture. In that layer you can use all the patterns you see fit.

http://stackoverflow.com/q/25140561
has body: Scenario : There is a java library that helps asynchronously listen to some system events. I am planning to use the already implemented asynch functionality from a vb.net project. I have planned to address it in the following way : Write a web service around the java library Add reference of that service to the .net app. The web service will run locally on a tomcat as the .net app. The problem i am faced with is how do i make the web service communicate to the .net app asynchronously ? Should the .net app block and wait on a web service and if so how ?
upvote count: 1
tagged with: web-services
tagged with: vb.net
has comment: http://stackoverflow.com/comment/39399004
tagged with: java
has answer: http://stackoverflow.com/a/25316239
has comment: http://stackoverflow.com/comment/39134009
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39569844
tagged with: asynchronous
accepted answer: http://stackoverflow.com/a/25316239
possible better answer: http://stackoverflow.com/a/25390517
has answer: http://stackoverflow.com/a/25390517
has title: Asynchronous call from java web service to .net application
answer count: 2

http://stackoverflow.com/a/25088031
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25087965
type: Answer
has body: If the object is serializable, you could serialize it as a BLOB. But that's not something you want to do because it would be inefficient to constantly serialize and deserialize the object it would be very fragile: a change in the object class would make it impossible (or hard if you know what you're doing) to read previous versions already saved in the database only Java could make sense of the blob you could not do any query on this object So, basically, the answer is no. JPA entities can have embedded objects, whose fields are mapped to columns, or can have associations with other entities (OneToOne, OneToMany, ManyToOne or ManyToMany). My advice: think about the design of your database first, then map the schema to JPA entities. If you start writing an object model without even thinking how it will be persisted in the database, you won't go very far.
score: 1
accepted answer of: http://stackoverflow.com/q/25087965
upvote count: 1

http://stackoverflow.com/q/25166410
has answer: http://stackoverflow.com/a/25166695
has title: Adding proxy to Spring managed beans
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/25166839
tagged with: transactions
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25340364
tagged with: proxy
has body: I am working on a web project and one of its requirements is to call some store procedures before each actions in the database (for init/debug/audit purposes). My service layer uses Spring to manage the transactions, meaning that they are clearly delimited. My idea is to add a proxy class via annotation, to call these SP. I read a lot of blogs, articles on writing annotations, AOP, AspectJ, proxying and so on, but I don't understand how I can use it for my need. One of my problems is how to ensure that my proxy will be called by the Spring proxy (after it started the transaction)? Another one is how to triggers the creation of my own proxies? Any precision will be welcome because so far, I understand the main idea, but I have no clue on how I can really do that.
score: 0
answer count: 3

http://stackoverflow.com/q/25205096
downvote count: 0
tagged with: java
has title: Is there any sense in access modifiers for fields of the private inner class?
type: Question
has comment: http://stackoverflow.com/comment/39254786
has body: Suppose I have an outer class with an inner class inside. The inner class has four fields with all possible access modifiers. class Outer { private class Inner { public int publicField; protected int protectedField; int packagePrivatefield; private int privateField; } void doSomethingWithFields() { Inner inner = new Inner(); inner.publicField = 111; inner.protectedField = 111; inner.packagePrivatefield = 111; inner.privateField = 111; } } The inner class is private, so I can't create instances of it outside the Outer class. Inside the Outer class, if I create an instance of the inner class and try to change the value for each of the fields I will succeed to do that. So I see that there is no sense in access modifiers for the above fields. Is there? Edited: The main question is: Which access modifiers should I choose for members of the private inner class? Inner class can not only implement interface. I can put some difficult structure with logic into it.
possible better answer: http://stackoverflow.com/a/25205160
upvote count: 11
has answer: http://stackoverflow.com/a/25205233
accepted answer: http://stackoverflow.com/a/25205233
has comment: http://stackoverflow.com/comment/39253869
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/25205160
score: 11
has answer: http://stackoverflow.com/a/25205286
linked to: http://stackoverflow.com/q/6264657
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25205217

http://stackoverflow.com/q/25217784
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: android-intent
type: Question
score: 1
tagged with: java
tagged with: android-service
has body: If I extend the NotificationListenerService of the android system, how is it called if I use the following intent-filter in the manifest: action android:name="android.service.notification.NotificationListenerService" Does the system call it using the startService() method? It surely isn't called using the bindService() method is it? After all my service that extends NotificationListenerService stands alone, it isn't bound to any activity. So providing that it is started using startService(), the onStartCommand() method should be called each time a notification arrives in the status bar, right? Is it also possible for me to close/destroy/kill my service that extends NotificationListenerService? So that it doesn't run until a new notification arrives, which would call it again through the action in the intent-filtermentioned above? This in return would call the onCreate() method of my service. Would appreciate some help here, thanks :)
downvote count: 0
has title: How is a service started by the android system?
favorite count: 0
tagged with: android

http://stackoverflow.com/a/25214426
score: 0
answers question: http://stackoverflow.com/q/25214367
has comment: http://stackoverflow.com/comment/39277159
has comment: http://stackoverflow.com/comment/39271923
has body: (Likely incomplete) list of issues to be sorted out: You'll need a compatible version of Java installed on the host machine. Your host may not have it installed and likely will not be willing to install it for you. Once you get a host machine with Java installed, you'll need proper permissions to access it. This is also unlikely, as your host does not want you using Java on their web-hosting-only package. You'll then need to know the absolute path to the Java program that you uploaded, as it would be bad practice to use a path relative to PHP's context (ie, /home/user3924138/MyJavaProgram.jar It sounds like what you want is a VPS (Virtual Private Server) where you have full shell access and can install Java and a webserver yourself and do what you are trying to do here.
has comment: http://stackoverflow.com/comment/39272812
type: Answer

http://stackoverflow.com/a/70397949
answers question: http://stackoverflow.com/q/25102022
type: Answer
has body: One of the simplest and cleanest way to remove element from a custom Linked list is as follows. import java.util.concurrent.atomic.AtomicInteger; public class LinkedList<T> { class Node<T> { private T data; private Node<T> next; Node(T data) { this.data = data; this.next = null; } } private Node<T> head; private Node<T> tail; private AtomicInteger size = new AtomicInteger(); public void add(T data) { Node<T> n = new Node<T>(data); if (head == null) { head = n; tail = n; size.getAndIncrement(); } else { tail.next = n; tail = n; size.getAndIncrement(); } } public int size() { return size.get(); } public void displayElement() { while (head.next != null) { System.out.println(head.data); head = head.next; } System.out.println(head.data); } public void remove(int position) throws IndexOutOfBoundsException { if (position > size.get()) { throw new IndexOutOfBoundsException("current size is:" + size.get()); } Node<T> temp = head; for (int i = 0; i < position; i++) { temp = temp.next; } head = null; head = temp; size.getAndDecrement(); } }
has comment: http://stackoverflow.com/comment/124442887
score: 0

http://stackoverflow.com/a/25150224
downvote count: 0
has comment: http://stackoverflow.com/comment/39191874
type: Answer
answers question: http://stackoverflow.com/q/25150199
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/39154294
has comment: http://stackoverflow.com/comment/39152186
has body: This should work: String randomString = wordlist[(int)(Math.random() * wordlist.length)];

http://stackoverflow.com/comment/39024494
has text: there is a big difference between the working directory ant the location where the program lay. I would place it *near* the program, how can I do?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25081971
type: Comment

http://stackoverflow.com/a/25100703
has body: Possibly using JOption pane. Import looks like: import javax.swing.JOptionPane; and lets say you have a method called public void gotNotification(){ JOptionPane.showMessageDialog (null, "You just received a notification!!!"); } that way a box pops up saying "You just received a notification!!!". Thats the best suggestion I have.
type: Answer
answers question: http://stackoverflow.com/q/25100640
score: 0

http://stackoverflow.com/comment/39131717
score: 0
type: Comment
has text: if (session == null || !session.isOpen()) { if (sessionFactory == null) { rebuildSessionFactory(); } session = (sessionFactory != null) ? sessionFactory.openSession() : null; threadLocal.set(session); } You have problem in this code try to change the logic
comment on: http://stackoverflow.com/a/25135406
type: AnswerComment

undertow
type: Tag
tags question: http://stackoverflow.com/q/25204887
tag name: undertow

http://stackoverflow.com/q/25079125
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25079156
tagged with: java
downvote count: 2
type: Question
linked to: http://stackoverflow.com/q/218384
score: -2
answer count: 3
has title: Setting value between classes (via set/get methods)
upvote count: 0
has answer: http://stackoverflow.com/a/25079156
possible better answer: http://stackoverflow.com/a/25079160
has answer: http://stackoverflow.com/a/25079160
favorite count: 0
has body: I have one model class for defining variables and when I'm trying to set some value from my MainActivity to Model class, I'm getting errors. From my MainActivity.class public class MainActivity extends Activity { private ListView productList; private OfferModel offerModel; @Override protected void onCreate (Bundle savedInstanceState){ super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_main); productList = (ListView)findViewById(R.id.listView1); ...many codes here... productList.setOnItemClickListener(new OnItemClickListener() { @SuppressWarnings("deprecation") @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position, long arg3) { offerModel.setProductName(arg0.getItemAtPosition(position).toString()); } }); }} And this is from my Model class public class OfferModel { private String productName; public String getProductName(){return this.productName;} public void setProductName(String pName){ this.productName=pName;} } And here is my Log result 08-01 11:17:46.446: W/dalvikvm(2305): threadid=1: thread exiting with uncaught exception (group=0xa4b70648) 08-01 11:17:46.446: E/AndroidRuntime(2305): FATAL EXCEPTION: main 08-01 11:17:46.446: E/AndroidRuntime(2305): java.lang.NullPointerException 08-01 11:17:46.446: E/AndroidRuntime(2305): at stok.kontrol.noyagrup.MainActivity$2.onItemClick(MainActivity.java:71) 08-01 11:17:46.446: E/AndroidRuntime(2305): at android.widget.AdapterView.performItemClick(AdapterView.java:298) 08-01 11:17:46.446: E/AndroidRuntime(2305): at android.widget.AbsListView.performItemClick(AbsListView.java:1100) 08-01 11:17:46.446: E/AndroidRuntime(2305): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2788) 08-01 11:17:46.446: E/AndroidRuntime(2305): at android.widget.AbsListView$1.run(AbsListView.java:3463) 08-01 11:17:46.446: E/AndroidRuntime(2305): at android.os.Handler.handleCallback(Handler.java:730) 08-01 11:17:46.446: E/Andr…
has answer: http://stackoverflow.com/a/25079179
has comment: http://stackoverflow.com/comment/39019020

http://stackoverflow.com/comment/80222291
has text: -1 Because this is not what the question title asks for. Looks like the title was, at one time, ambiguous - making this answer a reasonable one during that ambiguity. Now that the title is specific, this answer is unrelated. :( I don't have enough rep to *actually* downvote, but I tried!
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25161784

http://stackoverflow.com/a/25150207
accepted answer of: http://stackoverflow.com/q/25150130
has comment: http://stackoverflow.com/comment/39152350
has comment: http://stackoverflow.com/comment/39153637
has comment: http://stackoverflow.com/comment/39153953
answers question: http://stackoverflow.com/q/25150130
has comment: http://stackoverflow.com/comment/39290212
has body: You need to specify it from . (dot) Let's suppose this class import java.awt.Image; import java.awt.image.BufferedImage; import javax.swing.ImageIcon; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; class ImagePaneTest extends JFrame { ImageIcon ic = new ImageIcon("./images/nice.jpg"); JDesktopPane dp = new JDesktopPane(); JLabel lbl = new JLabel(ic); JPanel transparentPanel = new JPanel(); public ImagePaneTest() { lbl.setBounds(0, 0, 553, 421); dp.add(lbl, new Integer(50)); dp.add(transparentPanel, new Integer(350)); setLayeredPane(dp); } public static void main(String a[]) { ImagePaneTest fr = new ImagePaneTest(); Image icon = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB_PRE); fr.setIconImage(icon); fr.setSize(553, 421); fr.setVisible(true); fr.toFront(); fr.setLocation(370, 200); } } then you export to jar (not runnable jar) using the default options, except for the main class then java -jar my.jar and voilà
has comment: http://stackoverflow.com/comment/39153752
score: 0
has comment: http://stackoverflow.com/comment/39248481
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39157991
has comment: http://stackoverflow.com/comment/39236956
has comment: http://stackoverflow.com/comment/39235706
has comment: http://stackoverflow.com/comment/39154424
type: Answer

http://stackoverflow.com/comment/39183658
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25167015
has text: You don't show any effort to investigate the problem on your own. This is a question that can be solved just by reading the API doc of the constructor you use. This would have taken ~30 sec. Therefore -1.

http://stackoverflow.com/comment/39188038
has text: i have deployed it to a remote jboss instance running on the ip 94.5.19.27 - the thing is - i have no idea what url i need to call it on
type: Comment
comment on: http://stackoverflow.com/a/25169590
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39108354
comment on: http://stackoverflow.com/q/25087650
type: Comment
type: QuestionComment
score: 1
has text: I see your point. I am not sure about actually modifying the code, but you can perform some realtime debugging tasks using visualvm. Even if it does not help you in this case, I would recommend looking it up.

http://stackoverflow.com/comment/39197708
has text: There is a parameter long time, which will be your time I guess.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25174921

http://stackoverflow.com/comment/39118333
score: 2
has text: @user3743409 I'd consider posting another question
type: AnswerComment
comment on: http://stackoverflow.com/a/25132117
type: Comment

http://stackoverflow.com/comment/39056682
score: 0
type: Comment
has text: Yes, they were added to not have a separate util class when you are already implementing an interface, but is it OK to just have an util interface, with static methods that are used, but the interface not being implemented by anyone?
comment on: http://stackoverflow.com/a/25099064
type: AnswerComment

http://stackoverflow.com/q/25128706
upvote count: 1
tagged with: java-native-interface
score: 1
tagged with: java
tagged with: android-ndk
type: Question
downvote count: 0
has title: Android : Accessing the step counter sensor natively through jni
favorite count: 0
has body: I'm trying to access sensors natively and my goal is to access to the step counter sensor in C++ through JNI.Despite the possiblity of accessing the sensors by using NDK headers like in this tuto http://developer.android.com/reference/android/app/NativeActivity.html android/sensor.h but this one doesn't give the access to all sensors (well,it has a good sampling rate compared to java methods). Is there any solution to access to the sensors provided in java through JNI ? Thank you in advance !
tagged with: android-sensors
tagged with: c++
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/25180130
score: 0
has comment: http://stackoverflow.com/comment/39207299
answers question: http://stackoverflow.com/q/25179892
has body: Also, a better/standard approach will be to create an environment variable in the system whose value will contain the path to the propery file. Then in the configuration file, you can write as : file:${your.prop.folder}/myproperties.properties. This Saves efforts when there's a change in your property file location.
type: Answer
has comment: http://stackoverflow.com/comment/45561808

http://stackoverflow.com/q/25194138
has answer: http://stackoverflow.com/a/25194164
type: Question
has body: I have a POJO in my application: class Project{ long id; String name; File[] images; //getter and stter omitted } And I use the form to add/update the Project &lt;form&gt; &lt;input name="project.name" .../&gt; &lt;input name="project.images[0] /&gt; ... &lt;/form&gt; It works well with CRUD operation exception once I want to get the Project with json format. I want to get something like this: {name:"projectname",id:1,images:["http://xx.png","..."]} But I can not since the images filed have the type of File rather than String. I can add another fields to hold the image url like this: class Project{ long id; String name; File[] images; String[] imageURLs; //getter and stter omitted } But I am not sure if this is a good idea, since two fields are used to represent the same thing. I wonder if there is a better alternative solution?
tagged with: pojo
score: 0
answer count: 1
type: UnansweredQuestion
has title: File fields in POJO with json output
has comment: http://stackoverflow.com/comment/39233705
linked to: http://stackoverflow.com/q/5845822
tagged with: java

http://stackoverflow.com/comment/39008702
score: 0
has text: Shallow copy with clone. You need a deep copy.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25073497

http://stackoverflow.com/a/25078601
type: Answer
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/39017969
downvote count: 0
has body: toString() is not a variable, Its a method. You forgot to add () for toString. Those two lines should be System.out.println(cd1.toString()); System.out.println(cd2.toString());
answers question: http://stackoverflow.com/q/25078578
has comment: http://stackoverflow.com/comment/39019894

http://stackoverflow.com/a/25172782
score: 2
upvote count: 2
has body: You are only initializing the newList instance (with newList = new ObjectList()) without putting anything in it, and you are updating the terms of the input list list1. You didn't post the code of ObjectList and ObjectListNode, so I can't say the exact methods you should call in order to add nodes to newList, but you should add a new node to newList for each node of the input list, initialize it to contain a copy of the respective Term of the input list, and update the Term of the newList instead of the Term of the input list. EDIT : You don't pass newList to attach, so the list you are adding terms to is not the same list you initialize in the derivative method. In addition, you shouldn't call setCoeff and setExp on the terms of the input list, since you don't want to change it. Therefore you should replace : t1.setCoeff(0); attach(0,0); with : attach(0,0); And replace : t1.setCoeff(t1.getCoeff()*t1.getExp()); t1.setExp(t1.getExp() - 1); attach(t1.getCoeff(), t1.getExp()); with : attach(t1.getCoeff()*t1.getExp(), t1.getExp() - 1); However, if you want to update the newList created in the derivative method, you should either pass the newList to the attach method, or cancel the attach method and move its content to the derivative method : public ObjectList derivative(ObjectList list1) { newList = new ObjectList(); ObjectListNode p = list1.getFirstNode(); while (p != null) { Term t1 = (Term) p.getInfo(); if (t1.getExp() == 0) { Term t = new Term (0,0); newList.addLast(t); p = p.getNext(); } else { Term t = new Term (t1.getCoeff()*t1.getExp(), t1.getExp() - 1); newList.addLast(t); p = p.getNext(); } } return newList; }
accepted answer of: http://stackoverflow.com/q/25172728
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39194042
type: Answer
answers question: http://stackoverflow.com/q/25172728

http://stackoverflow.com/a/25191508
type: Answer
score: 0
has body: The type "AdView" have this comportament. You define the atributtes size, id... and it have the event click implicit in your implementation, it is automatic. Att.
answers question: http://stackoverflow.com/q/25191412

http://stackoverflow.com/q/25184774
accepted answer: http://stackoverflow.com/a/25185992
tagged with: java
has body: Is there any way in Java, to create a child object in it's parents reference type variable and still have access to any implemented interfaces, without either casting to the interface type OR using the interface reference to store the object? Almost seems like manual polymorphism.
type: Question
possible better answer: http://stackoverflow.com/a/25185247
answer count: 2
has answer: http://stackoverflow.com/a/25185247
has title: Java Beginner - Polymorphism and Interfaces
score: 0
has comment: http://stackoverflow.com/comment/39216561
has comment: http://stackoverflow.com/comment/39216047
has comment: http://stackoverflow.com/comment/39222625
has comment: http://stackoverflow.com/comment/39215407
has answer: http://stackoverflow.com/a/25185992
has comment: http://stackoverflow.com/comment/39215468
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39215800

http://stackoverflow.com/q/25078149
has answer: http://stackoverflow.com/a/25091530
has comment: http://stackoverflow.com/comment/39017394
score: 6
tagged with: garbage-collection
type: AnsweredQuestion
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25091797
type: Question
answer count: 2
has body: I created an array of a class with big length, ~150M elements, sorted by key (describe bellow). Then I build a simple http server to feedback each request as a binary search function on the array. (I'm sure the server's work is fine) Data initiation is just fine (ofcouse quite slow). Binary search function is fast as expected. The problem is: the respond is just fast for a while (10mins, 1 hours... many kind of time range), then server take quite long (some minutes) to do binary search function for a request, then it's fast back, then slow after a while... While it's slow, I check server status (htop), it seems like jvm is in GC. The problem is not happened when I split big array into smaller ones, for ex: 10 arrays of 15M elements, I find the target array before do searching on. So I guess something happens in JVM when I create too large array (Edit: I have no problem on spliting big array into pieces because I implemented the "SiteInfo" object to native, big amount of objects in JVM is decreased. So the problem caused by too many objects I created as replies bellow, thank you guys) Guys do you have any idea for my problem? (I posted my code, there's some Pseudocode that I think it's not really important) public static class Token2TopSite implements Comparable&lt;Token2TopSite&gt; { public final String token; // this is key for binary search public final SiteInfo[] topSites; // just data, not important at this question, I think public Token2TopSite(String token, SiteInfo[] topSites) { this.token = token; this.topSites = topSites; } @Override public int compareTo(Token2TopSite o) { return token.compareTo(o.token); } public static void main(String[] args) { Token2TopSite[] array = new Token2TopSite[150 * 1000000]; ...; // init data for array, this runs properly Arrays.sort(array); startServerOnArray(array); // each request is a element search on the array } }
tagged with: arrays
upvote count: 6
has answer: http://stackoverflow.com/a/25091797
has title: Why big array java is slow
possible better answer: http://stackoverflow.com/a/25091530
favorite count: 0

http://stackoverflow.com/comment/39004678
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25070975
has text: Yes, it's a duplicate. I'll delete this one. I just don't understand anything on the one you linked...I get a "this page has moved" message on your first link...
score: 0

google-maps
tags question: http://stackoverflow.com/q/25202615
tag name: google-maps
tags question: http://stackoverflow.com/q/25156983
tags question: http://stackoverflow.com/q/25136116
tags question: http://stackoverflow.com/q/25112634
tags question: http://stackoverflow.com/q/25098488
tags question: http://stackoverflow.com/q/25145738
tags question: http://stackoverflow.com/q/25098300
tags question: http://stackoverflow.com/q/25076813
tags question: http://stackoverflow.com/q/25170115
tags question: http://stackoverflow.com/q/25180298
tags question: http://stackoverflow.com/q/25220854
tags question: http://stackoverflow.com/q/25098869
type: Tag
tags question: http://stackoverflow.com/q/25095631
tags question: http://stackoverflow.com/q/25081064
tags question: http://stackoverflow.com/q/25073413
tags question: http://stackoverflow.com/q/25092280

http://stackoverflow.com/comment/39798393
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25173034
score: 0
has text: @ScaryWombat I had to completely redo my code and when I did it all worked out.Thank you

http://stackoverflow.com/q/25095868
has body: We have a linux box into which some third party tool drops 0.5MB of data and we have about 32000 similar files. We need to process those files and insert into Oracle10G DB. some one in our organization already has already created a Java program and it is running as a Daemon thread with static fields to map the data in the file and save data into db and clear the static fields for the next line. This is a serial processing of file and it seems so slow. I'm planning to make this multithreaded by getting rid of it, Or, run multiple java processes(same jar but each one will be start with java -jar run.jar) for parallel execution. But, I'm concerned about the data locking etc., issues. Questions is what is the best way to bulk load the data into the DB using Java? Or any other way. Update: the data that we work on is in the following format, we process the below lines, to make entries into db. x.y.1.a.2.c.3.b = 12 // ID 1 of table A onetomany table C 3 ID sequence and its proprty b =12 x.y.1.a.2.c.3.f = 143 // ID 1 of table A onetomany table C 3 ID sequence and its proprty f =143 x.y.2.a.1.c.1.d = 12 Update: We have about 15 tables that take this data. Data is in blocks, each block has related data, and related data will be processed at a time. So you are looking at the following figures when inserting one block Table 1 | Table 2 | Table 3 --------------------------- 5 rows | 8 rows | 12 rows etc.,
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39050837
type: Question
has answer: http://stackoverflow.com/a/30417892
tagged with: java
score: 0
linked to: http://stackoverflow.com/q/6892105
answer count: 2
tagged with: bulkinsert
has comment: http://stackoverflow.com/comment/39050903
has title: Bulk load data into DB
has answer: http://stackoverflow.com/a/25095908

http://stackoverflow.com/q/25158522
has body: I have done my Automation in java using Junit and push that code to bitbucket and integrated it with jenkins. But when i am starting build after creating job it start failling and throwing some error. i am not able get that why it is not taking class path and how i can set class path to avoid this issue Here is error coming on console [javac] C:\Program Files\Jenkins\workspace\ABC-first-job\tst\com\cb\abc\ABCTest.java:110: error: cannot find symbol [javac] Assert.assertTrue(response.contains(ABCConstant.DATA_MESSAGE)); [javac] ^ [javac] symbol: variable Assert [javac] location: class ABCTest [javac] 47 errors BUILD FAILED C:\Program Files\Jenkins\workspace\ABC-first-job\build.xml:48: Compile failed; see the compiler error output for details. Total time: 2 seconds Build step 'Invoke Ant' marked build as failure Finished: FAILURE
has comment: http://stackoverflow.com/comment/39167010
answer count: 1
has comment: http://stackoverflow.com/comment/39166856
has comment: http://stackoverflow.com/comment/39167189
tagged with: java
linked to: http://stackoverflow.com/q/2430445
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39166803
tagged with: bitbucket
score: 3
has comment: http://stackoverflow.com/comment/39167071
downvote count: 0
favorite count: 0
type: Question
has title: Jenkins Build Failed error: cannot find symbol
tagged with: jenkins
has answer: http://stackoverflow.com/a/31115112
upvote count: 3

http://stackoverflow.com/q/25150969
has answer: http://stackoverflow.com/a/25152271
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I made an quick app in Java to see if I was able to connect to my SHOUTcast and stream from it, and it worked with the following code: import java.io.BufferedInputStream; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; import java.net.URL; import javax.swing.JFrame; import javazoom.jl.player.Player; public class Start { public static void main(String[] args){ JFrame window = new JFrame(); window.setVisible(true); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); try { URL url=new URL("http://devllama.pwnz.org:88"); Socket socket=new Socket(url.getHost(), url.getPort()); OutputStream os=socket.getOutputStream(); String user_agent = "BrennynSabar/0.5"; String req="GET / HTTP/1.0\r\nuser-agent: "+user_agent+"\r\nIcy-MetaData: 1\r\nConnection: keep-alive\r\n\r\n"; os.write(req.getBytes()); InputStream is=socket.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); Player player = new Player(bis); player.play(); } catch (Exception e){ e.printStackTrace(); } } } It connects and plays, the audio sounds pretty good, but theres a random squeaking sound in the background, I know its not the SHOUTcast server because you can connect using VLC or something and it wont be there. Also once in a while, the song gets choppy, but I am pretty sure its my connection. Any help will be be awesome, thanks.
upvote count: 1
tagged with: shoutcast
has title: JAVA - JLayer - Squeaky sound and some choppiness, streaming from SHOUTcast
score: 1
tagged with: java
type: Question

struts2
tags question: http://stackoverflow.com/q/25199459
tags question: http://stackoverflow.com/q/25129245
tags question: http://stackoverflow.com/q/25109980
tags question: http://stackoverflow.com/q/25179431
tags question: http://stackoverflow.com/q/25159404
tags question: http://stackoverflow.com/q/25159134
tags question: http://stackoverflow.com/q/25123990
tags question: http://stackoverflow.com/q/25222409
tags question: http://stackoverflow.com/q/25159242
tags question: http://stackoverflow.com/q/25215719
tag name: struts2
tags question: http://stackoverflow.com/q/25179548
tags question: http://stackoverflow.com/q/25137681
tags question: http://stackoverflow.com/q/25180526
tags question: http://stackoverflow.com/q/25112923
tags question: http://stackoverflow.com/q/25137791
tags question: http://stackoverflow.com/q/25173449
tags question: http://stackoverflow.com/q/25193763
tags question: http://stackoverflow.com/q/25201142
type: Tag
tags question: http://stackoverflow.com/q/25219713

http://stackoverflow.com/comment/39018781
comment on: http://stackoverflow.com/q/25078159
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58485/discussion-between-annn-chooor-and-mysticmagic).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39262524
comment on: http://stackoverflow.com/q/25207268
has text: try this http://stackoverflow.com/a/13486223/3396197
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25220463
type: UnansweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: javafx
has body: Is it possible to set the first column in my TableView to be always visible whenever the user scrolls to the right?
has answer: http://stackoverflow.com/a/25244792
type: Question
has comment: http://stackoverflow.com/comment/39282880
tagged with: tableview
answer count: 1
downvote count: 0
has title: TableView fixed first column
favorite count: 0

http://stackoverflow.com/a/76423678
score: 2
has body: There are two different methods: messageAttributeNames() which gets custom attributes send with the message, attributeNames() which gets system attributes linked to the message (retryCount, ...)
downvote count: 0
answers question: http://stackoverflow.com/q/25107605
upvote count: 2
type: Answer

http://stackoverflow.com/q/25109793
has body: I have a recursive method like so: class MyClass { ArrayList&lt;ArrayList&lt;MyNode&gt; allSeriesOfNodes = new ArrayList&lt;ArrayList&lt;MyNode&gt;(); public void myMethod(MyNode currNode, ArrayList&lt;MyNode&gt; nodes) { // make sure currNode and nodes aren't null, blah.... nodes.add(currNode); for(MyNode n: otherNodeList) { for(listItem in n.getList()) { if(...) { myMethod(n, nodes); } } if(currNode is a leaf and nodes is &gt; 1) { allSeriesOfNodes.add(nodes); } Debugging it I noticed when a stack frame pops and the previous stackframe resumes, the nodes list still has the value of currNode although it popped off. nodeslist is a local variable just like currNode, and the recursion should remember the state of nodelist per stack frame. Returning to the previous stackframe, why isn't nodelist A instead of A, B (myMethod(B, nodes) was popped) .
has title: State of an ArrayList in a recursive method
has comment: http://stackoverflow.com/comment/39076753
has answer: http://stackoverflow.com/a/25109872
has comment: http://stackoverflow.com/comment/39077149
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39076717
favorite count: 0
type: UnansweredQuestion
tagged with: recursion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/39076890
type: Question
has comment: http://stackoverflow.com/comment/39076995

http://stackoverflow.com/comment/39067839
comment on: http://stackoverflow.com/a/25103630
score: 0
type: AnswerComment
type: Comment
has text: The `TimerTask` callback is incorrectly synchronized; use `javax.swing.Timer`, as shown in either duplicate.

http://stackoverflow.com/comment/39052858
type: AnswerComment
has text: I really don't understand this. Seems a bit complicated too. I just want to insert a null value, not check anything
type: Comment
comment on: http://stackoverflow.com/a/25096674
score: 0

http://stackoverflow.com/a/25156049
accepted answer of: http://stackoverflow.com/q/25153624
answers question: http://stackoverflow.com/q/25153624
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/39163670
type: AcceptedAnswer
downvote count: 0
has body: I would create qualifiers FooQualifier,HooQualifier and Producer for MyBean, something like this: @ApplicationScoped public class MyBeanProducer { @Produces @FooQualifier public MyBean fooProducer() { return new MyBean(42); } @Produces @HooQualifier public MyBean hooProducer() { return new MyBean(666); } } Then if you somewhere do: @Inject @FooQualifier private MyBean foo; You will have MyBean instance with foo.getSomeProperty() equal to 42 and if you do: @Inject @HooQualifier private MyBean hoo; you will have MyBean instance with foo.getSomeProperty() equal to 666. Another possibility is to have one configurable qualifier: @Target( { TYPE, METHOD, PARAMETER, FIELD }) @Retention(RUNTIME) @Documented @Qualifier public @interface ConfigurableQualifier { @Nonbinding int value() default 0; } and then producer method: @Produces @ConfigurableQualifier public MyBean configurableProducer(InjectionPoint ip){ int somePropertyValue = ip.getAnnotated().getAnnotation(ConfigurableQualifier.class).value(); return new MyBean(somePropertyValue); } then simply calling: @Inject @ConfigurableQualifier(value = 11) private MyBean configurableBean; will result in MyBean instance with someProperty equal to 11.
type: Answer

http://stackoverflow.com/comment/39029864
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25084731
has text: Wow you just barely beat me to it! I'll remove mine since it's a duplicate.
type: Comment

http://stackoverflow.com/q/25224878
has title: ServletContext.getContextPath() always returns root path
has comment: http://stackoverflow.com/comment/39290769
type: Question
has comment: http://stackoverflow.com/comment/39296890
accepted answer: http://stackoverflow.com/a/25228368
score: 0
has body: servletContext.getContextPath() always returns "" when foo is expected. Is there a way to find out exactly which context path a controller resides at? Programmatic spring configuration @Configuration @EnableWebMvc public class WebConfig { @Autowired private ServletContext servletContext; @PostConstruct public void init() { System.out.println(servletContext.getContextPath()); } } web.xml foo org.springframework.web.servlet.DispatcherServlet contextClass org.springframework.web.context.support.AnnotationConfigWebApplicationContext contextConfigLocation some.pkg.WebConfig foo /foo/*
answer count: 1
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25228368
tagged with: java
tagged with: annotations

methodology
tag name: methodology
type: Tag
tags question: http://stackoverflow.com/q/25107016

http://stackoverflow.com/a/26443969
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25074839
has body: Ok, this might be a bit late, but from what I can see you have forgotten to add your newly created menu managers, fileMenu, editMenu and helpMenu,to the menuBar menu manager in the fillMenuBar method: protected void fillMenuBar(IMenuManager menuBar) { final MenuManager fileMenu = new MenuManager("&File", "fi"); final MenuManager editMenu = new MenuManager("&Edit", "edit"); final MenuManager helpMenu = new MenuManager("&Help", "maskithelp"); fileMenu.add(newMenu); fileMenu.add(this.saveAction); fileMenu.add(this.saveAsAction); // these calls are missing menuBar.add(fileMenu); menuBar.add(editMenu); menuBar.add(helpMenu); }

http://stackoverflow.com/a/25139746
has body: Try starting with the suggestions here: https://support.sonatype.com/entries/21437881-Troubleshooting-Artifact-Download-Failures
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25120485
answers question: http://stackoverflow.com/q/25120485
has comment: http://stackoverflow.com/comment/39544684
type: Answer
score: 0

http://stackoverflow.com/comment/39219468
has text: @SQLiteNoob no I don't
score: 0
comment on: http://stackoverflow.com/q/25185650
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39149645
type: AnswerComment
score: 0
has text: What do you mean by "A change to what object Manager locks on"?
type: Comment
comment on: http://stackoverflow.com/a/25148883

http://stackoverflow.com/q/25115832
has comment: http://stackoverflow.com/comment/39088015
has answer: http://stackoverflow.com/a/25116061
favorite count: 0
has answer: http://stackoverflow.com/a/25116066
has title: Downcast in java
upvote count: 1
has comment: http://stackoverflow.com/comment/39088470
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39088059
has comment: http://stackoverflow.com/comment/39087767
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25116066
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39087708
downvote count: 0
has comment: http://stackoverflow.com/comment/39088067
has body: I have two classes: public class Parent{ /* Some Code */ } public class Child1 extends Parent{ /* Some Code */ } public class Child2 extends Parent{ /* Some Code */ } and iI have a HashMap&lt;String, Parent&gt;. Using com.google.gson.Gson I have converted this HashMap to Json: HashMap &lt;String, Parent&gt; criterias = new HashMap &lt;String, Parent&gt;(); Gson gson = new Gson(); Type listOfTestObject = new TypeToken&lt;HashMap&lt;String, parent&gt;&gt;(){}.getType(); String dataCriteria = gson.toJson(criterias, listOfTestObject); In another class I want to retrieve this HashMap: Gson gson = new Gson(); Type listOfTestObject = new TypeToken&lt;HashMap&lt;String, Parent&gt;&gt;(){}.getType(); HashMap&lt;String, Parent&gt; myMap = gson.fromJson(data, listOfTestObject); The problem is that I want to cast the values of HashMap which are instanceOf Child1 to Child1. And I get this exception: java.lang.ClassCastException: Parent cannot be cast to Child1 Is there a solution to downcasting?
possible better answer: http://stackoverflow.com/a/25116061

http://stackoverflow.com/a/25199462
score: 0
type: Answer
has body: you have specified query attribute , but it should be like below, &lt;sql:setDataSource var="con" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/test" user="root" password=""/&gt; &lt;sql:query var="result" dataSource="${con }"&gt; select * from account &lt;/sql:query&gt; &lt;c:forEach var="rows" items="${result.rows }"&gt; ${rows.email} &lt;/c:forEach&gt; it should work as expected
has comment: http://stackoverflow.com/comment/39243573
answers question: http://stackoverflow.com/q/25199272
has comment: http://stackoverflow.com/comment/39244234
has comment: http://stackoverflow.com/comment/39244259
has comment: http://stackoverflow.com/comment/39243499
has comment: http://stackoverflow.com/comment/39244660
has comment: http://stackoverflow.com/comment/39244169

http://stackoverflow.com/a/25197441
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39240056
has body: You're returning null from your sayac method private boolean[] sayac(int i) { for (int x = 0; x &lt; liste.length; x++) { if (i - 1 &gt;= x) { liste[x] = true; } else { liste[x] = false; } } return null; } This means when you try and access it within your actionPerformed method, it triggers a NullPointerException... if (arg0.getSource() == azalt) { defa--; liste = sayac(defa); // I'm null birinci.setVisible(liste[0]); //... } if (arg0.getSource() == arttir) { defa++; liste = sayac(defa); // I'm null birinci.setVisible(liste[0]); //.. Consider this a great oppurtunity to try out the debugger functionality of your IDE and Java. Add a break point just before the indiciated line, run the program in debug mode and inspect the variables and walk back up the stack trace to see where it's comining from...
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25197408
type: Answer
answers question: http://stackoverflow.com/q/25197408
has comment: http://stackoverflow.com/comment/39240066

http://stackoverflow.com/q/25091656
type: Question
score: 0
answer count: 1
tagged with: awtrobot
has body: I am trying to take screenshot with Robot in 1 method and then with another method I am tring to write the BufferedImage produced by Robot without interrupting Robot from capturing screenshots. So far I came up with these: Screenshot Generation: public static void startRecord2() { Thread recordThread = new Thread() { //BufferedImage[] img; @Override public void run() { //int vector_index = -1 , int phase_counter=0; Robot rt; BufferedImage[] img = null; try { rt = new Robot(); record = true; int buffer_index = 0; //boolean newCreatorStarted = false; long very_start = System.currentTimeMillis(), phase_start = 0, phase_end = 0; while (record) { //(cnt == 0 || record) { if(buffer_index==0){ img = new BufferedImage[max_limit]; phase_start = System.currentTimeMillis(); phase_counter++; } //System.out.println("total_frame_created = "+total_frame_created); img[ buffer_index++ ] = rt.createScreenCapture(new Rectangle(screenWidth,screenHeight)); total_frame_created++; //ImageIO.write(img, "jpeg", new File("./"+store+"/"+ System.currentTimeMillis() + ".jpeg")); if(buffer_index==max_limit||!record) { buffer_index=0; CreateImage(img, phase_counter); img = null; System.gc(); phase_end = System.currentTimeMillis(); System.out.println("Time taken in phase #"+phase_counter+" = "+ String.valueOf((phase_end-phase_start)/1000.0)); } } long very_end = System.currentTimeMillis(); System.out.println("Time taken to capture "+total_frame_created+" shots = "+ (very_end-very_start)/1000 ); } catch (Exception e) { e.printStackTrace(); } } }; recordThread.start(); } ImageWriting: public static void CreateImage(BufferedImage[] img, int phase){//, Thread capturerThread) { Thread imageCreatorThread = new Thread(){ @Override public void run(){ int index = 0; while(index&lt;max_limit){ try { if(img[index]!=null) { ImageIO.write(img[index++ ], "png", new File("./"+store+"/"+phase+"_"+index+".png")); img[index-1]=null; }else{ index-=1; break; } } catch (IOException ex) { Logger.getLogger(Recorder.clas…
has title: Java: Taking screenshots and making image with separate threads
tagged with: screenshot
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25091786
tagged with: java

http://stackoverflow.com/comment/39090560
has text: Then you need to use the `f.getValue(o)` method first, passing the object on which you reflected. Do you really want to use reflection?
comment on: http://stackoverflow.com/a/25117271
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/41898354
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25129620
has text: @Akash : Have you found any solution for this ?? Even I ma stuck with the same problem and can't figure out any good document or library.Any help will be greatly appreciated.
score: 0

http://stackoverflow.com/q/25221114
upvote count: 2
has body: How do you transform the following block of code: List&lt;ExecutableElement&gt; methods = ... List&lt;ExecutableElement&gt; hiddens = new ArrayList&lt;&gt;(); for (ExecutableElement hider : methods) { for (ExecutableElement hidden : methods) { if (elements.hides(hider, hidden) || elements.overrides(hider, hidden, type)) { hiddens.add(hidden); } } } methods.removeAll(hiddens); Into something like: methods.removeAll(methods.stream().filter(... ...().collect(Collectors.toList());
has answer: http://stackoverflow.com/a/25221185
tagged with: collections
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
tagged with: java-stream
tagged with: java
type: Question
score: 2
accepted answer: http://stackoverflow.com/a/25221185
answer count: 1
downvote count: 0
has title: How to transform a "nested for each" to Java 8 Lambda/Stream construct?
favorite count: 0
has comment: http://stackoverflow.com/comment/39284138

http://stackoverflow.com/q/25079244
favorite count: 0
has answer: http://stackoverflow.com/a/25079415
has answer: http://stackoverflow.com/a/40837569
type: AnsweredQuestion
tagged with: spring-boot
tagged with: java
has answer: http://stackoverflow.com/a/38792860
tagged with: gradle
has answer: http://stackoverflow.com/a/26141841
type: Question
accepted answer: http://stackoverflow.com/a/25079415
has answer: http://stackoverflow.com/a/43754809
has answer: http://stackoverflow.com/a/25079306
downvote count: 0
possible better answer: http://stackoverflow.com/a/26141841
linked to: http://stackoverflow.com/q/23689054
has answer: http://stackoverflow.com/a/77268209
has answer: http://stackoverflow.com/a/25791430
has answer: http://stackoverflow.com/a/66324190
has body: I'm developing simple Spring web application that communicates with remote host and I would like to test it locally behind corporate proxy. I use "Spring Boot" gradle plugin and the question is how can I specify proxy settings for JVM? I have try several ways to do it: gradle -Dhttp.proxyHost=X.X.X.X -Dhttp.proxyPort=8080 bootRun export JAVA_OPTS="-Dhttp.proxyHost=X.X.X.X -Dhttp.proxyPort=8080" export GRADLE_OPTS="-Dhttp.proxyHost=X.X.X.X -Dhttp.proxyPort=8080" But it seems like none of them work - "NoRouteToHostException" throws in "network" code. Also, I have added some extra code to debug JVM start arguments: RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); List&lt;String&gt; arguments = runtimeMxBean.getInputArguments(); for (String arg: arguments) System.out.println(arg); And only one argument was printed: "-Dfile.encoding=UTF-8". If I set system property in code: System.setProperty("http.proxyHost", "X.X.X.X"); System.setProperty("http.proxyPort", "8080"); Everything works just fine!
score: 122
has answer: http://stackoverflow.com/a/71766276
answer count: 10
has title: How to pass JVM options from bootRun
upvote count: 122

http://stackoverflow.com/comment/39113013
comment on: http://stackoverflow.com/a/25128983
type: AnswerComment
score: 0
type: Comment
has text: @BethTanner if you already have an `Octagon.clone()` method you should be fine to see if it works. **This.side** is actually the better way of retrieving the field- I'll change my answer to reflect that

http://stackoverflow.com/comment/39054946
type: Comment
has text: please refer to http://stackoverflow.com/questions/10475491/javac-compiling-a-java-file-which-uses-other-classes-in-it
comment on: http://stackoverflow.com/q/25098026
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39230945
comment on: http://stackoverflow.com/q/25192119
score: 0
type: Comment
type: QuestionComment
has text: What is your import statement for the class?

http://stackoverflow.com/q/25200958
score: 0
answer count: 1
tagged with: maven-2
has answer: http://stackoverflow.com/a/25201439
type: AnsweredQuestion
has body: I'm trying to use the assembly plugin in order to create a zip file for a specific module of a multi-module Maven project. This module cointains only a bunch of xml and xsl files that needs to be packaged as a zip file (the folder's structure is saved under src/main/resources). So I created the pom below: <?xml version="1.0" encoding="UTF-8"?> foo.bar myserver ${myserver.version} 4.0.0 foo.bar zip-sample Sample zip ${myserver.version} maven-assembly-plugin 2.4.1 bin create-distribution package single but I get the error: [DEBUG] Trace org.apache.maven.lifecycle.LifecycleExecutionException: Unable to build project for plugin 'org.apache.maven.plugins:maven-assembly-plugin': Not a v4.0.0 POM. for project org.apache.maven.plugins:maven-assembly-plugin at /home/gundam/.m2/repository/org/apache/maven/plugins/maven-assembly-plugin/2.3/maven-assembly-plugin-2.3.pom at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1557) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindPluginToLifecycle(DefaultLifecycleExecutor.java:1503) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:1282) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:534) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138) at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.…
tagged with: java
tagged with: maven-assembly-plugin
linked to: http://stackoverflow.com/q/22450277
accepted answer: http://stackoverflow.com/a/25201439
type: Question
has title: Create a zip file using maven

http://stackoverflow.com/comment/39152662
type: QuestionComment
has text: If you are using a custom syntax, then annotation processing is not suitable. Now I am curious, what is your improvement to generics?
score: 0
comment on: http://stackoverflow.com/q/25150472
type: Comment

http://stackoverflow.com/comment/39290212
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25150207
has text: Documents/eclipse/myproject. For machine and ./images/"mypic" for the app

http://stackoverflow.com/comment/39003738
type: QuestionComment
comment on: http://stackoverflow.com/q/25070447
type: Comment
has text: What OS are you using? It looks like mac, but you have `C:/Users/...` Where is your A.class file saved, and what package are you declaring it to use (you're not using the default package, are you)?
score: 0

http://stackoverflow.com/a/25189655
type: Answer
has body: Your PrintTask implements Runnable. You want to call a method that is defined in Thread. You don't have access to the threads that are running inside the Executor, so you can't set their priorities. Create regular Threads instead and you can set their priorities.
downvote count: 0
answers question: http://stackoverflow.com/q/25189624
has comment: http://stackoverflow.com/comment/39226452
score: 3
upvote count: 3

http://stackoverflow.com/a/25145261
has comment: http://stackoverflow.com/comment/39142775
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39142836
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25145047
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39142758
has body: You are setting the size of the JFrame. This includes the Frame Decoration, the Menu Bar (if you have one), and so on. If you want your JPanel to have the Dimensions 800 x 800, set the preferred Size of your JPanel and use JFrame.pack(). To do so, remove the following line from Frametest.java: setSize(WIDTH, HEIGHT); Then, in Panel.java, change this line from //setSize(width, hieght); to: setPreferredSize(new Dimension(800, 800)); Instead of this, you can also overwrite getPreferredSize(): public Dimension getPreferredSize () { return new Dimension(800, 800); }
answers question: http://stackoverflow.com/q/25145047

http://stackoverflow.com/a/25080861
type: Answer
has comment: http://stackoverflow.com/comment/39022555
answers question: http://stackoverflow.com/q/25080819
score: 0
has body: You can use sc.nextInt() for taking input as an integer However if you want to take input as a string then just use Integer.parseInt(String value); This method will take String value as an argument and convert it to Integer.However If the String value can be converted to integer then fine,else this method throws NumberFormatException which you can catch by implementing Exception Handling and avoid your program from crashing. See various ,methods of Scanner class for taking different type of input Scanner in=new Scanner(System.in); integer = in.nextInt(); longInteger = in.nextLong(); realNumber = in.nextFloat(); doubleReal = in.nextDouble(); string1 = in.nextLine();

http://stackoverflow.com/a/25131739
upvote count: 1
answers question: http://stackoverflow.com/q/25125800
score: 1
has body: Every database operation runs inside a transaction, even if you don't explicitly call begin/commit/rollback. If you don't specify the database transaction boundaries then the AUTO-COMMIT mode is assumed. But while auto commit only makes sense from an SQL UI Browser, it doesn't make much sense for an ORM tool or even JDBC running more than one statements in one business method.
accepted answer of: http://stackoverflow.com/q/25125800
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39226145
type: Comment
comment on: http://stackoverflow.com/a/25190141
has text: Use a parser if you want all the values. It will do a much better job and less head ache for you
type: AnswerComment
score: 4

http://stackoverflow.com/comment/39204704
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25174988
has text: what i want to do is to update an Access Database using Java and this is what i write to do this>> can anyone suggest another way to update an access database using java ??
type: AnswerComment

http://stackoverflow.com/a/25210501
upvote count: 2
answers question: http://stackoverflow.com/q/25207613
type: Answer
score: 2
downvote count: 0
has body: There is a fundamental difference between the 2 approach you are showing. The while(true) is a synchronous process. You are in control of the task on that main Thread as you execute your routine within. The proposed refactor approach is asychnoniouyly executing the task since you are offloading the task to and executor (hence a new thread). As mentioned in the other comments, Threads in the executor are created non-daemon. meaning that when a shutdown is called on the application, it will wait to the thread to exit before completing the final shutdown. So to handle this, there is several things you can do to handle a clean shutdown of you executor. The First thing to do what was mention in the other post, you need to find your termination condition. Second, you need to evaluate your process and see if you are doing anything critical that cannot be stop mid process (example write to a file on disk). If you are not doing anything critical (that's the important part here) you can pass a ThreadFactorythat returns a daemon thread. This will make the JVM terminate the process whether or not it is completed. The factory would look something like this (I also added name to it as its always good to name your thread, it makes it easier to debug). public class DaemonThreadFactory implements ThreadFactory { private final String NAME; public DaemonThreadFactory() { this(null); } public DaemonThreadFactory(final String name) { NAME = name; } @Override public Thread newThread(Runnable r) { Thread t = new Thread(r); t.setDaemon(true); if(NAME != null) { t.setName(NAME); } return t; } } One more way you can handle it is to keep the ScheduledFuture returned by the service.scheduleAtFixedRate. With this object, you can cancel the task when you see fit and shutdown the executor at due time. private void test() { ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); ScheduledFuture&lt;?&gt; future = exec.scheduleAtFixedRate(new Task(), 0, 5, TimeUnit.MINUTES); //…

http://stackoverflow.com/comment/39286595
has text: Try using your phone as the emulator and check out it works.... The code looks fine... The problem is the Google play version required is greater than that in your emulator....
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25222415
score: 0

http://stackoverflow.com/q/25111182
has body: I'm using the BarcodeScanner plugin for phonegap, which uses the Google ZXing library for barcode scanning. I installed this phonegap by using the command cordova plugin add https://github.com/wildabeast/BarcodeScanner in my project directory. I have edited some code in the ZXing library so that the app uses the front facing camera rather than the rear camera. I need to find a way to update the ZXing library so that my changes would work. Essentially I need a new com.google.zxing.client.android.captureactivity.jar. How exactly do I do that? Thank you very much in advance.
score: 1
tagged with: java
type: Question
has title: Updating library used in phonegap plugin
downvote count: 0
tagged with: android
favorite count: 0
tagged with: cordova
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/25131530
possible better answer: http://stackoverflow.com/a/25134740
has comment: http://stackoverflow.com/comment/39117424
has comment: http://stackoverflow.com/comment/39118032
tagged with: data-structures
has title: What to use ArrayList or LinkedList or TreeMap?
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/39117864
favorite count: 0
has answer: http://stackoverflow.com/a/25134740
has body: In my problem I have a large set of numbers. At run time I want to insert a number into this sorted series of numbers and grab the number which is next (Ascending next) to the inserted number (Everything is sorted) and then delete the inserted number. There is one more constraint, sometimes The number I want to insert would be exactly equal to some other number in my initial set, in this case too I want to grab the next number. I am confused whether I should use a TreeMap (As a TreeMap is always sorted, but comes with an overhead of a key) A LinkedList (Because entering and removing values becomes easier) or a simple ArrayList? I am loading these numbers into memory and performing intense calculations, my platform is mobile and so I want something which is efficient. Any hints? So far I am using a Linked list although I am not facing any performance issues but I would want to speed up the process.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39117473
has comment: http://stackoverflow.com/comment/39117092
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/25132213
tagged with: java
accepted answer: http://stackoverflow.com/a/25132213
has comment: http://stackoverflow.com/comment/39118058
type: Question
tagged with: performance

http://stackoverflow.com/comment/39220098
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25164427
has text: Here's a similar question with the answer - http://stackoverflow.com/questions/6234473/android-is-there-a-way-to-rotate-a-toast-90-degrees
score: 0

http://stackoverflow.com/a/25081352
answers question: http://stackoverflow.com/q/25081287
has comment: http://stackoverflow.com/comment/39024866
has body: You don't need to encode bind parameters to preparedStatement, // preparedStatement.setString(1 , OracleEncoder.encode(code) ); preparedStatement.setString(1 , code ); The relevant part of the PreparedStatement.setString() JavaDoc says, The driver converts this to an SQL VARCHAR or LONGVARCHAR value (depending on the argument's size relative to the driver's limits on VARCHAR values) when it sends it to the database.
type: Answer
has comment: http://stackoverflow.com/comment/39024834
score: 0

http://stackoverflow.com/q/25105927
tagged with: logging
has answer: http://stackoverflow.com/a/70539364
score: 3
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/2594689
has title: How to check if log4j.properties is loaded?
upvote count: 3
has body: I'm using log4j (compile group slf4j, runtime group logback) with configuration in log4j.properties file. I think I configured it properly with this options log4j.rootLogger=INFO, stdout, file log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n log4j.appender.stdout.threshold=info log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.File=/home/user/logging.log log4j.appender.file.MaxFileSize=5MB log4j.appender.file.MaxBackupIndex=20 log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%-5p [%d{dd.MM.yy HH:mm:ss}] %C{1} - %m [thread: %t]\n log4j.appender.file.threshold=info But when I run debug message like logger.debug("foo") I see output in Console which doesn't match my pattern. Next problem is that nothing is in file (/home/user/logging.log) so I think my properties file is not loaded and don't know how to repair it. I put my log4j.properties file in root level of my eclipse project, in resources (src/main/resources) but still is nothing changed. I have my Project folder in classpath properly. EDIT: The problem was that I'm using Logback (http://logback.qos.ch/) as my runtime Logger, but this library using logback.xml config file, not log4j.properties with org.apache.log4j library.
tagged with: log4j
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25105947

http://stackoverflow.com/comment/39067831
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25094906
type: AnswerComment
has text: Thank you. I actually did the same.. :-) Thank you again. I am still searching how to close the thread.

jquery
tags question: http://stackoverflow.com/q/25156408
tags question: http://stackoverflow.com/q/25201142
tags question: http://stackoverflow.com/q/25228571
type: Tag
tags question: http://stackoverflow.com/q/25075503
tags question: http://stackoverflow.com/q/25200430
tags question: http://stackoverflow.com/q/25146811
tags question: http://stackoverflow.com/q/25205517
tags question: http://stackoverflow.com/q/25152296
tags question: http://stackoverflow.com/q/25133155
tags question: http://stackoverflow.com/q/25072331
tags question: http://stackoverflow.com/q/25097435
tags question: http://stackoverflow.com/q/25072233
tags question: http://stackoverflow.com/q/25077481
tags question: http://stackoverflow.com/q/25100777
tag name: jquery
tags question: http://stackoverflow.com/q/25125620
tags question: http://stackoverflow.com/q/25105973
tags question: http://stackoverflow.com/q/25081504
tags question: http://stackoverflow.com/q/25185194
tags question: http://stackoverflow.com/q/25122660
tags question: http://stackoverflow.com/q/25092348
tags question: http://stackoverflow.com/q/25178372
tags question: http://stackoverflow.com/q/25103426
tags question: http://stackoverflow.com/q/25207519
tags question: http://stackoverflow.com/q/25182014
tags question: http://stackoverflow.com/q/25176050

http://stackoverflow.com/a/25209459
answers question: http://stackoverflow.com/q/25209428
type: Answer
score: 11
upvote count: 11
has body: Shift right by 1 bit: int x = y &gt;&gt; 1;
downvote count: 0

http://stackoverflow.com/a/25144965
answers question: http://stackoverflow.com/q/25143888
upvote count: 1
has body: First of all, enctype of multipart/form-data IS NOT a Spring-MVC thing, it is an attribute of in general web development, which means this attribute can be present in your HTML form regardless the server side technology. You can read more about it here: HTML 5 Candidate Recommendation [Specification] 4 The elements of HTML 4.10 Forms 4.10.22 Form submission 4.10.22.7 Multipart form data, also you can read specifically how the data will be sent by reading RFC2388. If you review it, you will see that data sent in a POST request with multipart/form-data is not a key/value pair anymore, instead it contains multiple parts (yes, it is multi part) where each part looks like this (example belongs to RFC2388): --AaB03x content-disposition: form-data; name="field1" content-type: text/plain;charset=windows-1250 content-transfer-encoding: quoted-printable Joe owes =80100. --AaB03x Note that Joe owes =80100. means Joe owes €100. You can find another example in HTML 4 Specification where it shows a more concrete example when uploading two or more files (my comments are posted after <--): Content-Type: multipart/form-data; boundary=AaB03x <-- mark for the whole request --AaB03x <-- content of a part Content-Disposition: form-data; name="submit-name" <-- field name Larry <-- content of the field --AaB03x <-- content of a part Content-Disposition: form-data; name="files" Content-Type: multipart/mixed; boundary=BbC04y --BbC04y <-- content of a part containing a file Content-Disposition: file; filename="file1.txt" Content-Type: text/plain ... contents of file1.txt ... --BbC04y <-- content of a part containing a file Content-Disposition: file; filename="file2.gif" Content-Type: image/gif Content-Transfer-Encoding: binary ...contents of file2.gif... --BbC04y-- <-- end of parts containing file --AaB03x-- <-- end of whole request data
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39143255
has comment: http://stackoverflow.com/comment/39143694
type: Answer
accepted answer of: http://stackoverflow.com/q/25143888

http://stackoverflow.com/comment/39032338
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25085740
has text: you want to say that i have to use comparable instead of comparator to compare object but how how i maintain TreeSet according to the fields in those object
type: Comment

http://stackoverflow.com/q/25076786
type: Question
tagged with: avro
accepted answer: http://stackoverflow.com/a/25113463
downvote count: 0
has answer: http://stackoverflow.com/a/52118036
answer count: 3
score: 55
has body: Does anyone knows how to create Avro schema which contains list of objects of some class? I want my generated classes to look like below : class Child { String name; } class Parent { list&lt;Child&gt; children; } For this, I have written part of schema file but do not know how to tell Avro to create list of objects of type Children? My schema file looks like below : { "name": "Parent", "type":"record", "fields":[ { "name":"children", "type":{ "name":"Child", "type":"record", "fields":[ {"name":"name", "type":"string"} ] } } ] } Now problem is that I can mark field children as either Child type or array but do not know how to mark it as a array of objects of type Child class? Can anyone please help?
upvote count: 55
has title: How to create schema containing list of objects using Avro?
possible better answer: http://stackoverflow.com/a/52118036
favorite count: 0
has answer: http://stackoverflow.com/a/25113463
type: AnsweredQuestion
tagged with: schema
tagged with: java
has answer: http://stackoverflow.com/a/70420488

http://stackoverflow.com/q/25112495
possible better answer: http://stackoverflow.com/a/25131472
accepted answer: http://stackoverflow.com/a/25112578
score: 1
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/39081666
has title: Casting from Object to Enum
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25112578
has body: So I'm trying to implement a CircularBuffer in Java, to which I can access the underlying array: /* package protected */ class CircularBuffer&lt;E&gt; { private final Object[] mArray; private int mSize; private int headPointer = 0; private CircularBuffer(int size) { mSize = size; mArray = new Object[mSize]; } private void add(E elem) { mArray[headPointer] = elem; headPointer = (headPointer + 1) % mSize; } public E[] getArray() { return (E[]) this.mArray; } } I want to use this with Enums and various primitives (specifically booleans), but everything I call myEnum[] = myCircularBuffer.getArray(), I get a: java.lang.ClassCastException: java.lang.Object[] cannot be cast to com.package.myEnum[] Any tips on making something like this work? Edit: I do know about the Apache CircularFifoQueue, but I don't want to use it since its way more than I need and I'm concerned about package size.
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25131472
answer count: 2
tagged with: arrays
downvote count: 0

http://stackoverflow.com/comment/39120113
score: 0
type: QuestionComment
has text: @MadProgrammer : I didn't quite understand what you mean. Can you please elaborate?
type: Comment
comment on: http://stackoverflow.com/q/25132353

http://stackoverflow.com/comment/39243089
comment on: http://stackoverflow.com/a/25198735
type: AnswerComment
score: 0
type: Comment
has text: `public class Test { public static void main(String args[]){ Test t= new Test(); int a[]={0,10,20,30,80,90}; int b=t.isGreater(70,a); System.out.println(b); } public static int isGreater(int limit, int[] data){ int overLimit = 0; for(int k = 0; k < data.length; k++){ if (data[k] > limit) { overLimit++; } } return (overLimit/data.length)*100; } } ` When I use overLimit as 0 i get 0 as output and when 70 1200 as output. Why?

http://stackoverflow.com/q/25098015
type: Question
score: 1
tagged with: math
tagged with: java
tagged with: matrix-multiplication
has answer: http://stackoverflow.com/a/25098938
tagged with: boolean
has body: Here is my question: How to calcul the Kernel of a Binary Matrix ?? To calcul the Kernel (or Null Space if you prefer) in Java, it's pretty simple in the Real Space, there is already a lot of classes, so don't need to invent the wheel again, we just have to use them ! double[][] data = new double[3][3]; // ... fill the Matrix SimpleMatrix m = new SimpleMatrix(data); SimpleSVD svd = m.svd(); SimpleMatrix nullSpace = svd.nullSpace(); nullSpace.print(); (Theses classes came from : http://efficient-java-matrix-library.googlecode.com/svn-history/r244/javadoc/ver0.14/org/ejml/data/package-summary.html ) The problem is : all theses classes work only in the Real space, and I need to do it in Z/2Z (or in the Binary space if you prefer) and I don't have the idea of how to do it ? Do you know any good API in Java to work with Boolean Matrix ? Or do you have any idea of how to do this kernel calcul with booleans and not real... ? Thanks a lot in advance ! Cheers !
answer count: 1
favorite count: 0
tagged with: matrix
has title: Null Space Binary Matrix : Java
accepted answer: http://stackoverflow.com/a/25098938
type: AnsweredQuestion
upvote count: 2
downvote count: 1

http://stackoverflow.com/comment/39283827
has text: A java.util.Date *has no format*. Its `toString` method generates a String representation of the date-time value in a certain (inconvenient, poorly chosen) format **and** applies your JVM’s current default time zone. Tip: [Joda-Time](http://www.joda.org/joda-time/)
score: 0
comment on: http://stackoverflow.com/q/25217356
type: Comment
type: QuestionComment

http://stackoverflow.com/a/51990587
has body: Recently i had this issue &amp; i did a few workaround to make things right, Drag and dropped from official page, normally eclipse restarts after the download, and a pop-up will ask us to select the svn connectors from list. but that didn't happened to me. Install svn Plugin. (By drag and drop or install new software or any) After this goto window-&gt;preferences-&gt;Team-&gt;svn select Connector Tab and click Get connectors Button then the prompt will appear select any one connector to get it done (i use NativeHL 1.8).
type: Answer
answers question: http://stackoverflow.com/q/25094583
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/comment/39259124
type: QuestionComment
score: 2
has text: That looks like a micro optimization. You should not worry about it until you demonstrate it has performance issues demonstrated by usage of a profiler.
comment on: http://stackoverflow.com/q/25207823
type: Comment

http://stackoverflow.com/comment/40133690
type: AnswerComment
has text: I think it's worth pointing out the possibility of memory leaks due to storing a Horse entity
type: Comment
comment on: http://stackoverflow.com/a/25099503
score: 0

http://stackoverflow.com/a/25105342
answers question: http://stackoverflow.com/q/25105265
has body: There is no specific way to do that. It is purely based on what you wanna do. You can either have a setter to set the value after initializing the instance. Or you can have a parameter constructor and pass the value at the initializing point. Or even you can have fixed value if you want at the initializing. It is entirely up to you to decide what is the best approach for you to what you are trying to do.
has comment: http://stackoverflow.com/comment/39068177
score: 1
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/39295259
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25226406
has text: In your suggestion, `context.xml` is the wepapp's `context.xml`. Is there a way to accomplish the requirement without modifying any file of the webapp?
type: AnswerComment

http://stackoverflow.com/q/25129846
type: AnsweredQuestion
score: 2
upvote count: 2
type: Question
has title: Manually locking of DB necessary even if I use Hibernate/Postgresql/JDBC?
has comment: http://stackoverflow.com/comment/39114536
tagged with: java
tagged with: hibernate
tagged with: database
has answer: http://stackoverflow.com/a/25129978
has comment: http://stackoverflow.com/comment/39114302
has comment: http://stackoverflow.com/comment/39114156
tagged with: locking
has comment: http://stackoverflow.com/comment/39114337
answer count: 1
downvote count: 0
has body: Sorry to ask this in case it has been answered before, but I heard (from a potential other noob) that Hibernate has/had some kind of connection pool manager that also handles locking of the database. Now I read this was abolished in Hibernate 3 so I, as a noob, am very confused what to use. I have a Postgresql db with multiple clients that each use max. one db connection at any given time. I use JDBC but want to move to Hibernate. So in case two concurrent update operations occur, I don't know if this is handled by the DBMS correctly. I thought about locking a db table manually in case someone operates on it, but there must be a better way. I only operate with simple, single sql-statements, sometimes prepared statements. No big updates, just single line updates. Do you have any idea how this, generally, is to be solved? Is this even a problem?
favorite count: 0
tagged with: postgresql
accepted answer: http://stackoverflow.com/a/25129978
has comment: http://stackoverflow.com/comment/39114561

http://stackoverflow.com/q/25076030
has answer: http://stackoverflow.com/a/43677276
has comment: http://stackoverflow.com/comment/39013264
has comment: http://stackoverflow.com/comment/39013419
tagged with: jackson
score: 15
has comment: http://stackoverflow.com/comment/39013311
answer count: 3
accepted answer: http://stackoverflow.com/a/25076147
downvote count: 0
tagged with: deserialization
favorite count: 0
has title: Prevent float to int conversion when deserializing with Jackson
possible better answer: http://stackoverflow.com/a/38472723
has answer: http://stackoverflow.com/a/38472723
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25076147
type: Question
has body: I have a JSON payload with the following structure: { "age": 12 } It is mapped to the following class: public class Student { private Integer age; public Integer getAge(){return age;} public void setAge(Integer age){this.age = age;} } At the moment, if the user submits a float value for the age, the decimals are ignored and the only the integer part is accepted. What I want to do is prevent the user from submitting a payload with a float value for the age (see below) and throw an exception (something like "invalid JSON value for field 'age' at line 8 col 5" - as is the standard message when deserialization fails). { "age": 12.7 // will be truncated to 12 } I was thinking of implementing a custom deserializer for numeric values, but I was wondering if there is a simpler way to achieve this.
upvote count: 15

http://stackoverflow.com/q/25228014
type: AnsweredQuestion
has title: 'messy' string to int conversion java
accepted answer: http://stackoverflow.com/a/25228060
has body: In my code I need to convert a String to an Integer - the String comes from the extraction of metadata, which is then compared to a array of numbers and their corresponding genres. Unfortunately the string doesn't simply contain numbers, it contains some spaces and brackets, meaning the usual: String genre = mf.genre(byteArr); // this gets the metadata from the byte array (It's of no consequence to this but it makes it easier to understand) int genreInt = Integer.parseInt(genre); System.out.println(genreInt); doesn't work, returning Exception in thread "main" java.lang.NumberFormatException: For input string: " (13)" As the 13 (for example) is the only part of this I want/need, what would be the easiest way to go about obtaining just this number from the 'messy' string? thanks
tagged with: types
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/39296688
tagged with: integer
score: 0
has answer: http://stackoverflow.com/a/25228060
tagged with: java
type: Question

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

inheritance
tags question: http://stackoverflow.com/q/25183340
tags question: http://stackoverflow.com/q/25098726
tags question: http://stackoverflow.com/q/25187922
tag name: inheritance
tags question: http://stackoverflow.com/q/25143096
tags question: http://stackoverflow.com/q/25084286
tags question: http://stackoverflow.com/q/25169363
tags question: http://stackoverflow.com/q/25197450
tags question: http://stackoverflow.com/q/25209100
tags question: http://stackoverflow.com/q/25102051
tags question: http://stackoverflow.com/q/25158362
type: Tag
tags question: http://stackoverflow.com/q/25132635
tags question: http://stackoverflow.com/q/25081630
tags question: http://stackoverflow.com/q/25144967
tags question: http://stackoverflow.com/q/25107048
tags question: http://stackoverflow.com/q/25142607
tags question: http://stackoverflow.com/q/25226767
tags question: http://stackoverflow.com/q/25220364
tags question: http://stackoverflow.com/q/25115138
tags question: http://stackoverflow.com/q/25093645
tags question: http://stackoverflow.com/q/25093245
tags question: http://stackoverflow.com/q/25169175
tags question: http://stackoverflow.com/q/25110725

http://stackoverflow.com/comment/39153172
type: QuestionComment
comment on: http://stackoverflow.com/q/25150456
has text: @ajib you are totally correct, had a brain fart. So to clarify, it should be 26 long, and then you can subtract the char encoding offsets of the letters to index into the array. Then in this case you have to worry about upper and lower case letters if you have to handle them differently.
score: 0
type: Comment

http://stackoverflow.com/comment/39200803
comment on: http://stackoverflow.com/a/25096465
type: AnswerComment
has text: First and before moving forward, as I mentioned in my answer the static files should go under ***WebContent*** folder and not under *_StackOnHandPortler*. So please update your configuration and feed me back with results :)
score: 0
type: Comment

http://stackoverflow.com/a/25174988
has body: Dataconnection dbconnect = new Dataconnection(); Connection con = null; PreparedStatement ps = null; ResultSet rs = null; try { con = dbconnect.getConnection(); ps = con.prepareStatement("query"); rs = ps.executeQuery(); while(rs.next()) { } } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } finally { try { if (rs != null) { rs.close(); rs = null; } if (ps != null) { ps.close(); ps = null; } if (con != null) { con.close(); con = null; } } catch (Exception ee) { System.out.println(ee.getMessage()); ee.printStackTrace(); }
has comment: http://stackoverflow.com/comment/39199280
downvote count: 3
has comment: http://stackoverflow.com/comment/39204704
answers question: http://stackoverflow.com/q/25174255
upvote count: 0
has comment: http://stackoverflow.com/comment/65934473
type: Answer
score: -3

http://stackoverflow.com/comment/39184678
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25167634
has text: user3433370 - just input more strings, and you should be golden. Look at my example before for more details, if you wish.
score: 0

http://stackoverflow.com/q/25211252
tagged with: jakarta-ee
has body: EJBs in Hibernate. Is there any equivalent to dependency injection @EJB(mappedName = FoobarServiceInterface.JNDI_NAME_LOCAL) private FoobarServiceInterface foo; when foo is a local variable? I managed to use either @EJB annotation for class members or FoobarServiceInterface bar = (FoobarServiceInterface)InitialContext.doLookup(FoobarServiceInterface.JNDI_NAME_LOCAL); to do a lookup, if bar is a local variable. However, I wonder if there is any annotation that can be used on local variables such as @EJB for class member variables.
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25266292
type: Question
has title: Equivalent to @EJB annotation for local variables?
answer count: 2
tagged with: ejb
score: 0
has answer: http://stackoverflow.com/a/25211690
type: UnansweredQuestion
tagged with: annotations

http://stackoverflow.com/comment/39122137
has text: Oh; your dual use of "contained" was confusing. You could perhaps store the superstring list in a modified [suffix tree](http://en.wikipedia.org/wiki/Suffix_tree) of sorts, for fast lookups of substrings. But you should be sure your performance requirements aren't being met, that your bottleneck is here, and that your program is actually complete and functioning correctly before doing this, and prefer clarity over optimization.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25134222

http://stackoverflow.com/a/25243461
answers question: http://stackoverflow.com/q/25150640
score: 0
has body: You need to clarify what you nean by "link the sip server". The way it works is as follows: 1. Create the sip stack. Do not specify an ip address here. That is deprecated. 2. Create the listening point from the stack but here specify ip,port,transport. 3. Get sip provider. 4. Add the listener. To register you have to create a sip register request, a client transaction using the provider for that request and send the request using that transaction. When ac invite comes in, get the from header and display the address.
has comment: http://stackoverflow.com/comment/39430756
has comment: http://stackoverflow.com/comment/39418366
type: Answer

http://stackoverflow.com/a/26037165
type: AcceptedAnswer
has body: Finally, i have found the workaround to make things work, i am sharing this for someone coming here looking for the answer. As of now, there is no direct method available (correct me if i am wrong). Only way i know to make this work is to create a SmbFile using. SmbFile smbFile = new SmbFile(filePath, ntlmAuth); then, create inputstream out of smbFile by using, InputStream is = new SmbFileInputStream(smbFile); Convert inputstream to byte array using Apache Commons IOUtils (other methods can also be used, my choice was Apache). byte[] fileBytes = IOUtils.toByteArray(is); Create ByteArrayPartSource object, PartSource ps = new ByteArrayPartSource(fileName, fileBytes); Then FilePart can be created using the partsource object. new FilePart("uploadedFile", ps); Voila, now you can upload your file using Apache Commons HttpClient. Anyone having better approach than this, please feel free to post.
type: Answer
accepted answer of: http://stackoverflow.com/q/25112870
score: 2
answers question: http://stackoverflow.com/q/25112870
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/39204093
type: QuestionComment
score: 1
has text: Seems easy enough to try and see.
comment on: http://stackoverflow.com/q/25178586
type: Comment

http://stackoverflow.com/comment/39229287
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25191350
has text: Yup, it's confusing! - and frustratingly so given it's such a foundational concept! @ajb

http://stackoverflow.com/comment/39327143
type: AnswerComment
has text: @user2363727 Documentation is probably best. Whether a lambda is *legal* is part of the language, and annotations (mostly) do not affect the legality of a program construct. An annotation like @NotFunctional might generate a warning but it wouldn't seem to me to add much value. It's hard for me to imagine how someone could try to use a lambda for `Comparable` in such a way that it would cause a logic error (as opposed to a compile time error). Someone could try but they'd quickly realize it doesn't make sense. So having the compiler check this somehow doesn't seem worthwhile.
type: Comment
comment on: http://stackoverflow.com/a/25224517
score: 3

http://stackoverflow.com/q/25077237
tagged with: slf4j
score: 0
accepted answer: http://stackoverflow.com/a/25077320
answer count: 1
tagged with: log4j
has comment: http://stackoverflow.com/comment/39015741
tagged with: logging
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/12481605
tagged with: java
has answer: http://stackoverflow.com/a/25077320
type: Question
has body: I have a bean that instantiates a schema through a static block, so that it is loaded once for every instance of MyClass. However I never see the logging (only saw it once when I entered the wrong path to the file, so that was the logging from the exception). If I replace the logging with System.out.println() it shows up in the console. My project uses SLF4J and LOG4J. I've seen this question: Putting Logger.info in static block which claims that LOG4J should have been initialized by the time the static block gets executed. My hunch is that by using SLF4J this is no longer guaranteed. Is that correct? private static final Logger LOGGER = LoggerFactory.getLogger(MyClass.class); private static Schema XSD_SCHEMA = null; static { // NB The logging in this static block does not always appear in the output. It seems // that the indirection between SLF4J and LOG4J causes slow initialization of the logging // framework. if (XSD_SCHEMA != null) { LOGGER.info("Reading schema..."); SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = null; try { schema = sf.newSchema(new File("some.xsd")); LOGGER.info("Read schema successfully, using validation..."); } catch (SAXException e) { LOGGER.error("Could not load validation schema, not using validation (Reason {})", e); } XSD_SCHEMA = schema; } }
has title: Where does my logging go?

http://stackoverflow.com/comment/39053035
type: Comment
has text: you are just reading first line. Is it OK?
type: QuestionComment
comment on: http://stackoverflow.com/q/25097116
score: 0

http://stackoverflow.com/a/25179116
answers question: http://stackoverflow.com/q/25178052
downvote count: 0
score: 1
upvote count: 1
has body: When you need to add a new component as a maven module with many packages, maybe this would be a suitable approach. The module itself is then part of a multi module project (see Maven by Example): Component [Name of the maven module] src main java com.module.a com.module.b ... resources META-INF module test java resources
type: Answer

http://stackoverflow.com/comment/39284002
type: QuestionComment
has text: Can you add the template of your DAO? maybe does not implement a DAO interface
comment on: http://stackoverflow.com/q/25220144
score: 0
type: Comment

http://stackoverflow.com/comment/39041825
has text: Ok yes, I have found a solution!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25090915

http://stackoverflow.com/comment/39225926
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25189388
type: QuestionComment
has text: Give this a read http://www.ragorder.com/twitter-test-account-testing-the-twitter-api-with-a-temporary-account/

http://stackoverflow.com/a/25229255
has comment: http://stackoverflow.com/comment/117568974
type: Answer
upvote count: 3
score: -4
downvote count: 7
has body: DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy MM dd"); String text = date.toString(formatter); LocalDate date = LocalDate.parse(text, formatter); I believe this might help, you may need to use some sort of localdate variation instead of instant
answers question: http://stackoverflow.com/q/25229124

http://stackoverflow.com/comment/39076762
type: Comment
comment on: http://stackoverflow.com/q/25109590
score: 0
type: QuestionComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58584/discussion-between-tim-the-enchanter-and-madprogrammer).

http://stackoverflow.com/a/25222545
type: Answer
answers question: http://stackoverflow.com/q/25222406
has body: That is incorrect. The documentation for Object.equals(Object) has a formal explanation of the contract for extending this method. Essentially the intent for the Object.equals method is to check if two objects are actually the same object. However it often makes sense to override this functionality and instead make your class' equals method determine whether two objects are logically equal to each other (for example, two different instances of String objects which both represent the same sentence). On the other hand, Object.hashCode() specifies the following contract: The general contract of hashCode is: Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result. It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables. As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java™ programming language.) Basically, two different objects (either logically different or technically distinct) may have the same hashcode, because of how hashcodes are designed, but they should not be "equals". However, if two …
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/25117586
score: 0
answers question: http://stackoverflow.com/q/25117417
type: Answer
has body: public class HttpPosrHitter { public static String getJSONfromURL(String url, String member_id, String phonenumber) { InputStream is = null; String result = ""; JSONObject jArray = null; try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); List&lt;NameValuePair&gt; pairs = new ArrayList&lt;NameValuePair&gt;(); pairs.add(new BasicNameValuePair("memberid", member_id)); pairs.add(new BasicNameValuePair("numbers", phonenumber)); httppost.setEntity(new UrlEncodedFormEntity(pairs)); // http post HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); result = EntityUtils.toString(entity); //changes Made } catch (Exception e) { Log.e("log_tag", "Error in http connection " + e.toString()); } try { jArray = new JSONObject(result); } catch (JSONException e) { Log.e("log_tag", "Error parsing data " + e.toString()); } return result; } }
has comment: http://stackoverflow.com/comment/39092736
has comment: http://stackoverflow.com/comment/39091089
has comment: http://stackoverflow.com/comment/39099742

http://stackoverflow.com/a/50301326
upvote count: 83
answers question: http://stackoverflow.com/q/25147094
downvote count: 0
has comment: http://stackoverflow.com/comment/100478737
type: Answer
has body: The flatMap method on Stream can certainly flatten those lists for you, but it must create Stream objects for element, then a Stream for the result. You don't need all those Stream objects. Here is the simple, concise code to perform the task. // listOfLists is a List&lt;List&lt;Object&gt;&gt;. List&lt;Object&gt; result = new ArrayList&lt;&gt;(); listOfLists.forEach(result::addAll); Because a List is Iterable, this code calls the forEach method (Java 8 feature), which is inherited from Iterable. Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. And a List's Iterator returns items in sequential order. For the Consumer, this code passes in a method reference (Java 8 feature) to the pre-Java 8 method List.addAll to add the inner list elements sequentially. Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).
score: 83

http://stackoverflow.com/comment/39072417
type: Comment
has text: Well, I think its the file.txt name problem..
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25106647

http://stackoverflow.com/q/25141511
tagged with: vert.x
downvote count: 0
tagged with: neo4j
tagged with: jackson
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39163611
has answer: http://stackoverflow.com/a/44161973
upvote count: 3
type: Question
score: 3
has comment: http://stackoverflow.com/comment/39146173
tagged with: java
has body: I'm working on neo4vertx, a module that makes it possible to talk to a Neo4j database using Vert.x. Specifically, I'm working on feature called "query" which allows a Vert.x user to send a Cypher query as an eventbus message and get a JSON resultset back. However, I seem to run into an unexpected problem when serializing to JSON using JsonHelper.createJsonFrom() with certain queries. A quick example (database has stuff in it of course): // This Fails with JsonMappingException (see below): String query="MATCH (n) RETURN n"; // This Succeeds: String query="MATCH (n) RETURN n.something"; //Rest of code: engine = new ExecutionEngine(graphDatabaseService); ExecutionResult result; result = engine.execute(query); Object object = result.iterator(); String foo = JsonHelper.createJsonFrom(object); System.out.println("DEBUG (foo): " + foo); Does this look familiar to anyone? We essentially want to be able to send any kind of query and either return an empty json string or a json representation not unlike the result.json that you can retrieve from the web interface of neo4j! The Exception: testQuery(org.openpcf.neo4vertx.neo4j.Neo4jGraphTest) Time elapsed: 2.362 sec &lt;&lt;&lt; ERROR! org.neo4j.server.rest.domain.JsonBuildRuntimeException: org.codehaus.jackson.map.JsonMappingException: No serializer found for class org.neo4j.kernel.InternalAbstractGraphDatabase$DependencyResolverImpl and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: scala.collection.convert.MapWrapper["content"]-&gt;org.neo4j.kernel.impl.core.NodeProxy["graphDatabase"]-&gt;org.neo4j.test.["dependencyResolver"]) ...
has answer: http://stackoverflow.com/a/25172246
has answer: http://stackoverflow.com/a/27012464
has title: Neo4j Cypher results as JSON: Getting JsonMappingException when using JsonHelper.createJsonFrom() but only with certain queries
answer count: 3
has comment: http://stackoverflow.com/comment/39171994

http://stackoverflow.com/a/25097474
type: Answer
has body: As you didn't specify the error or warning I'll give a general answer. If you hover over the words that are underlined then they will give you a brief description of the problem. In eclipse you can use the shortcut alt + enter to get suggestions on how to solve the problem. If the problem is an error then it will be highlighted red. Else, if it is a warning then it will be underlined yellow. An error is a fault in the code you wrote where a warning is more of a suggestion from a good friend telling you to fix something.
score: 1
has comment: http://stackoverflow.com/comment/39054655
answers question: http://stackoverflow.com/q/25097362
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39054374

http://stackoverflow.com/a/25111333
answers question: http://stackoverflow.com/q/25090301
has body: Not sure why you want to check the question based on the keyword, it has some drawbacks like mentioned by HCBPshenanigans But to change it to be more flexible, I would do something like this: An interface for all question handlers public interface IQuestionHandler { bool CanHandle(string question); void Handle(string question); } Concrete class for each scenario. Each class will tell whether it can handle the question or not, and contain logic to handle the question: public class HealthQuestionHandler : IQuestionHandler { public bool CanHandle(string question) { return question.StartsWith("How") &amp;&amp; question.EndsWith("Josh?"); } public void Handle(string question) { //Replace by actual processing string healthStatus = "I'm fine"; Console.WriteLine(healthStatus); } } public class MotherQuestionHandler : IQuestionHandler { public bool CanHandle(string question) { return question.StartsWith("Who") &amp;&amp; question.EndsWith("mother?"); } public void Handle(string question) { //Replace by actual processing string mother = "..."; Console.WriteLine(mother); } } And finally a question handler processor to manage all the handlers. It will register all available handlers in constructor. When called to process, it goes through all of available handlers, ask one by one which one can handle the question public class QuestionHandlerProcessor { private List&lt;IQuestionHandler&gt; _handlers; public QuestionHandlerProcessor() { //Register available handlers _handlers = new List&lt;IQuestionHandler&gt; { new HealthQuestionHandler(), new MotherQuestionHandler() }; } public void Process(string question) { foreach(var handler in _handlers) { if(handler.CanHandle(question)) { handler.Handle(question); return; } } Console.WriteLine("Question not recognized"); } } Usage: QuestionHandlerProcessor processor = new QuestionHandlerProcessor(); processor.Process("How are you Josh?"); processor.Process("Who is Josh's mother?"); Although my answer is in C#, but should not be difficult t…
downvote count: 0
has comment: http://stackoverflow.com/comment/39103916
type: Answer
has comment: http://stackoverflow.com/comment/39112847
score: 1
upvote count: 1

http://stackoverflow.com/a/25163090
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25162138
score: 1
has body: The question is mainly about the first issue. Do you consider an empty string a good choice to indicate "nothing", which is infact a specific object state? An empty String is a perfect choice to display nothing. You just can throw it into your GUI without needing to null-check it every time. But: A display string is a poor choice for holding object state. You should have some kind of datamodel holding the state of if there has been a warning or not. And that should be (the only) source for the "enabled"-state of your control. This is also clearer to "Outsiders" as you call them. boolean DataModel.hasWarning() - something like that...
downvote count: 0

http://stackoverflow.com/q/25213636
has title: Is this how to re-use code in OOP?
tagged with: java
has comment: http://stackoverflow.com/comment/39270111
tagged with: random
score: 2
has comment: http://stackoverflow.com/comment/39270244
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/25213700
has body: I have a class with a method that generates random data to fill arrays with. The class had the data member private final Random rnd that is initialized in the constructor with new Random();. This is used in the method for generating data for arrays. For example package test; import java.util.Random; public class WorkWithArrays { WorkWithArrays(Object[] arr) { rand = new Random(); fillArrays(arr); } /*fills arrays with random data; since this method is called from constructor must be declared final*/ public final void fillArrays(Object[] arr) { //code goes here } /*some other methods and data members*/ final private Random rand; } I am writing a new class which I also need to fill arrays with random values. Is there a way I could not have to rewrite the same method? I could extend the class or I could make the method static. Since I only need fillArrays() making it static seems like the better option over extending. So let's make it static. public static final void fillArrays(Object[] arr) { //code goes here } Now fillArrays() uses rand which is a problem because rand isn't static. So why not make it static? Now in WorkWithArrays we no longer initialize rand in the constructor but have it final static private Random rand = new Random(); as a data member. Is this right? It seems like bad practice to initialize things outside of the constructor. Now I can do package test; MyNewClass { someMethod() { int[] x = new int[25]; WorkWithArrays.fillArrays(x); } }
favorite count: 0
has answer: http://stackoverflow.com/a/25213817
answer count: 3
linked to: http://stackoverflow.com/q/2223386
has comment: http://stackoverflow.com/comment/39270165
has comment: http://stackoverflow.com/comment/39270256
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/137975
linked to: http://stackoverflow.com/q/335311
has answer: http://stackoverflow.com/a/25213660
type: Question
has comment: http://stackoverflow.com/comment/39270128
tagged with: oop

http://stackoverflow.com/comment/39154520
type: Comment
type: QuestionComment
has text: Exactly, its just the method of how I'm going to go about doing it is where I have no clue.
comment on: http://stackoverflow.com/q/25151300
score: 0

http://stackoverflow.com/a/25087811
type: Answer
has body: You could do this static boolean stopLoop = false; static int[] runLoop(int i, int j) { for(;i&lt;100;i++) { if(stopLoop) return new int[i, j]; String[] articles = getArticles(i); for(;j&lt;articles.length;j++) { process(articles[i]); } j = 0; } }
answers question: http://stackoverflow.com/q/25087650
score: 0

http://stackoverflow.com/comment/39301067
type: Comment
type: QuestionComment
score: 0
has text: Please check c length becz may second array element is null or empty.
comment on: http://stackoverflow.com/q/25230003

http://stackoverflow.com/a/25167675
has comment: http://stackoverflow.com/comment/39184810
accepted answer of: http://stackoverflow.com/q/25167305
answers question: http://stackoverflow.com/q/25167305
score: 0
type: AcceptedAnswer
has body: g.dispose() doesn't clear the screen. After g = bs.getDrawGraphics(); You have to do that yourself. g.setColor(Color.black); g.fillRect(0,0,getWidth(),getHeight());
type: Answer
has comment: http://stackoverflow.com/comment/39184754

http://stackoverflow.com/comment/39254598
has text: The first thing you put with <cached-connection-manager debug="true"/>, it didn't really work and my server wouldn't load. It may have to do with the existing elements I have in that node. In any event the debugging did help me find the leak, so thanks!
type: Comment
comment on: http://stackoverflow.com/a/25200588
type: AnswerComment
score: 0

http://stackoverflow.com/q/25223219
tagged with: java
answer count: 1
has title: Java Swing and ActionListeners
has answer: http://stackoverflow.com/a/25223258
type: AnsweredQuestion
tagged with: jframe
score: 0
has comment: http://stackoverflow.com/comment/39287780
has body: I am still new to using Swing and creating GUIs in Java. I was working on a simple test code where the color of a button changes to a random color when it is pressed. Although it works, every time I press the button, it minimizes the previous window and opens a new one and they keep piling up. How will I make it so that this does not happen? Does this occur because I am creating an object in the actionPerformed method? The reason why I have made an object there is to link the Swing class with the separate Action class I have made in order to manipulate the button variable. Therefore, my two questions are: How can I prevent multiple windows from appearing and instead have them replace each other? Is there a way to utilize ActionListener within the same class and would it make things easier? Any help is greatly appreciated! import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Random; import javax.swing.*; public class Swing extends JFrame{ private JFrame f; private JLabel l; private JButton b; private JPanel p; public Swing(){ test(); } //* public JFrame getJFrame(){ return f; } public JLabel getJLabel(){ return l; } public JButton getJButton(){ return b; } public JPanel getJPanel(){ return p; } //* public void test(){ // Frame Setup f = new JFrame("Frame"); f.setVisible(true); f.setSize(500, 500); f.setResizable(true); f.setDefaultCloseOperation(EXIT_ON_CLOSE); // // Panel Setup p = new JPanel(); p.setVisible(true); // // Other b = new JButton("Button"); l = new JLabel("Label"); b.addActionListener(new Action()); // // Additions p.add(b); p.add(l); f.add(p); // *** // } public static void main(String[] args){ Swing swing = new Swing(); swing.test(); } } final class Action implements ActionListener{ public void actionPerformed(ActionEvent e){ Swing swingObject = new Swing(); // JButton button = swingObject.getJButton(); // button.setBackground(randomColor()); } public Color randomC…
tagged with: swing
type: Question
tagged with: actionlistener
accepted answer: http://stackoverflow.com/a/25223258

http://stackoverflow.com/comment/39107633
type: QuestionComment
comment on: http://stackoverflow.com/q/25126256
score: 0
type: Comment
has text: When your bean is `@Configurable`, Spring won't auto inject it for you, you have to create the instance manually e.g. `IBankService bankService = new BankService();`

http://stackoverflow.com/comment/39187012
type: AnswerComment
has text: @Holger The last time I did this I modified the ThreadGroup and unfortunately that still seems to eb the only option. Perhaps that is not a good idea however `threadTerminated(Thread)` will be called.
comment on: http://stackoverflow.com/a/25146965
type: Comment
score: 0

http://stackoverflow.com/comment/39137401
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25142526
has text: @WilliamF.Jameson but these *concurrent versions* of the collections framework already have this locking handling and allow atomic operations on them. Again: why to reinvent the wheel?
score: 0

http://stackoverflow.com/q/25200321
type: UnansweredQuestion
tagged with: php
has title: Java readLine and PHP write interaction
has comment: http://stackoverflow.com/comment/39244959
answer count: 0
tagged with: tcp
tagged with: java
type: Question
tagged with: client-server
has comment: http://stackoverflow.com/comment/39244853
score: 0
has body: I have a strange trouble with TCP server (Java) and client (PHP). Java server hangs at a readLine.. Please see code above. Java server: while (true) { Socket clientSocket = null; try { clientSocket = serverSocket.accept(); } catch (IOException e) { System.err.println("Accept failed."); System.exit(1); } PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true); BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream(), "UTF-8")); String inputLine; if ((inputLine = in.readLine()) != null) { System.out.println("Server: " + inputLine); out.println(handleCommand(inputLine)); } else { System.out.println("Ooops..."); } } PHP client: $fp = fsockopen("127.0.0.1", 6789, $errno, $errstr, 30); $result = ''; if (!$fp) { ErrorLog(ALERT, "-", "Unable to connect to java server! $errstr ($errno)"); $result = 'ERROR|Unable to connect to RmServer'; } else { fwrite($fp, $command.PHP_EOL); while (!feof($fp)) { $result .= fgets($fp, 128); } fclose($fp); } I also tried on a client side: fwrite($fp, $command."\n"); fwrite($fp, $command."\r\n"); But result is the same. But when I use Java client it works fine! May be it is some encoding related problem? I think some magic happens when I type ENTER after command in console. Java client(works) code: if ((userInput = stdIn.readLine()) != null) { out.println(userInput); System.out.println("echo: " + in.readLine()); System.out.print("input: "); } else { System.out.print("Opppppps.."); } ADD: If I send empty string by Java client after sending by PHP client I see the following output: Server: test\ntest\n

http://stackoverflow.com/comment/39082897
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25113206
has text: If I use struts 2.0 jars instead of struts 2.3's, it works fine.
type: AnswerComment

http://stackoverflow.com/comment/39006622
has text: Yes, all dependencies are available outside. so I tried setting `<repository>` but that still doesn't work
comment on: http://stackoverflow.com/q/25071505
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25159940
downvote count: 0
has comment: http://stackoverflow.com/comment/39169296
has comment: http://stackoverflow.com/comment/39169794
has body: Why don't you just have your ButtomComp and LabelComp extend from JPanel? This would solve a lot of your problems I think. For example : public class ButtonComp extends JPanel { JButton button; JCheckBox check = new JCheckBox(); public ButtonComp() { button = new JButton("Test1"); this.add(button); this.add(check); } } Then all you would need to do is iterate over your items and look at the checkbox in the components : for (int i = 0; i &lt; displayedItems.size(); i++) { if (displayedItems.get(i).check.isSelected()) { displayedItems.remove(i); } } Note: haven't tested this code. But you should get the idea.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25159712
has comment: http://stackoverflow.com/comment/39169153
score: 1
has comment: http://stackoverflow.com/comment/39169567

http://stackoverflow.com/q/25173098
downvote count: 0
has answer: http://stackoverflow.com/a/25173166
favorite count: 0
has answer: http://stackoverflow.com/a/25173165
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39194660
upvote count: 1
tagged with: text
score: 1
tagged with: java
has title: I have run into an issue with my text game loot system
has body: public void mouseClicked(MouseEvent m) { JList l = (JList)m.getSource(); // If click twice then collect item if (m.getClickCount() == 2 &amp;&amp; l.getSelectedValue() != null) { String i = l.getSelectedValue().toString(); int q = Integer.parseInt(i.replaceAll("\\)","").split("\\(")[1]), q1 = 0; String i2 = i.split("\\(")[0]; String i3 = i2.substring(0, i2.length() - 1); if (q &gt; 1) { q1 = Integer.parseInt(JOptionPane.showInputDialog("How many would you like to take?")); } else q1 = 1; PlayerHandler.addItem(i3, q1); if (q1 == q) { lmb.remove(l.getSelectedIndex()); } else { String t = l.getSelectedValue().toString(); int s = l.getSelectedIndex(); lmb.remove(s); lmb.add(s, t.replaceAll(Integer.toString(q), Integer.toString(q - q1))); } lma.clear(); PlayerHandler.listInventory(lma); } } }); I'm trying to do a learn as I go text game project and I've run into an issue with collecting items after an enemy is dead. When the inventory comes up and there are two or more of each item a window will pop up asking the player to type in how many they wish to take, lets say there are 5 wooden swords in the inventory, it will allow them to take 100 wooden swords, placing them in the inventory and leaving a "Wooden Sword (-95)" in the monster loot table. If you need more information let me know, it's pretty late and my thinker is pretty fried.
type: Question
answer count: 2

http://stackoverflow.com/q/25140246
has comment: http://stackoverflow.com/comment/39133438
has comment: http://stackoverflow.com/comment/39133650
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/25141277
score: -3
has comment: http://stackoverflow.com/comment/39134079
has answer: http://stackoverflow.com/a/25140613
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39133260
upvote count: 2
tagged with: java
has body: Just note that I am looking for possible solutions for more then couple of hours. I saw similar problems on Stack Overflow but this just not work. Ok so I have created a Dynamic Web Project in Eclipse Kepler. Later I shared everything with my team mate. Problem arises when he is trying to change one of the classes. He changed private field to something else. But when he restart tomcat server republish code he got an exception that path to the file is invalid. But he changed that!!! Eclipse still thinks that variable has an old value. Any idea how to fix it? We restarted eclipse multiple times, restarted tomcat server.
type: Question
has comment: http://stackoverflow.com/comment/39133196
has answer: http://stackoverflow.com/a/25140714
has title: Eclipse does not recognize code changes
accepted answer: http://stackoverflow.com/a/25140714
downvote count: 5
tagged with: eclipse
has comment: http://stackoverflow.com/comment/59158869
possible better answer: http://stackoverflow.com/a/25140613
answer count: 3

morphia
tag name: morphia
tags question: http://stackoverflow.com/q/25126838
type: Tag
tags question: http://stackoverflow.com/q/25181018
tags question: http://stackoverflow.com/q/25120334

http://stackoverflow.com/comment/39292838
has text: Thank you for your answers, i tried to to seperate each test with java file and use Junit with RunWith and SuiteClasses, here i can choose which test i want to use but still i have 100 java files. But i don't understand the example with hashmap, Thank you
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25225773
type: Comment

http://stackoverflow.com/a/25164356
has comment: http://stackoverflow.com/comment/39178172
has comment: http://stackoverflow.com/comment/39178059
has comment: http://stackoverflow.com/comment/39178860
downvote count: 0
has body: I think you are drawing the image directly on jframe. Try to use a middle level container component like JPanel and draw the image over it and add the panel to the frame. Direct drawing causes flickering effect.
answers question: http://stackoverflow.com/q/25164177
has comment: http://stackoverflow.com/comment/39178329
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/39112313
has text: You would just write `implements Comparable<Octagon>, Cloneable`. You would do the override in the `Octagon` class. The `@Override` annotation goes immediately before the method you are overriding and tells the compiler that you intend to override some method from an interface or superclass. That way, if you didn't actually override a method (like, if you got the name wrong), the compiler can warn you of that.
comment on: http://stackoverflow.com/q/25128128
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/39051832
score: 0
type: Comment
has text: @Shin What version are you using? 1.7?
comment on: http://stackoverflow.com/a/25094183
type: AnswerComment

http://stackoverflow.com/a/49722956
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25162773
downvote count: 0
has body: Follow these steps to get this issue fixed: Right click on Project Click on Run As and select Run Configurations Click on the classpath tab (Oxygen Eclipse) Click on user entries Click on Add External JARs.. and choose the downloaded JAR file Click Apply and run your project...
score: 2

http://stackoverflow.com/comment/39281956
comment on: http://stackoverflow.com/a/25219657
has text: So in this context, ServiceBuilder defines the return type of this method? Similar to what void does? It means that this function returns a ServiceBuilder class object?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39039185
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25089002
has text: For starters, this isn't Java.
score: 0

http://stackoverflow.com/comment/39196006
type: Comment
has text: how about scan if there is "mp" character? Text is dynamics from database. Not always like above.
comment on: http://stackoverflow.com/q/25173803
score: 0
type: QuestionComment

http://stackoverflow.com/q/25208461
has comment: http://stackoverflow.com/comment/39260262
possible better answer: http://stackoverflow.com/a/25208753
favorite count: 0
has comment: http://stackoverflow.com/comment/39260353
has comment: http://stackoverflow.com/comment/39264994
has answer: http://stackoverflow.com/a/25208700
has title: Program terminates without giving error
accepted answer: http://stackoverflow.com/a/25208700
downvote count: 2
has comment: http://stackoverflow.com/comment/39260271
has comment: http://stackoverflow.com/comment/39261447
has comment: http://stackoverflow.com/comment/39260659
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25208753
has comment: http://stackoverflow.com/comment/39260412
has body: Every time I run my program, it terminates part of the way through without leaving any error messages. This occurs at the same place each time, somewhere between lines 57-82. Why does this happen, and how can I fix it? public class DutyDecider_console { static Scanner input = new Scanner(System.in); public static void main(String[] args) { String a, b, c, d, e, f, go, candidateone, candidatetwo, candidatethree, candidatefour, candidatefive, candidatesix; double z = Math.random(); go =("go"); String optionch; System.out.println("Welcome to Duty Decider."); System.out.println(" "); System.out.println("Please type in your duty you wish to be decided."); optionch = input.nextLine(); System.out.println("You want to decide who will be " +optionch +"."); System.out.println(" "); System.out.println("Please type in the possible candidates for doing the " +optionch +".(Type one name at a time and press enter after each name. "); System.out.println("There can be a total of six candidates. Type 'go' after the desired number of candidates have been entered."); a = input.nextLine(); candidateone = a; if(candidateone.contains("go")){ System.out.println(candidateone +" has been selected to " +optionch +"."); } else if(!candidateone.contains("go")){ System.out.println(candidateone +" has been confirmed."); System.out.println(" "); b =input.nextLine(); candidatetwo = b; if(candidatetwo.contains("go")){ System.out.println(candidateone +" has been selected to " +optionch +"."); } else if(!candidatetwo.contains("go")){ System.out.println(candidatetwo +" has been confirmed." ); System.out.println(" "); c = input.nextLine(); candidatethree = c; if(candidatethree.contains("go")){ if(z&lt;0.5){ System.out.println(candidateone +" has been selected to " +optionch +"."); System.out.println(" "); System.out.println("Thank you for using 'Duty Decider. Have a nice day"); } else if(z&lt;1.0&amp;&amp;z&gt;0.5){ System.out.println(candidatetwo +" has been selected to " +optionch +"."); System.out.pr…
type: Question
has comment: http://stackoverflow.com/comment/39260248
has comment: http://stackoverflow.com/comment/39260434
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/39260341
answer count: 2

http://stackoverflow.com/comment/39149380
has text: Thanks for your reply! But this cascade type remove link and related points. But I want remove only link.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25148484
type: Comment

http://stackoverflow.com/a/25200524
answers question: http://stackoverflow.com/q/25175430
type: AcceptedAnswer
downvote count: 0
has body: This was because I did put my AOP configuration in MVC configuration file and AOP was trying to create proxies for Spring MVC classes. Placing AOP config in a separate file solved the problem.
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/25175430

http://stackoverflow.com/comment/39092039
type: QuestionComment
comment on: http://stackoverflow.com/q/25117765
has text: Are you limited to use of the Eclipse? I would suggest to migrate your project to Android Studio and use benefits of the Gradle from there, out of the box.
score: 0
type: Comment

http://stackoverflow.com/comment/39070309
has text: possible duplicate of [Is package by feature approach good?](http://stackoverflow.com/questions/11733267/is-package-by-feature-approach-good)
comment on: http://stackoverflow.com/q/25106449
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39133178
type: Comment
comment on: http://stackoverflow.com/a/25132732
type: AnswerComment
has text: You dont understand, I want to add a scroll bar to each cell in a spacific column, try running the code I have above and you will understand what the problem is. if there is a way to add scrollPane or scrollBar to a cell (like it is added to the table) I can add it to each cell in that column. can you help me with that?
score: 0

http://stackoverflow.com/comment/39180673
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25165062
has text: @GPI I just added pom.xml relevant dependencies.

http://stackoverflow.com/q/25172178
possible better answer: http://stackoverflow.com/a/25177850
has comment: http://stackoverflow.com/comment/39193067
score: 0
has comment: http://stackoverflow.com/comment/39193121
answer count: 3
has title: How can I find out why Tomcat is using so much memory and stop it?
has body: I'm profiling my webapp using YourKit Java Profiler. The webapp is running on tomcat 7 v30, and I can see that the heap of the JVM is ~30 megabytes, but Tomcat.exe is using 200 megabytes and keeps rising keeps rising. Screenshot: https://i.sstatic.net/xYovn.png (On left is how much memory profiler says Java is using, on right is Windows usage of tomcat.exe) I've tried adding different flags to tomcat, but still the memory usage keeps rising and rising. I've tried precompiling my .jsp files as well in case that helps, but it hasn't. The flags I've added to tomcat's java flags: -XX:+UseG1GC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=10 -XX:GCTimeRatio=1 Tomcat is also running as a windows service if that matters at all. I need assistance figuring out how to get tomcat to use less memory/know why it's using so much memory. As is is now, it keeps going until it uses the whole system's memory.
has answer: http://stackoverflow.com/a/25209907
tagged with: jvm
accepted answer: http://stackoverflow.com/a/25209907
tagged with: memory-management
has comment: http://stackoverflow.com/comment/39193116
tagged with: tomcat7
has answer: http://stackoverflow.com/a/25177986
has answer: http://stackoverflow.com/a/25177850
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39193051
tagged with: java
has comment: http://stackoverflow.com/comment/39193123
has comment: http://stackoverflow.com/comment/39193164
type: Question
has comment: http://stackoverflow.com/comment/39193003
tagged with: tomcat

http://stackoverflow.com/a/25071303
score: 2
upvote count: 2
has body: (1) Why does str2.split(""); give out as [, 1, 2, 3] (2) Does it detect "" at the start of the text and if so why doesnt it do the same at the end?` By splitting an empty string it will return the empty string as the first item. If no delimiter is defined in the string you are searching, you will get an array of size 1 which holds the original string even if it is empty. (3) What exactly does (?!^) mean? This is a Negative Lookahead assertion which asserts that it is not positioned before/at the start of the string. (?! # look ahead to see if there is not: ^ # the beginning of the string ) # end of look-ahead And you are correct on how Negative Lookahead works. a(?!b) # matches a when not followed by b
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25071159

http://stackoverflow.com/comment/39196925
type: Comment
type: QuestionComment
has text: no difference, all three will only allow a single thread to access `players` in these methods at any one time.
score: 0
comment on: http://stackoverflow.com/q/25174354

http://stackoverflow.com/q/25127484
tagged with: swing
has answer: http://stackoverflow.com/a/25127518
has title: Need help adding a JButton that uses system.exit(0)
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25128402
type: Question
has body: Coming from a non-typical coder, I need a little bit of assistance. I want to add a second JButton within the f1 section that I can code to run system.exit(0) to kill the program after the password has been confirmed. I got just about everything I need figured out except writing a 2nd JButton using a separate ActionListener. I'm just trying to write this as a secondary authorization program after the Windows login that I can pull passwords from a local SQL database. Any help would be much appreciated. import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.sql.*; public class Login extends JFrame implements ActionListener { JLabel l1, l2, l3; JTextField tf1; JButton btn1; JPasswordField p1; Login() { setTitle("Company Name"); setVisible(true); setSize(525, 300); setLayout(null); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); l1 = new JLabel("Enter Credentials:"); l1.setForeground(Color.blue); l1.setFont(new Font("Serif", Font.BOLD, 20)); l2 = new JLabel("Enter User Number:"); l3 = new JLabel("Enter Password:"); tf1 = new JTextField(); p1 = new JPasswordField(); btn1 = new JButton("Submit"); l1.setBounds(100, 30, 400, 30); l2.setBounds(80, 70, 200, 30); l3.setBounds(80, 110, 200, 30); tf1.setBounds(300, 70, 200, 30); p1.setBounds(300, 110, 200, 30); btn1.setBounds(150, 160, 100, 30); add(l1); add(l2); add(tf1); add(l3); add(p1); add(btn1); btn1.addActionListener(this); } public void actionPerformed(ActionEvent e) { showData(); } public void showData() { JFrame f1 = new JFrame(); JLabel l, l0; String str1 = tf1.getText(); char[] p = p1.getPassword(); String str2 = new String(p); try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/emp?user=root&amp;password=password"); PreparedStatement ps = con.prepareStatement("select name from emp where id=? and password=?"); ps.setString(1, str1); ps.setString(2, str2); ResultSet rs = ps.executeQuery(); if (rs.nex…
has answer: http://stackoverflow.com/a/25128627
linked to: http://stackoverflow.com/q/9554636
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/39109983
accepted answer: http://stackoverflow.com/a/25128402
has comment: http://stackoverflow.com/comment/39128891
has comment: http://stackoverflow.com/comment/39112705
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/39109953
possible better answer: http://stackoverflow.com/a/25127518

http://stackoverflow.com/comment/58583798
type: AnswerComment
comment on: http://stackoverflow.com/a/25071138
type: Comment
has text: @Viraj the problem is a difficult one, because, once you remove a row, you alter the view/model indices. You could walk backwards from the end of the table to the start, removing the rows by index directly instead
score: 1

http://stackoverflow.com/comment/39170478
comment on: http://stackoverflow.com/a/25160528
type: AnswerComment
score: 0
type: Comment
has text: when you are calling this method compiler expects an object of type Class View. The object is actually called as parameter/Argument

http://stackoverflow.com/a/25225216
answers question: http://stackoverflow.com/q/25225201
downvote count: 0
has body: The total value of the portfolio is not just the cash, you need to add the value of the stocks as well. You need to first get the stock price and multiple with the quantity of stock owned and add them all to the cash for the total value.
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/25075817
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25074167
score: 1
has body: Hibernate SQLQuery bypasses the Hibernate Session cache and queries ONLY against the database. You can read more @ Hibernate: SQL vs HQL with the Session Cache.

http://stackoverflow.com/comment/39204686
has text: @DavidBrossard: FYI: http://pastie.org/9452662 (AlexR, I thought editing it into your answer was a bit too much of an edit of someone else's answer, but feel free if you like). But note that if you comment out the `if` block that *may* throw `B`, it works without the no class def exception.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25178719
type: Comment

tabs
type: Tag
tags question: http://stackoverflow.com/q/25151373
tags question: http://stackoverflow.com/q/25082770
tags question: http://stackoverflow.com/q/25081045
tag name: tabs

http://stackoverflow.com/comment/39129529
type: Comment
has text: In other words, when you have a big object, you want to **update** a field of this object via deserialization. Am I right ?
type: QuestionComment
comment on: http://stackoverflow.com/q/25136840
score: 0

http://stackoverflow.com/comment/39220294
type: QuestionComment
has text: what's is your logcat?
comment on: http://stackoverflow.com/q/25187097
score: 0
type: Comment

http://stackoverflow.com/a/25116589
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25114666
upvote count: 1
has comment: http://stackoverflow.com/comment/39090730
accepted answer of: http://stackoverflow.com/q/25114666
has body: Try following How to set JVM parameters for Junit Unit Tests? to set the system variables for the VM that actually runs the tests - it's not the same one as the one that runs maven. Set your profile there. You can use a maven system parameter to set that from the invocation of maven (or use maven profiles).
has comment: http://stackoverflow.com/comment/39089657

http://stackoverflow.com/comment/39171646
comment on: http://stackoverflow.com/q/25161077
type: Comment
type: QuestionComment
score: 1
has text: @jhobbie: don't think so. this is about the difference between the implicit visibility between class and interface, not the definition of the various levels of visibility.

http://stackoverflow.com/comment/39263430
has text: I don't want to use a series of printing blank lines method. i need a more elegant way of clearing out console.If any please let me know.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25209808

http://stackoverflow.com/comment/39241403
type: QuestionComment
has text: Equals is only called (if ever) when the proper branch in the tree is found via `compareTo` .
comment on: http://stackoverflow.com/q/25198475
score: 0
type: Comment

http://stackoverflow.com/comment/39171845
score: 0
has text: Look guys it hards to me to explain because i'm from israel and i don't know very well English so its little hard for me.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25161036

http://stackoverflow.com/comment/39581258
comment on: http://stackoverflow.com/a/25378720
has text: sorry yes you need to mention the column index/name
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25131215
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25124816
type: Answer
accepted answer of: http://stackoverflow.com/q/25124816
score: 1
upvote count: 1
has body: Why do you need a custom tag whereas the same thing you can achieve using build-in JSTL tags. sample code: &lt;table&gt; &lt;c:forEach begin="1" end="10" varStatus="status"&gt; &lt;tr&gt; &lt;td&gt; &lt;c:forEach begin="1" end="${status.index}"&gt; John&amp;nbsp; &lt;/c:forEach&gt; Value of k: ${status.index} &lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt; &lt;/table&gt; output: John Value of k: 1 John John Value of k: 2 John John John Value of k: 3 John John John John Value of k: 4 John John John John John Value of k: 5 John John John John John John Value of k: 6 John John John John John John John Value of k: 7 John John John John John John John John Value of k: 8 John John John John John John John John John Value of k: 9 John John John John John John John John John John Value of k: 10 If you need same thing in multiple jsp then move the code in a separate JSP file and just include it wherever needed. &lt;jsp:include page="mytags.jsp"&gt; &lt;jsp:param value="Koray" name="name" /&gt; &lt;/jsp:include&gt; mytags.jsp: &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt; &lt;table&gt; &lt;c:forEach begin="1" end="10" varStatus="status"&gt; &lt;tr&gt; &lt;td&gt;&lt;c:forEach begin="1" end="${status.index}"&gt; ${param.name}&amp;nbsp; &lt;/c:forEach&gt; Value of k: ${status.index}&lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt; &lt;/table&gt; If you want to do using custom tag then try with BodyTagSupport that implements BodyTag interface. sample code: import java.io.IOException; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.tagext.BodyTagSupport; public class MyTag extends BodyTagSupport { private String name; private int counter; public int doStartTag() throws JspException { counter = 1; JspWriter out = pageContext.getOut(); try { out.print(name); pageContext.setAttribute("valueOfK", counter); out.flush(); } catch (IOException e) { e.printStackTrace(); } return EVAL_BODY_INCLUDE; } public int doAfterBody() { …

http://stackoverflow.com/a/25304760
has body: ...as I was not able to show the raster in the comments: I did not mentally parse your code, however from the image I see that you try to detect borderline collisions. Putting round or diagonal (border)lines into a raster may cause occasions, where two crossing lines do not overlay each other - like this: 1 2 2 1 whereby 1 would be line 1 and 2 would be line 2. However I still like the idea of checking border lines combined with rectangle pre-checks. If you would render an array of raster proved-closed line coordinates by sprites you could check them against each other. This could also be enriched by border line segmenting (such as North, East, West and South or a bit more fine grain - I guess there is an optimum). A diagonal proved-closed line in the check data set must represent something like this: x _ x x whereby the x represent the pixels of your line and the _ is an empty raster seat.
type: Answer
answers question: http://stackoverflow.com/q/25218184
score: 0

http://stackoverflow.com/comment/39124666
comment on: http://stackoverflow.com/a/25135310
score: 0
type: AnswerComment
has text: did not get you? Where in the query that you have provided should i add this?
type: Comment

http://stackoverflow.com/comment/39214569
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25183872
score: 1
has text: @WilliamF.Jameson I'm now assuming you assume what I assume. Never mind. OK :)

jtable
tags question: http://stackoverflow.com/q/25176840
tags question: http://stackoverflow.com/q/25119881
tags question: http://stackoverflow.com/q/25120583
tags question: http://stackoverflow.com/q/25092695
tags question: http://stackoverflow.com/q/25192533
tags question: http://stackoverflow.com/q/25108256
tags question: http://stackoverflow.com/q/25157895
tags question: http://stackoverflow.com/q/25078076
tags question: http://stackoverflow.com/q/25093985
tags question: http://stackoverflow.com/q/25192135
type: Tag
tags question: http://stackoverflow.com/q/25198255
tags question: http://stackoverflow.com/q/25096038
tags question: http://stackoverflow.com/q/25103373
tags question: http://stackoverflow.com/q/25142905
tags question: http://stackoverflow.com/q/25142602
tags question: http://stackoverflow.com/q/25220465
tags question: http://stackoverflow.com/q/25119034
tags question: http://stackoverflow.com/q/25196766
tags question: http://stackoverflow.com/q/25105330
tags question: http://stackoverflow.com/q/25187619
tags question: http://stackoverflow.com/q/25074291
tag name: jtable
tags question: http://stackoverflow.com/q/25136616
tags question: http://stackoverflow.com/q/25206633
tags question: http://stackoverflow.com/q/25097740
tags question: http://stackoverflow.com/q/25133134
tags question: http://stackoverflow.com/q/25080951
tags question: http://stackoverflow.com/q/25124482
tags question: http://stackoverflow.com/q/25211718
tags question: http://stackoverflow.com/q/25100297
tags question: http://stackoverflow.com/q/25123425
tags question: http://stackoverflow.com/q/25164203
tags question: http://stackoverflow.com/q/25155244
tags question: http://stackoverflow.com/q/25183900
tags question: http://stackoverflow.com/q/25149530
tags question: http://stackoverflow.com/q/25199083
tags question: http://stackoverflow.com/q/25070511
tags question: http://stackoverflow.com/q/25177003

http://stackoverflow.com/a/25209176
downvote count: 0
type: Answer
has body: The above code looks like it has an order of sorting criteria. "name" compare returns non-zero, it will not apply compare to "ID_SORT" This is the right behavior; if it is zero, they are equal so move on to the next criteria. Otherwise use this one. However, I can suggest another method - use the fact that the library sorts are stable, and so if you apply sort first by year, then by order, you get the list sorted by order and if the order is the same, then by date.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25209041
answers question: http://stackoverflow.com/q/25209041
has comment: http://stackoverflow.com/comment/39261649
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/39060332
comment on: http://stackoverflow.com/q/25101020
type: Comment
type: QuestionComment
has text: the python docs are extensive, https://www.python.org/doc/
score: 0

admob
tags question: http://stackoverflow.com/q/25127534
tags question: http://stackoverflow.com/q/25191412
tags question: http://stackoverflow.com/q/25123447
tags question: http://stackoverflow.com/q/25071043
tags question: http://stackoverflow.com/q/25173587
type: Tag
tags question: http://stackoverflow.com/q/25125333
tag name: admob

http://stackoverflow.com/comment/39095725
type: QuestionComment
has text: code posted in your question talking about nothing, question in this form isn't answerable here, again for better help sooner post an SSCCE/MCVE, short, runnable, compilable with hardcoded value for JTable/XxxTableModel stored in local variable
comment on: http://stackoverflow.com/q/25119477
score: 0
type: Comment

http://stackoverflow.com/q/25229218
tagged with: java
linked to: http://stackoverflow.com/q/1552301
has comment: http://stackoverflow.com/comment/39298983
answer count: 2
has title: java - string functions are not changing the input string
tagged with: concatenation
accepted answer: http://stackoverflow.com/a/25229233
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/39298921
linked to: http://stackoverflow.com/q/8798403
has comment: http://stackoverflow.com/comment/39299136
has body: Following is my code: class program{ public static void main(String[]args){ String str = new String("I like Java "); str.concat("the most"); str.toUpperCase(); str.replace("LIKE","LOVE"); System.out.println(str); } } As I expect the output should be as: I LOVE JAVA THE MOST But, It isn't showing an error but also not showing the expected output...Instead it is only showing the original string: Am I missing something or may be is it something else?
has comment: http://stackoverflow.com/comment/39298963
has comment: http://stackoverflow.com/comment/39299096
duplicate of: http://stackoverflow.com/q/1552301
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25229243
has comment: http://stackoverflow.com/comment/39299065
linked to: http://stackoverflow.com/q/21330961
has comment: http://stackoverflow.com/comment/39299028
has comment: http://stackoverflow.com/comment/39298978
has comment: http://stackoverflow.com/comment/39299456
has answer: http://stackoverflow.com/a/25229243
downvote count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/25229233
type: Question
has comment: http://stackoverflow.com/comment/39298960
score: -2

http://stackoverflow.com/comment/82005742
type: Comment
has text: how can you check if the user is online/offline with the above code?
comment on: http://stackoverflow.com/a/32433795
score: 0
type: AnswerComment

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/25092788
tags question: http://stackoverflow.com/q/25074846
tags question: http://stackoverflow.com/q/25197047
tags question: http://stackoverflow.com/q/25153089
type: Tag
tags question: http://stackoverflow.com/q/25152523

http://stackoverflow.com/comment/39211242
type: QuestionComment
comment on: http://stackoverflow.com/q/25178387
score: 0
has text: @morric If you know any offical guideline for any C-based language, feel free to post an answer.
type: Comment

http://stackoverflow.com/q/25204031
has comment: http://stackoverflow.com/comment/39252263
tagged with: java
type: Question
tagged with: checked
has title: Java Checked vs Unchecked exception for validation service
has comment: http://stackoverflow.com/comment/39251725
score: 0
answer count: 1
tagged with: unchecked-exception
has body: I have a service that allow users to add dynamic content to a repository. So basically I have a generic Document class that contains a list of property for that specific object depending on what type of document the user is adding (eg. an invoice document has an invoice number property while a wiki document has an author property, and so on). The service is comprised of different layers and at some point I have a class that has to check if the document to be added is compliant to the rules configurer, evaluating if all required properties are provided, if they are all of the right type, etc. If any of these validations fail I want to throw a custom exception which contains the validation status. The question is: should my ValidationException be checked or unchecked? I read a lot of best practice on how to decide what kind of exception use. I was thinking about using RuntimeException but in this case the exception is not caused by error in coding or stuff like that but just by the user input... On the other hand using a checked exception would mean to propagate the "throws" syntax in all the above layer of the application and probably in the 90% of the service's methods making the code much less readable and manteinable.
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25240751

http://stackoverflow.com/a/25226547
upvote count: 2
answers question: http://stackoverflow.com/q/25226416
type: Answer
has body: Map firstMap = new HashMap(); Map secondMap = new HashMap(); // Add everything in firstMap map2.putAll(Maps.difference(firstMap , secondMap ).entriesOnlyOnLeft());
score: 2
downvote count: 0

http://stackoverflow.com/a/25178011
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25155943
has body: it is feasible, just pass Fragment's class name to FragmentActivity. FragmentActivity : public class MyFragmentActivity extends FragmentActivity { public static Fragment fragment; public static final String FRAGCLASS = "fragmentclass"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.fragment_layout); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); //get Fragment's class name String fragment_className = this.getIntent().getStringExtra(FRAGCLASS); //Initialize fragment Class&lt;?&gt; c = null; try { c = Class.forName(fragment_className); this.fragment = (Fragment) c.newInstance(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } this.fragment.setArguments(this.getIntent().getExtras()); //R.id.view from R.layout.fragment_layout fragmentTransaction.add(R.id.view, this.fragment,"tag" + fragment_className); fragmentTransaction.commit(); } } fragment_layout.xml : &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;LinearLayout android:id="@+id/view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" /&gt; &lt;/RelativeLayout&gt;
downvote count: 0
score: 1

http://stackoverflow.com/comment/39020700
type: AnswerComment
score: 0
type: Comment
has text: will this method return `null`?
comment on: http://stackoverflow.com/a/25080033

http://stackoverflow.com/comment/39044155
type: Comment
score: 1
has text: Thank you, the only reason I am hesitants for enum i that if I want to pass the enum value as an id (lets say over network) then I send its index as ordinal and then I have to convert the enum to array at the receiving end so I can access the num using ordinal
type: AnswerComment
comment on: http://stackoverflow.com/a/25092199

http://stackoverflow.com/comment/39235008
type: Comment
comment on: http://stackoverflow.com/q/25194992
has text: I am stuck at the forlooping part. Can anybody answer my question and teach how to solve it?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39241187
comment on: http://stackoverflow.com/a/25198326
has text: Is it necessary to put JSON.stringfy(info), If i do like that my code does not work. Is my approach is wrong?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25168660
tagged with: java
has answer: http://stackoverflow.com/a/25168782
type: Question
downvote count: 0
answer count: 2
has body: When collecting a java.util.stream.Stream, why is not its method void close() called ?
linked to: http://stackoverflow.com/q/28813637
favorite count: 0
type: UnansweredQuestion
score: 6
upvote count: 6
has answer: http://stackoverflow.com/a/25168727
has comment: http://stackoverflow.com/comment/39186993
tagged with: java-stream
has title: Why is not java.util.stream.Stream#close() called?

http://stackoverflow.com/a/25087944
score: 0
accepted answer of: http://stackoverflow.com/q/25087807
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25087807
type: Answer
has body: Take a look at Screen Image. You can make an image of any component.

http://stackoverflow.com/comment/50107850
type: Comment
comment on: http://stackoverflow.com/q/25123284
type: QuestionComment
has text: Can you please show the code, what you have done for it?
score: 0

http://stackoverflow.com/a/25152014
accepted answer of: http://stackoverflow.com/q/25151942
answers question: http://stackoverflow.com/q/25151942
score: 3
has body: Since you are sharing same object of PrintDemo class in both threads that you can use as lock (monitor). sample code: class PrintDemo { public void printCount() { try { for (int i = 5; i &gt; 0; i--) { synchronized (this) { this.notify(); } System.out.println(Thread.currentThread().getName()+" Counter --- " + i); synchronized (this) { this.wait(); } } } catch (Exception e) { System.out.println("Thread interrupted."); } } } class ThreadDemo extends Thread { private Thread t; private String threadName; PrintDemo PD; ThreadDemo(String name, PrintDemo pd) { threadName = name; PD = pd; } public void run() { synchronized (PD) { PD.printCount(); } System.out.println("Thread " + threadName + " exiting."); synchronized (PD) { PD.notify(); // notify the last waited thread. } } public void start() { System.out.println("Starting " + threadName); if (t == null) { t = new Thread(this, threadName); t.start(); } } } output: Starting Thread - 1 Starting Thread - 2 Thread - 1 Counter --- 5 Thread - 2 Counter --- 5 Thread - 1 Counter --- 4 Thread - 2 Counter --- 4 Thread - 1 Counter --- 3 Thread - 2 Counter --- 3 Thread - 1 Counter --- 2 Thread - 2 Counter --- 2 Thread - 1 Counter --- 1 Thread - 2 Counter --- 1 Thread Thread - 1 exiting. Thread Thread - 2 exiting. Visual representation: Read more...
downvote count: 0
type: AcceptedAnswer
upvote count: 3
type: Answer

http://stackoverflow.com/comment/39184835
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25158776
type: Comment
has text: I've been able to try the above answer, but it doesn't give me any compilation errors, but instead the desired `Set` object. Are you copying this verbatim, `Set<Element> linkSet = new HashSet<Element>(links);` ? In your above comment you are using the `Elements` class as the argument to the `HashSet` constructor which obviously is wrong.

http://stackoverflow.com/q/25149919
tagged with: java
linked to: http://stackoverflow.com/q/11504860
has answer: http://stackoverflow.com/a/25169360
upvote count: 9
has body: Wow, documentation is horrible when it comes to list item selection. All I need is to be able to select and highlight multiple items in a list. I've scoured the web and seen references to android:choiceMode="multipleChoice", which I'm guessing allows you to select multiple items. But where can I get the selected items in my Activity? And how come when I try to select multiple items using setSelection(position), the previously highlighted item disappears? Google also describes in View.setActivated(boolean) that Note that activation is not the same as selection. Selection is a transient property, representing the view (hierarchy) the user is currently interacting with. Activation is a longer-term state that the user can move views in and out of. For example, in a list view with single or multiple selection enabled, the views in the current selection set are activated. (Um, yeah, we are deeply sorry about the terminology here.) So am I supposed to use activation instead of selection? This SO answer talks about how "activated" is just the post-HoneyComb version of "checked". But if you're supposed to use "activated" for multiple selection, whats the point of android:choiceMode="multipleChoice" in the first place?
downvote count: 0
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/66286716
has title: Highlight Multiple Selected/Checked/Activated in ListView
favorite count: 0
type: Question
score: 9
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/25169360

http://stackoverflow.com/comment/39132013
score: 0
has text: @injecteer Indeed, but he said `if both the beans are of same type.`, so I went with that assumption.
comment on: http://stackoverflow.com/a/25139612
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39028995
has text: Both array length is same ?
score: 1
comment on: http://stackoverflow.com/q/25084200
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39050410
type: Comment
comment on: http://stackoverflow.com/q/25095805
score: 0
has text: Have you tried to use debugger?
type: QuestionComment

http://stackoverflow.com/comment/40056437
comment on: http://stackoverflow.com/q/25207581
has text: Times before, I've worked in a project where we needed to get the same types of information (low-level, network-context info). After a great amount of researches, I think that you can't retrieve these types of info with Android's default API. Maybe you can try something with reflection (I believe that Qualipoc uses things like it) or, re-implement/customize the Android-RIL.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25364134
has body: SFTP client library typically only propagates any error it gets from the SFTP server, in addition to connection related errors that the library detects locally. So it's equally (if not more) important, what guaranties does the SFTP server give that the file was successfully saved, when the server returns no error. And that would obviously be implementation-specific.
answers question: http://stackoverflow.com/q/25198944
has comment: http://stackoverflow.com/comment/39697438
type: Answer
has comment: http://stackoverflow.com/comment/39688325
score: 0

http://stackoverflow.com/comment/39062152
type: AnswerComment
score: 0
has text: @KickButtowski: I'm on a tablet at the moment, so typing code is annoyingly tedious. And there are plenty of examples of this kind of thing on the linked duplicate question, so there's no point in rehashing those here (pardon the pun). If you're having trouble understanding the answers on the other question, you can also always ask a new question for more clarification.
type: Comment
comment on: http://stackoverflow.com/a/25101906

http://stackoverflow.com/q/25130510
favorite count: 0
has comment: http://stackoverflow.com/comment/39115468
has answer: http://stackoverflow.com/a/25130619
has body: IF I have a class that uses a builder pattern for construction because most params are optional how are default values specified? For instance in the situation below, if the client builds with only the compulsory item but later queries the optional items, what happens? public class BClass { private final int compulsoryItem; private final int optional1; private final String optional2; public int getCompulsoryItem() { return compulsoryItem; } public int getOptional1() { return optional1; } public int getOptional2() { return optional2; } private BClass(Builder builder) { this.compulsoryItem = builder.compulsoryitem; this.optional1 = builder.optional1; this.optional2 = builder.optional2; } public static class Builder { private int compulsoryItem; private int optional1; private String optional2; public Builder(int c) { this.compulsoryItem = c; } public Builder opt1(int o1) { this.optional1 = o1; return this; } public Builder opt2(String o2) { this.optional2 = o2; return this; } public BClass build() { return new BClass(this); } } }
type: AnsweredQuestion
tagged with: builder
downvote count: 0
has comment: http://stackoverflow.com/comment/39115422
type: Question
score: 1
tagged with: java
has title: Builder pattern in Java
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/25130619

http://stackoverflow.com/a/25134319
downvote count: 0
has body: Anonymous class You don't have to create class that implements interface that is required as an argument in separate file and then initialize it and pass it. You can do it in same line where it's needed.
answers question: http://stackoverflow.com/q/25134234
upvote count: 2
type: Answer
score: 2

opengl-es-2.0
tag name: opengl-es-2.0
tags question: http://stackoverflow.com/q/25145494
type: Tag

http://stackoverflow.com/comment/39125934
has text: why don't you use this link: http://downloads.sourceforge.net/project/htmlunit/htmlunit/2.15/htmlunit-2.15-bin.zip?r=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F25136439%2Fhtmlunit-download-file&ts=1407234257&use_mirror=softlayer-ams
score: 0
comment on: http://stackoverflow.com/q/25136439
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25179296
has comment: http://stackoverflow.com/comment/39209258
type: Answer
answers question: http://stackoverflow.com/q/25179022
has body: You cant specify how much data will actually be downloaded. The webserver that serves your request will open the requested file and send the whole content (preceded by the http response headers) through the tcp connection. That means that the whole file will be sent to you and you can't do anything about it except to close the underlying connection at just the right time, but that won't be easy to do and especially not work reliably. That means: you read the 5760 bytes from the inputstream (which, at this point, already contains more than those 5760 bytes!) and then close the stream and the connection - but that doesnt meant a whole lot more data was received in the meantime To find out how much you actually received, you have to read your inputstream completely and check it's length.
score: 0
has comment: http://stackoverflow.com/comment/39205653

http://stackoverflow.com/comment/39186031
has text: So... do I just drag the `mysql-connector-java-5.1.28.jar` file to the WEB-INF/lib directory?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25168331

http://stackoverflow.com/comment/39260057
score: 0
type: Comment
type: QuestionComment
has text: @LuiggiMendoza But a thread initialized with that constructor can't do anything. It will start and die. How can you possibly use it to debug?
comment on: http://stackoverflow.com/q/25208171

http://stackoverflow.com/q/25209319
answer count: 2
has comment: http://stackoverflow.com/comment/39264516
has title: How to do filter mapping in AbstractAnnotationConfigDispatcherServletInitializer Spring
favorite count: 0
has body: Here is the problem: I can successfully register the Filter, but don't know how to set the mapping URL using this specific configuration. Here is my Class: public class WebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Class&lt;?&gt;[] getRootConfigClasses() { return new Class&lt;?&gt;[]{AppConfig.class}; } @Override protected Class&lt;?&gt;[] getServletConfigClasses() { return new Class&lt;?&gt;[]{WebConfig.class}; } @Override protected Filter[] getServletFilters() { return new Filter[]{ new DelegatingFilterProxy("springSecurityFilterChain"), new DelegatingFilterProxy("customFilter") }; } @Override protected String[] getServletMappings() { return new String[]{"/"}; } } P.D. I had done it using WebApplicationInitializer, but I want to use AbstractAnnotationConfigDispatcherServletInitializer.
score: 8
has answer: http://stackoverflow.com/a/25214812
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25211427
tagged with: servlet-filters
tagged with: spring
tagged with: java
has comment: http://stackoverflow.com/comment/39264438
tagged with: spring-java-config
upvote count: 8
type: Question

http://stackoverflow.com/comment/39147480
score: 0
has text: That may be true, I did not know that could happen. I do have a generated `serialVersionUID` for vertices, though. How would I avoid this problem?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25147565

http://stackoverflow.com/comment/39397412
type: QuestionComment
type: Comment
has text: @sap1ens Thanks for the tip, it will be useful in the future. About my problem, I can't work on it at the moment, but I will try your idea as soon as I can.
comment on: http://stackoverflow.com/q/25077282
score: 0

http://stackoverflow.com/comment/39107924
has text: Any further information? Let's say the JDBC connection pools monitoring results on both servers. Were you calling it concurrently?
comment on: http://stackoverflow.com/q/25126277
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39294864
has text: Means, have you got some output?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25226764
score: 0

http://stackoverflow.com/q/25134925
has body: so I try this but it doesn't want to work the way i want it. I am trying to make a 'incrypting' program, so I've done this so far input = input.replace("a", "01100001\n"); input = input.replaceAll("b", "01100010\n"); input = input.replaceAll("c", "01100011\n"); this is what works, but here comes the problem: input = input.replaceAll(" ", "01000000"); not even "\s" or anything makes it work. Anyone got any idea how to make it work so it only replaces the space character in between the words, Only them? Thanks
has answer: http://stackoverflow.com/a/25134976
favorite count: 0
has comment: http://stackoverflow.com/comment/39123247
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39123710
linked to: http://stackoverflow.com/q/5262554
has comment: http://stackoverflow.com/comment/39123331
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/39123308
has answer: http://stackoverflow.com/a/25135099
has title: How to replace only the space character with something else
type: Question
answer count: 2
downvote count: 3
has comment: http://stackoverflow.com/comment/39123278
upvote count: 1
has comment: http://stackoverflow.com/comment/39123242

http://stackoverflow.com/q/25138897
has title: Copying Properties from one bean into another: Java
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25139612
type: Question
has body: I am facing issue in copying properties from one bean to another. I am aware about the copyProperties() which can be used here to copy from source bean to destination bean probably if both the beans are of same type. My issue here is that I want to copy first 50 properties on the first call and next 50 properties on the second call. Is there any way in which I can copy first 50 configs only?
accepted answer: http://stackoverflow.com/a/25138966
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25139612
linked to: http://stackoverflow.com/q/3738919
has answer: http://stackoverflow.com/a/25138966
tagged with: apache-commons-beanutils

http://stackoverflow.com/comment/39185580
type: AnswerComment
comment on: http://stackoverflow.com/a/25166750
has text: If I use the Render property perhaps - someone could confirm this? - I have to wrap each menu node in a group layout component. However kindly re-read my question and try to answer ;-)
type: Comment
score: 0

http://stackoverflow.com/comment/39292382
has text: what is the result of this? int subtract = Integer.parseInt(secMessage[2]);
comment on: http://stackoverflow.com/a/25225737
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25084184
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25083870
score: 1
has body: Yes, this is relatively simple to set up. Open the Project Properties and navigate to the Java Code Style > Code Templates section. Once there, check the box to enable project-specific settings. The generation template you want is under the Code part of the tree; you want Class Body. It is probably empty, but click the Edit... button to modify it. Whatever you enter in the Edit dialog will be inserted between the class' brackets when using the New Class wizard. There's no way I know of to automatically create another class (the Test in your case). But Eclipse has a JUnit wizard that makes doing so very easy. Just right-click on a class and choose New > Other... and then find Junit Test Case in the list. That wizard will guide you through creating the test class, including selecting the method(s) you want to test. Note: these instructions set up the template for just the project or projects you select. You could also set up the same thing for your entire workspace Preferences, but doing so provides no way to share that configuration so that the same project checked out into another workspace will use it. I usually recommend making these kinds of settings on a per-project basis.

http://stackoverflow.com/comment/39193574
comment on: http://stackoverflow.com/q/25172113
score: 0
has text: All input is from a keyboard, so scaling is not a problem.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25124850
has answer: http://stackoverflow.com/a/25124874
tagged with: java
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/25124874
type: AnsweredQuestion
has body: I have following code : class MyThread{ static volatile java.io.PrintStream s=System.out; public static void main(String args[]){ Runnable r1=new Runnable(){ public void run(){ synchronized(s){ for(int i=0; i&lt;100; i++) system.out.println("in r1"); } } }; Runnable r2=new Runnable(){ public void run(){ synchronized(s){ for(int i=0; i&lt;100; i++) system.out.println("in r2"); } } }; Thread t1=(Thread)r1; Thread t2=(Thread)r2; t1.start(); t2.start(); } } My question is : as r1 and r2 are method local inner classes , how could they access 's' as it is not final? code does not give any error. but it throws exception at line 'Thread t1=(Thread)r1; Thread t2=(Thread)r2;', why so? Thanks in advance
has comment: http://stackoverflow.com/comment/39104915
tagged with: inner-classes
possible better answer: http://stackoverflow.com/a/25124890
tagged with: multithreading
has answer: http://stackoverflow.com/a/25124890
type: Question
has title: method local inner classes scope

http://stackoverflow.com/a/25212148
answers question: http://stackoverflow.com/q/25211904
has body: Thread#stop has been deprecated for very strong reasons. Basically, it was broken from the start and your code using it was thus broken as well. The thread could be stopped in the middle of a critical section (covered with a lock), leaving work half-finished and permanently breaking the instance it was working on. After such an event there is absolutely no guarantee as to the integrity of the system state. What was instead introduced to Java is the interruption mechanism: there's a flag you can check on Thread.currentThread() to see if someone called interrupt on it. If you see that flag on, you make sure the thread's implementation leaves what it was doing, cleans up and exit.
type: Answer
score: 0

http://stackoverflow.com/comment/39290107
comment on: http://stackoverflow.com/q/25224552
score: 0
has text: I posted an answer. However, if your only concern was whether or not k++ or k-- was the issue, it would really just be a matter of trying both and seeing which one works.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25153208
tagged with: java
tagged with: contain
has answer: http://stackoverflow.com/a/25153575
type: Question
has answer: http://stackoverflow.com/a/25154077
accepted answer: http://stackoverflow.com/a/25154077
answer count: 7
has title: str.contains in Java
has body: I am having 2 lists allWords [book, pen, pencil] subsetString [book pen , book pencil , pen pencil ] I am expecting my output as book pen =&gt; pencil book pencil =&gt; pen pen pencil =&gt; book ie for each element in subsetString I will be checking it with allwords. Once a match is not found that string from allwords will be added to RHS of output But my issue is Now I am only getting 2 output instead of 3 allWords [book, pen, pencil] subsetString [book pen , book pencil , pen pencil ] pen pencil =&gt; book book pen =&gt; pencil The reason is while coming into book pencil it get checked with allWords [book, pen, pencil] once it comes to pen contains book pencil - It is getting satisfed (as pencil contains a substring pen). CODE public void getStrongRules2(ArrayList&lt;String&gt; allWords,String delim) { ArrayList&lt;ArrayList&lt;String&gt;&gt; subsets = BTSum(allWords); ArrayList&lt;String&gt; subsetString = new ArrayList&lt;String&gt;(); for (int j = 0; j &lt; subsets.size(); j++) { String substring = ""; for (int k = 0; k &lt; subsets.get(j).size(); k++) { substring += subsets.get(j).get(k) + " "; } subsetString.add(substring); } System.out.println("allWords "+allWords); System.out.println("subsetString "+subsetString); for(String a : allWords){ for (int j = 0; j &lt; subsetString.size(); j++) { if (!(subsetString.get(j).contains(a))) { System.out.println(subsetString.get(j)+" =&gt; "+a); } } } } public static ArrayList&lt;ArrayList&lt;String&gt;&gt; BTSum(ArrayList&lt;String&gt; numbers) { int n = numbers.size(); ArrayList&lt;ArrayList&lt;String&gt;&gt; powerSet = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); for (long i = 0; i &lt; (1 &lt;&lt; n); i++) { ArrayList&lt;String&gt; element = new ArrayList&lt;String&gt;(); for (int j = 0; j &lt; n; j++) if ((i &gt;&gt; j) % 2 == 1) { element.add(numbers.get(j)); } if (element.size() &gt; 1 &amp;&amp; element.size() &lt; n) { powerSet.add(element); } } return powerSet; } } But this should not happen in my case. How…
tagged with: string
has comment: http://stackoverflow.com/comment/39157374
has comment: http://stackoverflow.com/comment/39158044
score: 0
has comment: http://stackoverflow.com/comment/39157402
possible better answer: http://stackoverflow.com/a/25153393
has answer: http://stackoverflow.com/a/25153521
has answer: http://stackoverflow.com/a/25153598
has answer: http://stackoverflow.com/a/25153393
has comment: http://stackoverflow.com/comment/39157458
has answer: http://stackoverflow.com/a/25153824
tagged with: string-matching
has comment: http://stackoverflow.com/comment/39157828
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25154146
has comment: http://stackoverflow.com/comment/39157349

http://stackoverflow.com/q/25183405
has comment: http://stackoverflow.com/comment/39213652
has answer: http://stackoverflow.com/a/25183935
has comment: http://stackoverflow.com/comment/39213207
upvote count: 4
has comment: http://stackoverflow.com/comment/39213130
tagged with: uri
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39213483
favorite count: 0
has comment: http://stackoverflow.com/comment/39212889
accepted answer: http://stackoverflow.com/a/25183935
has body: I'm trying to parse the host from a URI containing the character 'ü' in the host like this: String host = new java.net.URI("http://füllmethodentafel.de").getHost(); However, the host will be null. It works with other URIs. Any ideas why it doesn't work?
has title: Parsing the host of a URI in Java when it contains umlauts
score: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39213229
tagged with: java
has comment: http://stackoverflow.com/comment/39213277
has comment: http://stackoverflow.com/comment/39212984
type: Question
has comment: http://stackoverflow.com/comment/39213105
has comment: http://stackoverflow.com/comment/39212932

http://stackoverflow.com/q/25083525
answer count: 2
has answer: http://stackoverflow.com/a/43289699
tagged with: intellij-idea
has body: I'm attempting to run a maven target against an example project while ramping up on a new project. I'm new to both Mac and IntelliJ (I'm running community edition side-by-side with Eclipse Luna while I evaluate it). This all works in Eclipse and from the terminal. The problem I'm having is getting Maven to run it in Java 8. I've configured JAVA_HOME to 1.8, set the project JDK to 1.8, language level to 1.8, etc. The code compiles (with lambdas) so 1.8 is clearly what IntelliJ is using. But the Maven plugin doesn't seem to want to honor that setting. Here's the maven target configuration (using the Deploy target): Working Directory: /Users/brian.trezise/IdeaProjects/exampleservice Command Line: clean install tomcat7:run When I execute the target from the Maven Projects popout, this is what it executes: /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/bin/java -Dmaven.home=/usr/local/Cellar/maven/3.2.2/libexec -Dclassworlds.conf=/usr/local/Cellar/maven/3.2.2/libexec/bin/m2.conf -Didea.launcher.port=7532 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13 CE.app/bin" -Dfile.encoding=UTF-8 -classpath "/usr/local/Cellar/maven/3.2.2/libexec/boot/plexus-classworlds-2.5.1.jar:/Applications/IntelliJ IDEA 13 CE.app/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=13.1.4 clean install tomcat7:run It seems to run fine up until Maven tries to compile (downloads all the dependencies, etc) then I get the following error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project inin-example-app: Compilation failure [ERROR] /Users/brian.trezise/IdeaProjects/exampleservice/src/main/java/com/inin/example/controller/PingController.java:[53,49] lambda expressions are not supported in -source 1.7 [ERROR] (use -source 8 or higher to enable lambda expressions) I'm not sure how to configure it to use "-source 8" (if I add that to the command line i…
possible better answer: http://stackoverflow.com/a/43289699
has answer: http://stackoverflow.com/a/25084418
downvote count: 0
tagged with: macos
favorite count: 0
has title: IntelliJ Idea Maven plugin attempts to compile in Java 1.7 when configured for 1.8 (Mac)
upvote count: 2
tagged with: maven
accepted answer: http://stackoverflow.com/a/25084418
score: 2
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/21006136
type: Question

http://stackoverflow.com/q/25119125
score: 0
has body: today I was trying to make a plugin that spawns a skeletal horse and fire particles are around the horse. I got that part down but however whenever someone kills the bone horse the fire particles stay there. Somebody please help? Also My Code (2 Classes): package survivalcraft.FireHorse; import java.util.logging.Logger; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.command.CommandSender; import org.bukkit.command.Command; import org.bukkit.entity.EntityType; import org.bukkit.entity.Horse.Variant; import org.bukkit.entity.Player; import org.bukkit.entity.Horse; import org.bukkit.inventory.HorseInventory; import org.bukkit.inventory.ItemStack; import org.bukkit.ChatColor; import org.bukkit.Bukkit; import org.bukkit.Material; public class Main extends JavaPlugin{ public static Main plugin; public final Logger logger = Logger.getLogger("Minecraft"); @Override public void onDisable(){ PluginDescriptionFile pdf = this.getDescription(); this.logger.info(pdf.getName() + " version " + pdf.getVersion() + " has been disabled! Neigh! ;D"); } @Override public void onEnable(){ PluginDescriptionFile pdf = this.getDescription(); this.logger.info(pdf.getName() + " version " + pdf.getVersion() + " has been enabled! Neigh! ;D"); } @Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ Player player = (Player) sender; if(sender instanceof Player){ if(player.hasPermission("firehorse.spawn")){ if(commandLabel.equalsIgnoreCase("firehorse") || commandLabel.equalsIgnoreCase("fh")){ if(args.length == 0){ Horse horse = (Horse) player.getWorld().spawnEntity(player.getLocation(), EntityType.HORSE); HorseInventory horseinv = null; ItemStack saddle = new ItemStack(Material.SADDLE); horse.setVariant(Variant.SKELETON_HORSE); horse.setCustomName(player.getDisplayName() + "'s Fire Horse"); horse.setTamed(true); horseinv.setSaddle(saddle); Bukkit.getScheduler().scheduleSyncRepeatingTask(t…
has answer: http://stackoverflow.com/a/25119851
has answer: http://stackoverflow.com/a/25120247
has title: Stopping Bukkit Loops and Logging When a Horse Dies in Bukkit
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/34390943
has answer: http://stackoverflow.com/a/25134979
tagged with: java
tagged with: bukkit
has answer: http://stackoverflow.com/a/25119707
type: Question
tagged with: minecraft

http://stackoverflow.com/a/25073540
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39008755
has comment: http://stackoverflow.com/comment/39008817
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25073497
answers question: http://stackoverflow.com/q/25073497
has body: First, it is not recommended to use clone() in Java since clone is broken. Second, by using clone - you're cloning the array - not the items in the array. For more information in regards read about deep vs. shallow copy.
has comment: http://stackoverflow.com/comment/39008892

http://stackoverflow.com/a/25175597
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25175289
downvote count: 0
has body: I don't think any version of Apache Tomcat supports injection of EntityManager or EntityManagerFactory objects out of the box. You need to choose a server platform that supports more of the JavaEE specification.

http://stackoverflow.com/comment/39519605
score: 0
type: AnswerComment
type: Comment
has text: I just added Edit 3. Check it out. This will be a simple test that you can do to see the size of your codebase + libraries vs. the image files.
comment on: http://stackoverflow.com/a/25101604

http://stackoverflow.com/q/25148327
has body: Suddenly I'm getting the error below in my spring application and I can't see why. I don't believe I've altered anything in my pom.xml file to cause this. Has anyone any ideas on how I can fix the issue? Error: Aug 05, 2014 10:02:52 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_25\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\Blue Coat\ProxyClient\;C:/Program Files/Java/jdk1.7.0_25/bin/../jre/bin/server;C:/Program Files/Java/jdk1.7.0_25/bin/../jre/bin;C:/Program Files/Java/jdk1.7.0_25/bin/../jre/lib/amd64;C:\Program Files (x86)\Blue Coat\ProxyClient\;C:\Program Files (x86)\Blue Coat\ProxyClient\;C:\oracle\product\11.2.0\client_1\bin;H:\Notedata;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Lotus\Notes;C:\Program Files (x86)\Blue Coat\ProxyClient\;C:\Program Files (x86)\OpenSSH\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.7.0_25\bin;C:\Users\E048944\Software\gradle-1.11\\bin;C:\Users\E048944\Software\apache-maven-3.2.1\bin;C:\Users\E048944\Software\apache-ant-1.9.3\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraEdit\;C:\Program Files (x86)\Vim\vim73;C:\Program Files (x86)\PuTTY;C:\Users\E048944\Software\groovy-2.2.2\bin;C:\Users\E048944\Software\curl;C:\oracle\product\11.2.0\client_1\bin;H:\Notedata;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Lotus\Notes;C:\Program Files (x86)\Blue Coat\ProxyClient\;C:\Program Files (x86)\OpenSSH\bin;C:\Program Files\TortoiseSVN\bin;;C:\Users\E048944\Software\eclipse-jee-luna-win32-x86_64;;. Aug 05, 2014 10:02:52 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclip…
downvote count: 0
tagged with: pom.xml
favorite count: 0
has answer: http://stackoverflow.com/a/25156410
has comment: http://stackoverflow.com/comment/39148732
has comment: http://stackoverflow.com/comment/39148967
has title: Why am I getting this NoClassDefFoundError?
tagged with: maven
tagged with: spring
has comment: http://stackoverflow.com/comment/39148995
possible better answer: http://stackoverflow.com/a/25149145
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25149145
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39149564
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39149557
accepted answer: http://stackoverflow.com/a/25156410
has comment: http://stackoverflow.com/comment/39148768
answer count: 2

http://stackoverflow.com/a/25093084
score: 0
has comment: http://stackoverflow.com/comment/39797550
type: Answer
has comment: http://stackoverflow.com/comment/39621851
has comment: http://stackoverflow.com/comment/39808238
has comment: http://stackoverflow.com/comment/39821841
has comment: http://stackoverflow.com/comment/39792656
has body: In android all The network operations are to be done within a thread. Even if you are creating a service all network operations will be done within a thread. Service within a thread is not possible. Now if You want your network operations to be available in multiple activities you should create a service otherwise A separate network thread within an activity will do the job.
answers question: http://stackoverflow.com/q/25093029

http://stackoverflow.com/a/25094450
score: 4
has comment: http://stackoverflow.com/comment/39053806
has comment: http://stackoverflow.com/comment/39053949
has comment: http://stackoverflow.com/comment/39052690
has comment: http://stackoverflow.com/comment/39265565
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39052885
has comment: http://stackoverflow.com/comment/39054617
has comment: http://stackoverflow.com/comment/39054432
has comment: http://stackoverflow.com/comment/39052192
has comment: http://stackoverflow.com/comment/39049992
has comment: http://stackoverflow.com/comment/39050446
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/39052057
has comment: http://stackoverflow.com/comment/39052156
has comment: http://stackoverflow.com/comment/39054130
has comment: http://stackoverflow.com/comment/39049215
has comment: http://stackoverflow.com/comment/39051111
has comment: http://stackoverflow.com/comment/39054315
answers question: http://stackoverflow.com/q/25094333
downvote count: 0
has comment: http://stackoverflow.com/comment/39052108
has comment: http://stackoverflow.com/comment/39069488
accepted answer of: http://stackoverflow.com/q/25094333
has comment: http://stackoverflow.com/comment/39049971
has comment: http://stackoverflow.com/comment/39048205
has body: You cannot pass a Callable into a Thread to execute. Use the ExecutorService to execute the Callable object. You can give it Callable objects to run using its submit() method: &lt;T&gt; Future&lt;T&gt; submit(Callable&lt;T&gt; task) Your class should look like: class Worker { private final CountDownLatch startSignal; private final CountDownLatch doneSignal; private final int threadNumber; Worker( CountDownLatch startSignal, CountDownLatch doneSignal, int threadNumber ){ this.startSignal = startSignal; this.doneSignal = doneSignal; this.threadNumber = threadNumber; } public String[][] getSomeStrArrArr() { try { startSignal.await(); if (threadNumber == 1) { System.out.println("Running thread number 1"); } if (threadNumber == 2) { System.out.println("Running thread number 2"); } if (threadNumber == 3) { System.out.println("Running thread number 3"); } doneSignal.countDown(); } catch (InterruptedException ex) { System.out.println( "Thread number "+threadNumber+" has been interrupted." ); } // replace these 2 lines with the actual code to get the String[][] String[][] someStrArrArr = new String[1][1]; someStrArrArr[0][0] = "Done with thread number "+threadNumber; return someStrArrArr; } public Callable&lt;String[][]&gt; getSomeCallableStrArrArr(){ return new Callable&lt;String[][]&gt;() { public String[][] call() throws Exception { return getSomeStrArrArr(); } }; } } And you'd start it like: ExecutorService pool = Executors.newFixedThreadPool(3); Set&lt;Future&lt;String[][]&gt;&gt; set = new HashSet&lt;Future&lt;String[][]&gt;&gt;(); CountDownLatch startSignal = new CountDownLatch(1); CountDownLatch doneSignal = new CountDownLatch(3); for (int i=1;i&lt;=3;i++) { Worker worker = new Worker(startSignal,doneSignal,i); Callable&lt;String[][]&gt; callable = worker.getSomeCallableStrArrArr(); Future&lt;String[][]&gt; future = pool.submit(callable); set.add(future); } And, to get and print the result strings: for(Future&lt;String[][]&gt; future : set){ String[][] result = futur…

http://stackoverflow.com/a/25192226
has comment: http://stackoverflow.com/comment/40950873
answers question: http://stackoverflow.com/q/25192001
has body: It looks like the documentation is out-of-date with the current version you are using. Try rolling back to a more stable version of 9.2.x like: org.eclipse.jetty.websocket websocket-client 9.2.0.RC0
score: 0
type: Answer

http://stackoverflow.com/q/25211718
favorite count: 0
tagged with: swing
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/25211807
score: 1
tagged with: java
tagged with: file
type: Question
has answer: http://stackoverflow.com/a/25211807
tagged with: awt
has title: Error Writing Object's Attributes to File from GUI java
tagged with: jtable
upvote count: 1
answer count: 1
has body: I have a problem with my GUI code that I just can't get my head around it and it concerns file writing with GUI Frames. You see with my code below, I can Add, Remove and Display person Objects with a JTable. The problem I have is writing each attribute of each object to a file named "PersonList.txt". The annoying thing about this is that supposing I manually put values into the file, my code is able to read each line and create person objects with the values from the files. But if I wanted to add more person objects to the file, the data in the file is overriden and the file will be empty. My Code follows. import javax.swing.*; import javax.swing.table.*; import java.awt.*; import java.awt.event.*; import java.util.*; import java.io.*; public class GUIstoringObjects extends JFrame implements ActionListener{ private JFrame frame; private JButton button1, button2, button3, button4, button5, button6; private JTextField box1, box2, box3; private JLabel label1, label2, label3; private JTable table; private ArrayList&lt;Person&gt; pList = new ArrayList&lt;Person&gt;(); private ArrayList&lt;Object[]&gt; list; private File f1, f2; private PrintWriter pWriter; private Scanner pReader; public static void main(String[] args) throws FileNotFoundException{ // TODO Auto-generated method stub GUIstoringObjects gui = new GUIstoringObjects(); gui.frame.setVisible(true); } public GUIstoringObjects() { initialize(); } public void initialize() { frame = new JFrame("Adding and Saving Person Objects"); frame.setBounds(75,75,813,408); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); label1 = new JLabel("First Name:"); label1.setBounds(32,27,60,25); frame.getContentPane().add(label1); label2 = new JLabel("Last Name:"); label2.setBounds(264,27,82,25); frame.getContentPane().add(label2); label3 = new JLabel("Phone Number:"); label3.setBounds(504,27,89,25); frame.getContentPane().add(label3); box1 = new JTextField(); box1.setBounds(102,26,140,27); …

http://stackoverflow.com/comment/39015894
score: 0
type: AnswerComment
type: Comment
has text: save(obj)? you mean save(instance);
comment on: http://stackoverflow.com/a/25074499

http://stackoverflow.com/comment/39072972
has text: what's wrong with brute force here?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25107860
score: 0

http://stackoverflow.com/a/25208285
score: 2
answers question: http://stackoverflow.com/q/25108827
downvote count: 0
type: Answer
upvote count: 2
has body: I found solution. There was a problem with images itself. Some of the images are itself broken. Thanks for the time guys.

http://stackoverflow.com/a/25156410
has body: I renamed out my .m2 directory and re-ran the maven build and this resolved the problem. Cache obviously got corrupted somehow.
type: Answer
accepted answer of: http://stackoverflow.com/q/25148327
upvote count: 4
has comment: http://stackoverflow.com/comment/43773248
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25148327
score: 4

http://stackoverflow.com/a/25091051
accepted answer of: http://stackoverflow.com/q/25090915
answers question: http://stackoverflow.com/q/25090915
has comment: http://stackoverflow.com/comment/39042065
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39042058
type: Answer
has body: Ok, is probably a nicer, cleaner way to do it, but I did it. Basically on my changelog.html page, I have down the bottom hidden in white (blends with background) a little bit of text saying "Current Version: 1.0" So then in Java, I got the page source and dissected each part of it until all I had left was the '1.0' So here is the part with the version: Current Version: 1.0 And in Java, I did this: private void getVersion() { String source; // Try to set a String to the webpages source. try { source = getUrlSource(url); } catch (IOException e) { e.printStackTrace(); } // Split the text in half. String[] v = source.split(" Current Version: "); // Gets the part after 'Current Version: ' String v2 = v[1]; // Removes the end bit. v2 = v2.replace(" ", ""); // All we have left is '1.0' System.out.println(v2); } Thanks for the comments too. Got me going on the solution.

http://stackoverflow.com/comment/39241232
type: Comment
score: 1
has text: @MadProgrammer I've typed it in a few times as a custom close reason (which I was tempted to do this time as well). I figure we have a better case for introducing it if it commonly appears as a custom close reason..
type: AnswerComment
comment on: http://stackoverflow.com/a/25198335

selenium
tags question: http://stackoverflow.com/q/25221701
tags question: http://stackoverflow.com/q/25204448
tags question: http://stackoverflow.com/q/25222663
tags question: http://stackoverflow.com/q/25118016
tags question: http://stackoverflow.com/q/25134280
tags question: http://stackoverflow.com/q/25072805
tags question: http://stackoverflow.com/q/25178089
tags question: http://stackoverflow.com/q/25132115
tags question: http://stackoverflow.com/q/25137802
tags question: http://stackoverflow.com/q/25119284
tags question: http://stackoverflow.com/q/25130436
tags question: http://stackoverflow.com/q/25185746
tags question: http://stackoverflow.com/q/25180859
tags question: http://stackoverflow.com/q/25118438
tags question: http://stackoverflow.com/q/25214559
tag name: selenium
tags question: http://stackoverflow.com/q/25119673
tags question: http://stackoverflow.com/q/25230213
tags question: http://stackoverflow.com/q/25136870
tags question: http://stackoverflow.com/q/25171186
tags question: http://stackoverflow.com/q/25176605
tags question: http://stackoverflow.com/q/25177674
tags question: http://stackoverflow.com/q/25189208
tags question: http://stackoverflow.com/q/25225635
tags question: http://stackoverflow.com/q/25212405
tags question: http://stackoverflow.com/q/25125222
tags question: http://stackoverflow.com/q/25161987
tags question: http://stackoverflow.com/q/25135544
tags question: http://stackoverflow.com/q/25175027
tags question: http://stackoverflow.com/q/25154230
tags question: http://stackoverflow.com/q/25119282
tags question: http://stackoverflow.com/q/25213150
tags question: http://stackoverflow.com/q/25204322
type: Tag
tags question: http://stackoverflow.com/q/25194578
tags question: http://stackoverflow.com/q/25096306
tags question: http://stackoverflow.com/q/25084552
tags question: http://stackoverflow.com/q/25227223
tags question: http://stackoverflow.com/q/25200476
tags question: http://stackoverflow.com/q/25078991
tags question: http://stackoverflow.com/q/25115539
tags question: http://stackoverflow.com/q/25081360
tags question: http://stackoverflow.com/q/25213638
tags question: http://stackoverflow.com/q/25133193

http://stackoverflow.com/comment/39118796
score: 0
comment on: http://stackoverflow.com/q/25130196
type: Comment
has text: @Aniruddha what is happening is as follow: when the activity page is launched a list of arrays of items is populated through JSON data, in other words generated from the internet. When a user clicks on an array of item (picture, title, description), it takes them to a page that provides more information about that item. My intent is that they would have to go through this process three times before being taken to another activity. However, I am still trying to figure it out.
type: QuestionComment

http://stackoverflow.com/q/25142147
type: Question
tagged with: intellij-idea
score: 0
has answer: http://stackoverflow.com/a/25142518
answer count: 1
has title: Android: Extending ActionBarActivity crashes the application
type: UnansweredQuestion
tagged with: android
has body: I am using v7-appcompat as library in my app, i am using IntelliJ-IDEA and imported the appcompat library in the project directory. The library has been integrated since i am getting auto-complete suggestions and the project is showing no errors, i am using the theme "Theme.AppCompat.Light.DarkActionBar" which is also working properly the problem arises when i run the app on the emulator which crashes when the activity which implements "ActionBarActivity" is triggered rest of the activities which implements "Activity" run fine with the AppCompat theme being implemented. This Activity runs fine: import android.app.Activity; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ShareActionProvider; public class home extends Activity{ private ShareActionProvider mShareActionProvider; Button btnPoetry; Button btnProse; Button btnBiography; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.home); btnPoetry = (Button) findViewById(R.id.btnPoetry); btnPoetry.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(home.this, poetry.class); startActivity(i); } }); btnProse = (Button) findViewById(R.id.btnProse); btnProse.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(home.this, prose.class); startActivity(i); } }); btnBiography = (Button) findViewById(R.id.btnBiography); btnBiography.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(home.this, biography.class); startActivity(i); } }); } @Override public boolean onCreateOptionsMenu(Menu menu){ getMenuInflater().inflate(R.menu.main_menu, menu); MenuItem item = menu.findItem(R.id.menu_item_share); mShareActionProvider = (ShareA…
tagged with: java

ssl
tags question: http://stackoverflow.com/q/25188278
tags question: http://stackoverflow.com/q/25155998
tags question: http://stackoverflow.com/q/25229301
type: Tag
tags question: http://stackoverflow.com/q/25124485
tags question: http://stackoverflow.com/q/25094186
tags question: http://stackoverflow.com/q/25085973
tags question: http://stackoverflow.com/q/25224946
tags question: http://stackoverflow.com/q/25122287
tags question: http://stackoverflow.com/q/25178664
tags question: http://stackoverflow.com/q/25207648
tags question: http://stackoverflow.com/q/25192119
tag name: ssl
tags question: http://stackoverflow.com/q/25077004
tags question: http://stackoverflow.com/q/25161886
tags question: http://stackoverflow.com/q/25086892
tags question: http://stackoverflow.com/q/25208494
tags question: http://stackoverflow.com/q/25084104
tags question: http://stackoverflow.com/q/25147435
tags question: http://stackoverflow.com/q/25179006
tags question: http://stackoverflow.com/q/25161813
tags question: http://stackoverflow.com/q/25170861
tags question: http://stackoverflow.com/q/25226391
tags question: http://stackoverflow.com/q/25079751

http://stackoverflow.com/comment/39104984
type: QuestionComment
comment on: http://stackoverflow.com/q/25124595
score: 0
has text: How are you running your application? If you're still getting the same error, it's because there's still a classpath issue somewhere.
type: Comment

http://stackoverflow.com/comment/39112698
has text: Thankyou, I did not know that. I am still a novice myself.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25128627

http://stackoverflow.com/comment/39253172
comment on: http://stackoverflow.com/q/25204725
type: QuestionComment
type: Comment
score: 2
has text: The whole AngularJS documentation explains that REST services should return **data**, in JSON, and that these **data** should be rendered using static AngularJS templates. Why are you returning HTML from your REST services? Spring supports returning JSON natively (using `@RestController` or `@ResponseBody`).

jbutton
tags question: http://stackoverflow.com/q/25090933
tags question: http://stackoverflow.com/q/25075252
tags question: http://stackoverflow.com/q/25162510
tags question: http://stackoverflow.com/q/25073094
tags question: http://stackoverflow.com/q/25071464
tags question: http://stackoverflow.com/q/25110272
tags question: http://stackoverflow.com/q/25117214
tags question: http://stackoverflow.com/q/25112400
type: Tag
tags question: http://stackoverflow.com/q/25169063
tags question: http://stackoverflow.com/q/25109068
tags question: http://stackoverflow.com/q/25107747
tags question: http://stackoverflow.com/q/25163805
tags question: http://stackoverflow.com/q/25225401
tags question: http://stackoverflow.com/q/25087099
tags question: http://stackoverflow.com/q/25070511
tag name: jbutton
tags question: http://stackoverflow.com/q/25199578
tags question: http://stackoverflow.com/q/25082937

http://stackoverflow.com/q/25178469
tagged with: android
has answer: http://stackoverflow.com/a/25179105
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39204500
type: Question
has body: Can you please help me with designing pojo class for json like this, where property used as value? {"1": { "12.08.2014": {"start_time":"09:00","end_time":"11:00"}, "15.08.2014": {"start_time":"09:00","end_time":"11:00"}, } , "2": { "25.08.2014": {"start_time":"09:00","end_time":"11:00"}, "27.08.2014": {"start_time":"09:00","end_time":"11:00"}, "29.08.2014": {"start_time":"09:00","end_time":"11:00"} } } i want to get some like this class POJO { class Schedule{ @JsonProperty("start_time") String startTime; @JsonProperty("end_time") String endTime; @JSON??????? String date; } @????????? List&lt;Schedule&gt; scheduleList; }
accepted answer: http://stackoverflow.com/a/25179105
tagged with: jackson
score: 0
answer count: 2
has title: complicated json to pojo
possible better answer: http://stackoverflow.com/a/25178783
has answer: http://stackoverflow.com/a/25178783

http://stackoverflow.com/comment/39040697
score: 0
type: QuestionComment
has text: @GabeSechan, in case I want to access an element of the jarray (as jstring).How would I do it?
type: Comment
comment on: http://stackoverflow.com/q/25089569

http://stackoverflow.com/a/54237437
upvote count: 0
score: -1
type: Answer
has body: I tried many solution from here including the one which says removing artifacts.xml and try installing with opening software with Run as Administrator also tried to install from the Help option "Install new software" none of this worked for me. Then I updated to the latest version of JDK and it worked perfectly. I hope this help you. Thanks. Vijay P.
answers question: http://stackoverflow.com/q/25094583
downvote count: 1

http://stackoverflow.com/a/25075390
answers question: http://stackoverflow.com/q/25075145
type: Answer
has body: Try this: DriverManager.getConnection("jdbc:mysql://localhost:3306/dbname","username","password"); If this is not sorted out go to where you installed Mysql and open MySQL Notifier and check server is running or not if not start it and then try executing your program.
score: 0

http://stackoverflow.com/a/25231359
type: Answer
has comment: http://stackoverflow.com/comment/39304926
has comment: http://stackoverflow.com/comment/39304883
has body: You could use the Executor Framework, with it you can create a thread pool containing one Thread. The Thread is going to wait for Tasks (Runnables) to execute. And is going to execute them one by one. private ExecutorService executorService; executorService = Executors.newSingleThreadExecutor(); send Tasks this way: executorService.execute(new YourRunnable()); You could also create a n-sized thread pool using Executors.newFixedThreadPool(n) if you wanted to execute several task concurrently. Or submit a Callable if you need a value to be returned. Here's a little introduction. There is also the GuavaLibrary to implement callbacks called when the tasks finish.
upvote count: 1
has comment: http://stackoverflow.com/comment/39305334
score: 1
accepted answer of: http://stackoverflow.com/q/25228109
answers question: http://stackoverflow.com/q/25228109
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39303487

http://stackoverflow.com/comment/39091076
type: Comment
comment on: http://stackoverflow.com/a/25116084
has text: have you checked it programmatically?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39112143
type: Comment
has text: Adding the oct.toString() fixed the problem. Thank you!
comment on: http://stackoverflow.com/a/25128275
score: 0
type: AnswerComment

http://stackoverflow.com/q/25119135
has title: Set private var and read value in method
tagged with: groovy
has answer: http://stackoverflow.com/a/25119478
favorite count: 0
upvote count: 1
type: AnsweredQuestion
tagged with: spock
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25119478
has answer: http://stackoverflow.com/a/25120271
has body: I'm trying to set private variable in class in my Spock test and read this value in class method, but it's not working. Template class public class Template { private String finalMessage; public String getMessage() { return finalMessage; } TemplateTest.groovy given: "A template" Template template = Mock() when: "setting field" String templ = "&lt;APP/&gt;aaaa"; Field f2 = Template.class.getDeclaredField("finalMessage"); f2.setAccessible(true); f2.set(template ,templ); then: "tags set contains all tags" System.out.println(f2.get(template)); System.out.println(template.getMessage()); Output &lt;APP/&gt;aaaa null I am mocking this Template object because it's connecting to database and I don't want use it.
type: Question
answer count: 2
tagged with: testing
downvote count: 0
possible better answer: http://stackoverflow.com/a/25120271

http://stackoverflow.com/a/25097376
downvote count: 0
has body: To create a JsonNode object use ObjectMapper. For example: ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readValue(JSON_STRING, JsonNode.class) Refer to the Jackson documentation for information.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25095791
score: 2

http://stackoverflow.com/q/25160060
has title: String containing Chinese character to ASCII
tagged with: ascii
has comment: http://stackoverflow.com/comment/39169467
has comment: http://stackoverflow.com/comment/39169571
has answer: http://stackoverflow.com/a/34900072
has comment: http://stackoverflow.com/comment/39169468
favorite count: 0
possible better answer: http://stackoverflow.com/a/34900072
has answer: http://stackoverflow.com/a/25160137
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
has body: This is my code, both of the two ways give the same output. String description = "test string with 音樂"; byte[] b = description.getBytes("US-ASCII"); //first way char[] result = new char[b.length]; for ( int i = 0; i &lt; b.length; i++ ) { result[i] = (char)b[i]; } System.out.println(new String(result)); //output - test string with ?? //second way System.out.println(new String(b, "UTF-8")); //output - test string with ?? I am using Eclipse and changed console output encoding to US-ASCII under Run Configuration Is it possible to get it as US-ASCII encoding string? Thanks adv!!!
has comment: http://stackoverflow.com/comment/39169557
type: Question
accepted answer: http://stackoverflow.com/a/25160137
answer count: 2
tagged with: encoding
downvote count: 0

http://stackoverflow.com/comment/39036060
comment on: http://stackoverflow.com/a/25074437
type: AnswerComment
score: 0
type: Comment
has text: This solution works. However, there are some subtleties worth understanding. The reason I'm using onResize() is because LayoutPanels do not scale images, you have to do that manually. I have some images I'm loading into offscreen objects, and later bringing into view. For those objects, when they are first created, inside scheduleDeferred() the getOffsetWidth() function returns 0. Later, when the animation is complete and the object has been brought into view, the browser calls scheduleDeferred() again, and this time getOffsetWidth() returns a valid width.

http://stackoverflow.com/comment/39174576
score: 0
has text: I'm using fancy "getOrDefault" from java 8 (I believe). If running previous version of JDK - replace it with usual get and null checking/ creating new object.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25158393

http://stackoverflow.com/q/25202275
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39249142
has answer: http://stackoverflow.com/a/25207665
score: 3
tagged with: path
upvote count: 3
tagged with: setx
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39248341
type: Question
linked to: http://stackoverflow.com/q/8358265
has title: run setx command using java
tagged with: java
linked to: http://stackoverflow.com/q/8350663
duplicate of: http://stackoverflow.com/q/8358265
has body: I am writing a java code that will append a path string to the %PATH% variable using java In command prompt the command is setx PATH "%PATH%;C:\my Path\" In java here is my code: import java.io.File; import java.io.IOException; public class AddToPATHVariable { public static void main(String[] args) throws InterruptedException, IOException { String folderPath = "C:\\my Path\\"; System.out.println(folderPath); Runtime rt = Runtime.getRuntime() ; Process p = rt.exec("setx PATH \"%PATH%;" + folderPath + "\""); p.waitFor(); p.destroy(); } } The issue is that my command line prompt is append the new string perfectly. But java code is make the value to path variable to be %PATH%;C:\my Path\ someone please guide me in this regard.
has comment: http://stackoverflow.com/comment/39249152

http://stackoverflow.com/comment/39008010
comment on: http://stackoverflow.com/q/25073093
type: Comment
has text: If this is homework or something like that, you should delete those lines and implement those methods.
score: 0
type: QuestionComment

jdialog
type: Tag
tag name: jdialog
tags question: http://stackoverflow.com/q/25071307
tags question: http://stackoverflow.com/q/25096297

http://stackoverflow.com/comment/39285251
comment on: http://stackoverflow.com/q/25221617
type: Comment
type: QuestionComment
has text: You seem to be building a linked list. Why not use the LinkedList implementation that ships with java?
score: 1

http://stackoverflow.com/comment/39249048
comment on: http://stackoverflow.com/q/25202581
score: 0
type: Comment
type: QuestionComment
has text: I am not sure about how your logic (name for td) will work. Also you are iterating list `myrooms`. So there may be **n** number of rows. So you can't receive those values using `request.getParameter` and put it in `String` datatype.

http://stackoverflow.com/a/25096157
type: Answer
answers question: http://stackoverflow.com/q/25090873
score: 0
type: AcceptedAnswer
has body: I needed to update lots of stuff in eclipse, that's how I got it to work... Particularly the library, I needed to update that particularly
accepted answer of: http://stackoverflow.com/q/25090873

http://stackoverflow.com/a/51032633
answers question: http://stackoverflow.com/q/25147094
score: 30
type: Answer
downvote count: 0
has body: Just as @Saravana mentioned: flatmap is better but there are other ways to achieve the same listStream.reduce(new ArrayList&lt;&gt;(), (l1, l2) -&gt; { l1.addAll(l2); return l1; }); To sum up, there are several ways to achieve the same as follows: private &lt;T&gt; List&lt;T&gt; mergeOne(Stream&lt;List&lt;T&gt;&gt; listStream) { return listStream.flatMap(List::stream).collect(toList()); } private &lt;T&gt; List&lt;T&gt; mergeTwo(Stream&lt;List&lt;T&gt;&gt; listStream) { List&lt;T&gt; result = new ArrayList&lt;&gt;(); listStream.forEach(result::addAll); return result; } private &lt;T&gt; List&lt;T&gt; mergeThree(Stream&lt;List&lt;T&gt;&gt; listStream) { return listStream.reduce(new ArrayList&lt;&gt;(), (l1, l2) -&gt; { l1.addAll(l2); return l1; }); } private &lt;T&gt; List&lt;T&gt; mergeFour(Stream&lt;List&lt;T&gt;&gt; listStream) { return listStream.reduce((l1, l2) -&gt; { List&lt;T&gt; l = new ArrayList&lt;&gt;(l1); l.addAll(l2); return l; }).orElse(new ArrayList&lt;&gt;()); } private &lt;T&gt; List&lt;T&gt; mergeFive(Stream&lt;List&lt;T&gt;&gt; listStream) { return listStream.collect(ArrayList::new, List::addAll, List::addAll); }
upvote count: 30

http://stackoverflow.com/a/25125521
type: Answer
accepted answer of: http://stackoverflow.com/q/25123843
answers question: http://stackoverflow.com/q/25123843
has body: You are attempting to load a class named mysql-connector-java-5.1.31-bin. This is not the name of the class, it's the name of the JAR file that contains the class. The name of the MySQL JDBC driver class is com.mysql.jdbc.Driver.
score: 0
type: AcceptedAnswer

ear
tags question: http://stackoverflow.com/q/25158100
tag name: ear
tags question: http://stackoverflow.com/q/25188198
type: Tag

http://stackoverflow.com/q/25172423
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25172518
has answer: http://stackoverflow.com/a/25172558
score: 0
has body: I'm working on a code which will count how many are the groups with the same number. For example: 11022 = 2 groups with the same number 1100021 = 2 groups with the same number 12123333 = 1 group with the same number So far I've come up to this code: package Numbers; import java.util.*; public class Numbers{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); int strI ; strI = scan.nextInt(); int[] a = {strI}; System.out.println(sum(a)); System.out.println("length = "+a.length); } public static in sum(int[] a){ int sum = 0; int last = 0; for (int i = 0; i &lt; a.length - 1; i++){ if(a[i] == a[i + 1] &amp;&amp; last != a[i + 1]){ sum++; } last = a[i]; } return sum; } } My problem is that the inputted number will register as 1 index. is it possible to enter a series of number that will go to different indexes?
answer count: 2
has comment: http://stackoverflow.com/comment/39193533
tagged with: arrays
has comment: http://stackoverflow.com/comment/39193428
has comment: http://stackoverflow.com/comment/39193699
has title: Getting group of the same numbers numbers
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39193410

http://stackoverflow.com/comment/39236456
type: Comment
comment on: http://stackoverflow.com/a/25184561
has text: check this link http://stackoverflow.com/questions/25158746/hibernate-configuration-for-app-engine
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39136137
type: QuestionComment
has text: Where is the configuration of TransactionManager? :)
comment on: http://stackoverflow.com/q/25141768
score: 0
type: Comment

http://stackoverflow.com/a/25166830
upvote count: 5
has comment: http://stackoverflow.com/comment/39184032
type: Answer
accepted answer of: http://stackoverflow.com/q/25166618
answers question: http://stackoverflow.com/q/25166618
downvote count: 0
score: 5
has comment: http://stackoverflow.com/comment/60830404
type: AcceptedAnswer
has body: From the documentation for Files.write: If no options are present then this method works as if the CREATE, TRUNCATE_EXISTING, and WRITE options are present So, once you start specifying OpenOptions, you have to specify the options you need from those three as well (or as you already noted, CREATE_NEW instead of CREATE).

http://stackoverflow.com/q/25137430
tagged with: java
has answer: http://stackoverflow.com/a/25137464
type: Question
type: AnsweredQuestion
score: 0
linked to: http://stackoverflow.com/q/85190
upvote count: 1
downvote count: 1
has title: Java references not updated
favorite count: 0
has body: I have the following code List&lt;String&gt; strings = new ArrayList&lt;String&gt;(); strings.add("a"); strings.add("b"); strings.add("c"); for (String s : strings) { s = new String("x"); } System.err.println(strings); which prints [a, b, c] I thought it would print [x, x, x] because I iterate over the Strings, which returns a reference to a String Object. In the loop I assign a new Object to the reference, accordingly s should point to the new String Object? Where is my fault? What is the best way to update the strings in my array?
has answer: http://stackoverflow.com/a/25137466
has answer: http://stackoverflow.com/a/25137468
accepted answer: http://stackoverflow.com/a/25137468
answer count: 4
possible better answer: http://stackoverflow.com/a/25137463
has comment: http://stackoverflow.com/comment/39127874
has answer: http://stackoverflow.com/a/25137463

http://stackoverflow.com/q/25090645
score: -3
has comment: http://stackoverflow.com/comment/39041194
has title: Array Out Of Bounds Exception Cannot find
has body: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 110 at HeapPriorityQueue.hasLeft(HeapPriorityQueue.java:168) at HeapPriorityQueue.bubbleDown(HeapPriorityQueue.java:111) at HeapPriorityQueue.removeMin(HeapPriorityQueue.java:73) at a4tester.testRandomArray(a4tester.java:224) at a4tester.stressTest(a4tester.java:237) at a4tester.main(a4tester.java:283) I have been trying to find where the Out of bounds exception is coming from and it is driving me insane! It only arises when my HeapPriorityQueue is put through the stress test below. Basically getting an array out of bounds exception when my code is ran through this stress test: public static boolean testRandomArray (int count) { PriorityQueue q = createNewPriorityQueue(count); System.out.println("Testing size: " + count); Random r = new Random(); for ( int i = 0; i &lt; count; i++ ) { int val = r.nextInt(1000000); q.insert (val); } int oldVal = -1; while (!q.isEmpty() ) { int val = (int)((Integer)q.removeMin()).intValue(); // or a bug if ( oldVal &gt; val ) return false; oldVal = val; } return true; } This is my Program: public class HeapPriorityQueue implements PriorityQueue { protected final static int DEFAULT_SIZE = 10000; /* This array is where you will store the elements in the heap */ protected Comparable storage[]; /* Keep track of the current number of elements in the heap */ protected int currentSize; /* You do not need to change this constructor */ public HeapPriorityQueue () { this(DEFAULT_SIZE); } /* You do not need to change this constructor */ public HeapPriorityQueue(int size) { storage = new Comparable[size + 1]; currentSize = 0; } /* * You need to change the implementation of every public method * below this comment. * */ public int size () { return currentSize; } public boolean isEmpty () { if(size() == 0) return true; return false; } public Comparable removeMin () throws HeapEmptyException { if(isEmpty()) throw new HeapEmptyException(); Comparable returnValue = storage[1]; storag…
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/25090688
tagged with: out
has comment: http://stackoverflow.com/comment/39042160
tagged with: bounds
upvote count: 0
tagged with: arrays
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/39272922
comment on: http://stackoverflow.com/a/25214779
type: Comment
has text: I re posted my questions above with my full code so far it is a really hard task all this gui so much coding and to get it all working together without knowledge yet learned is even more difficult. I cant even find resources or help to integrate it all together
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39005649
score: 0
type: AnswerComment
has text: Thank you, although now I get an error saying that my datetime format is invalid?
type: Comment
comment on: http://stackoverflow.com/a/25071728

http://stackoverflow.com/a/25129186
upvote count: 3
has body: As Bohemian mentionned, I'd recommend you to use Guava's Multimap. For example: final Map&lt;String, String&gt; favoriteColors = new HashMap&lt;&gt;(); favoriteColors.put("Jacob", "Red"); favoriteColors.put("Mason", "Blue"); favoriteColors.put("Ethan", "Green"); favoriteColors.put("William", "Red"); final Multimap&lt;String, String&gt; map = Multimaps.forMap(favoriteColors); final Multimap&lt;String, String&gt; inverted = ArrayListMultimap.create(); Multimaps.invertFrom(map, inverted); System.out.println(inverted); Output: {Blue=[Mason], Red=[William, Jacob], Green=[Ethan]}
type: Answer
score: 3
answers question: http://stackoverflow.com/q/25129111
downvote count: 0

http://stackoverflow.com/a/25143308
has comment: http://stackoverflow.com/comment/39139518
upvote count: 4
downvote count: 0
has body: String s = "abc", t="abc"; s == t is true because Java automatically interns String literals. In this case the String literal "abc" has been interned and both s and t point to that same instance. Hence s == t is true. s = s + "d"; t = t + "d"; Strings in Java are immutable. Hence what you are assigning to s and t are two new Strings that have been constructed. Therefore they do not point to the same instance. This is why s == t returns false. s = s.intern(); t = t.intern(); Here you have forcibly interned the string in s.intern(). Since both s and t contain the same string values, the JVM sees that t is the same and makes it point to the same interned-instance as s. Hence s == t is true. As a general note, establishing the equality of strings should be done via .equals() and not ==; == only compares references for reference-types and not values.
has comment: http://stackoverflow.com/comment/39139399
answers question: http://stackoverflow.com/q/25143195
has comment: http://stackoverflow.com/comment/39145777
type: Answer
has comment: http://stackoverflow.com/comment/39139581
score: 4

http://stackoverflow.com/comment/39273177
type: QuestionComment
comment on: http://stackoverflow.com/q/25215067
has text: is your imageview of fixed height and width ?
score: 0
type: Comment

http://stackoverflow.com/q/25144294
type: Question
has answer: http://stackoverflow.com/a/25144411
has title: Robot method how to access two different objects in the class
has comment: http://stackoverflow.com/comment/39140858
has answer: http://stackoverflow.com/a/25144326
answer count: 3
possible better answer: http://stackoverflow.com/a/25144326
accepted answer: http://stackoverflow.com/a/25144411
has comment: http://stackoverflow.com/comment/39140779
has body: I'm trying to write a simple code that calculates the manhattan distance between two robots. The manhattan distance is simply |x1-x2| + |y1-y2|. I have written most of the code but am not sure how to access the x,y coordinates of the second robot that I have created /** * Project 1 -- Robot Position Calculator * * This program creates two Robot objects and * calculates the distance between them. * @author your name * @lab section number and lab instructor's name * @date date of completion */ import java.util.Scanner; /** * The name of each robot is provided as input from the user. * The position of each robot is assigned randomly through the constructor. * The method distance returns the distance between this robot and the other robot. */ public class Robot { /** * The name of the Robot. */ String name; /** * The x-coordinate of the Robot location. */ double x; /** * The y-coordinate of the Robot location. */ double y; /** * Constructor to assign values for instance variables * name assigned using the passed argument. Member variables * x and y are assigned random real values in range [0, 1). * * @param name the robot name */ public Robot(String name) { // TODO assign this.name this.name = name; // TODO assign this.x and this.y using separate calls to Math.random() x = Math.random(); y = Math.random(); } /* * Returns the robot name. * * @returns a string containing no whitespace */ public String getName() { return this.name; } /* * Returns the x-coordinate of the robot location * * @returns a real value in range [0, 1) */ public double getX() { return this.x; } /* * Returns the y-coordinate of the robot location * * @returns a real value in range [0, 1) */ public double getY() { return this.y; } /* * Calculate the Manhattan distance between the robot's location * and the location specified by coordinates (x, y), i.e.: * * @param xCoord a real value for x-coordinate * @param yCoord a real value for y-coordinate * @returns a real value representing the distance */ pub…
favorite count: 0
has comment: http://stackoverflow.com/comment/39140821
type: AnsweredQuestion
score: 1
upvote count: 3
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/25144490

http://stackoverflow.com/comment/39206102
type: Comment
has text: I've added an example to the answer.
comment on: http://stackoverflow.com/a/25179678
type: AnswerComment
score: 0

http://stackoverflow.com/a/25120722
has comment: http://stackoverflow.com/comment/39180521
type: AcceptedAnswer
downvote count: 0
has body: Problems in your code: SummaryFragment doesnot have a empty constructor every fragment requires it SummaryFragment summaryFragment should be SummaryFragment summaryFragment = new SummaryFragmet();//no initialization done so npe in summaryFragment.updateStats(); Communication between fragments should be done through activity. See the developer docs about Fragments.
type: Answer
has comment: http://stackoverflow.com/comment/39097219
accepted answer of: http://stackoverflow.com/q/25120645
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25120645
has comment: http://stackoverflow.com/comment/39167630
has comment: http://stackoverflow.com/comment/39097332
has comment: http://stackoverflow.com/comment/39180220
has comment: http://stackoverflow.com/comment/39180557

http://stackoverflow.com/q/25077665
answer count: 3
possible better answer: http://stackoverflow.com/a/25077764
has title: Parent have list of child or Child have a parent reference
has answer: http://stackoverflow.com/a/25077764
has answer: http://stackoverflow.com/a/25077757
has body: I am designing a database. Am using hibernate. I have Two type of class hierarchy Case 1: class Parent{ private Long id private String name; } class Child{ private Parent parentId; private String name; } Case 2: class Parent{ private Long id private String name; private List&lt;Child&gt; childs; } class Child{ private String name; } My question is which is better approach to do?
score: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39016472
tagged with: java
tagged with: hibernate
tagged with: database
tagged with: mysql
type: Question
accepted answer: http://stackoverflow.com/a/25077757
has answer: http://stackoverflow.com/a/25077788

http://stackoverflow.com/q/25090687
has comment: http://stackoverflow.com/comment/39041610
has body: I have an assignment for my summer class. FYI, I'm super new to programming in general and this is my first time with java and it's a summer class so it's going super fast (please be nice!) lol. Basically I started writing my code in one class, then I split it up into a Card class and a DeckOfCards class and I now need to figure out how to get it all to work together. I get a little confused with calling methods sometimes, especially when separate classes are in play. I think I just need a method to deal out five cards that also tells how many cards are left in the deck. Then get it all working together correctly. Also, I need a toString method but I honestly do not know how to go about that. Any help is greatly appreciated! If you could help explain things too that would be awesome! I think I have everything SO FAR correct but I could be wrong and I'm sure there are better ways to write the code, I'll take any suggestions for a cleaner look too. FYI, I think the prof would rather arrays then enums since we're dealing with arrays right now. Here are the directions... Design and implement a class called Card that represents a standard playing card. Each card has a suit and a face value. Then create a class called DeckOfCards that stores 52 objects of the Card class. Include methods to shuffle the deck, deal a card and report the number of cards left in the deck. The shuffle methods should assume a full deck. Create a driver class (CardsGame) with a main method that deals five cards from the shuffled deck, printing each card as it is dealt. Make sure to write the appropriate constructors, getters, setters, toString and other methods as required for both classes. The main class, CardsGame Class import java.util.Scanner; public class CardsGame { public static void main (String [] args) { } } Card Class class Card { public static final int SPADE = 4; public static final int HEART = 3; public static final int CLUB = 2; public static final int DIAMOND = 1; private int rank…
tagged with: shuffle
score: 0
has comment: http://stackoverflow.com/comment/39041245
answer count: 1
has answer: http://stackoverflow.com/a/25090832
tagged with: call
tagged with: java
has title: Java, deck of cards, card class, need to get it all working together
type: UnansweredQuestion
tagged with: methods
has comment: http://stackoverflow.com/comment/39041333
has comment: http://stackoverflow.com/comment/39041302
tagged with: class
type: Question

http://stackoverflow.com/comment/39176255
comment on: http://stackoverflow.com/a/25161861
score: 0
type: AnswerComment
has text: I don't have Skype but you can just email it to me at dlschon0@gmail.com
type: Comment

http://stackoverflow.com/a/25176597
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: You can change your format as this String pattern = "%%s%%d%%s"; // &lt;-- New format String arrayName = "aaaa[12]"; int arrayLength = 12; String printfString = String.format(pattern, Integer.toString(arrayLength - 1).length()); int arrayAt = 4; int arrayTill = 7; for (int arrayIndex = 0; arrayIndex &lt; arrayLength; arrayIndex++) { String formattedString = String.format(printfString, arrayName.substring(0, arrayAt + 1), arrayIndex, arrayName.substring(arrayTill)); System.out.println(formattedString); // no need toString() } You don't need System.out.println(formattedString.toString()); // system.out.print() will call // toString()
answers question: http://stackoverflow.com/q/25176449

http://stackoverflow.com/a/25228121
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39297118
upvote count: 2
has body: btnStop and btnStart are not initalized you need to get them by btnStart = findViewById(R.id.yourStartbuttonId);
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/25228008
answers question: http://stackoverflow.com/q/25228008

http://stackoverflow.com/comment/39203510
type: Comment
score: 0
type: AnswerComment
has text: what is value of time out you gave
comment on: http://stackoverflow.com/a/25177568

http://stackoverflow.com/a/25202804
has body: With FOP, you can try XML to RTF, which Word accepts. From their webpage, XMLmind XSL-FO Converter apparently generates: RTF (can be opened in Word 2000+), WordprocessingML (can be opened inWord 2003+), Office Open XML (.docx, can be opened in Word 2007+), Putting FO to one side, here are 2 different approaches: The first would be to write an XSLT to convert your XML to Flat OPC XML. Most parts in the Flat OPC XML would simply be copied there by your XSLT. (Generate that template content in Word, using "save as XML"). You'll be focusing mainly on populating the document.xml part. Word can open a Flat OPC XML file, or you can use docx4j (a project I work on) to convert Flat OPC XML to docx. The second would be to use the docx4j Flying Saucer fork to convert your XML + CSS to docx content. See the code samples. You may need to customise it a bit; one way of feeding it CSS is this file. This actually ought to work pretty well; there is stuff there for mapping class attributes to Word styles, so if you could adorn your XML with class attributes, you could get even better results.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25187454
downvote count: 0
type: Answer

http://stackoverflow.com/q/25212700
score: 0
tagged with: datastax
answer count: 1
tagged with: cassandra
type: UnansweredQuestion
has title: Cassandra 2.0 - Single node setup timing out on write - replication/consistency?
tagged with: bigdata
has body: I am trying to benchmark cassandra (2.0.9) in a very basic setup (single node), however using the datastax driver (2.0.4) I am getting a WriteTimeoutException very early into my batch insert. I'm using a 4-core machine with 14GB ram, jvm oracle 8u11. Does anyone have any ideas why my writes are failing? Below is my logging output. SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 2014-08-08 17:33:46 INFO ***.***.SimpleClient connect Connected to cluster: Test Cluster 2014-08-08 17:33:46 INFO ***.***.SimpleClient connect Connected to cluster: Test Cluster Datacenter: datacenter1; Host: /&lt;ip address&gt;; Rack: rack1 2014-08-08 17:33:49 INFO ***.***.SimpleClient loadData i: 0 Exception in thread "main" com.datastax.driver.core.exceptions.WriteTimeoutException: Cassandra timeout during write query at consistency ONE (1 replica were required but only 0 acknowledged the write) at com.datastax.driver.core.exceptions.WriteTimeoutException.copy(WriteTimeoutException.java:54) at com.datastax.driver.core.DefaultResultSetFuture.extractCauseFromExecutionException(DefaultResultSetFuture.java:256) at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:172) at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:52) at ***.***.SimpleClient.loadData(SimpleClient.java:97) at ***.***.App.cassandraMapInsert(App.java:371) at ***.***.App.main(App.java:354) Caused by: com.datastax.driver.core.exceptions.WriteTimeoutException: Cassandra timeout during write query at consistency ONE (1 replica were required but only 0 acknowledged the write) at com.datastax.driver.core.exceptions.WriteTimeoutException.copy(WriteTimeoutException.java:54) at com.datastax.driver.core.Responses$Error.asException(Responses.java:93) at com.datastax.driver.core.DefaultResultSetFuture.onSet(Defau…
has comment: http://stackoverflow.com/comment/39323227
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25418718
tagged with: ubuntu

http://stackoverflow.com/q/25192119
has comment: http://stackoverflow.com/comment/39230770
tagged with: java
has comment: http://stackoverflow.com/comment/39231065
has comment: http://stackoverflow.com/comment/39230945
type: Question
tagged with: video-streaming
has comment: http://stackoverflow.com/comment/39230994
tagged with: opencv
has comment: http://stackoverflow.com/comment/39257526
has body: I'm streaming an MJPEG over the network to a Java OpenCV client program. It reads the stream like this: VideoCapture capture = new VideoCapture(); capture.open("http://10.0.0.5:8080/DerpStreamer/StreamingServlet?dummy=video.mjpg"); // loop for reading jpg frames This works fine and dandy. I'm wanting to experiment sending this mjpeg over SSL just for fun. I know it would be much slower, maybe there's a better way to encrypt videos for streaming? Anyway, I installed SSL on my web server, verified it was working and then blindly just changed the URL string to https://x.x.x.x:8443 It didn't work, and I realized it was because my client wasn't decrypting with the public key. My client knows nothing about SSL right now. So I did some digging and found some examples of how to write a simple Java SSL client. But when I looked at the VideoCapture API I didn't see a way to make it work. It won't take any kind of Reader or InputStream, only a device ID or Filename. I guess I could decrypt it, write it to some file or pipe, and then have VideoCapture read that, but it would make it even slower. Is that a reasonable thing to do, or is it incredibly stupid and I should forget about sending the video over SSL? Any suggestions? How much of a slow down should I anticipate if I switch from HTTP to HTTPS for my video streaming?
has comment: http://stackoverflow.com/comment/39237760
tagged with: ssl
has comment: http://stackoverflow.com/comment/39230884
has comment: http://stackoverflow.com/comment/39230686
upvote count: 2
has comment: http://stackoverflow.com/comment/39230560
favorite count: 0
has title: OpenCV VideoCapture with HTTPS
type: UnansweredQuestion
score: 2
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/39127195
has text: Please note that *listA.get(a)* and *listB.get(b)* will be expensive for *LinkeList* as in **O(n)**, while for **ArrayList** *get(index)* costs **O(1)**. Even then the suggested solution has quadratic time complexity, which could be too expensive for high **N** and **M** (sizes of the lists).
comment on: http://stackoverflow.com/a/25135546
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25158213
has body: How about this, here I will first find and check for length then will check the elements. public boolean equals(CircularList&lt;T&gt; other) { boolean result = false; result = first.equals(other.first); if (!result) return result; Element&lt;T&gt; next = first.next; Element&lt;T&gt; nextOfOther = other.first.next; int firstCount = 1; while (null != next) { if (next.equals(first)) break; firstCount++; next = next.next; } int secondCount = 1; while (null != nextOfOther) { if (nextOfOther.equals(other.first)) break; secondCount++; nextOfOther = nextOfOther.next; } if (firstCount != secondCount) { result = false; } next = first.next; nextOfOther = other.first.next; while (firstCount &gt; 1) { result = next.equals(nextOfOther); if (!result) // We know they aren't equal so break break; next = next.next; nextOfOther = nextOfOther.next; firstCount--; } return result; }
has comment: http://stackoverflow.com/comment/39166213
score: 0
has comment: http://stackoverflow.com/comment/39166336
type: Answer
has comment: http://stackoverflow.com/comment/39166403
answers question: http://stackoverflow.com/q/25156195
has comment: http://stackoverflow.com/comment/39166266

http://stackoverflow.com/comment/39115731
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25130557
has text: @javafan try to re-think your design and see if you can come up with another one that doesn't use reflection. Once you've found it - you'll get two added-values: 1) you got rid of the casting issue 2) you're not using reflection (which [should be avoided as much as possible](http://programmers.stackexchange.com/a/101217/47531))
score: 1

ajax
tags question: http://stackoverflow.com/q/25150577
tags question: http://stackoverflow.com/q/25198399
tags question: http://stackoverflow.com/q/25201142
tags question: http://stackoverflow.com/q/25133155
type: Tag
tags question: http://stackoverflow.com/q/25097435
tags question: http://stackoverflow.com/q/25190069
tags question: http://stackoverflow.com/q/25072233
tags question: http://stackoverflow.com/q/25105973
tags question: http://stackoverflow.com/q/25163513
tags question: http://stackoverflow.com/q/25081504
tags question: http://stackoverflow.com/q/25185194
tags question: http://stackoverflow.com/q/25122660
tags question: http://stackoverflow.com/q/25131802
tags question: http://stackoverflow.com/q/25178372
tags question: http://stackoverflow.com/q/25182014
tags question: http://stackoverflow.com/q/25218103
tags question: http://stackoverflow.com/q/25112923
tags question: http://stackoverflow.com/q/25228571
tag name: ajax
tags question: http://stackoverflow.com/q/25205517

http://stackoverflow.com/comment/39124400
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25135007
has text: Please what exception do you get exactly! Is it the same or is the nested exception a different one. As I stated before support for placeholders has to be build into the namespace by the providers of the namespace.

integer
tags question: http://stackoverflow.com/q/25183501
tags question: http://stackoverflow.com/q/25118771
tags question: http://stackoverflow.com/q/25210329
tags question: http://stackoverflow.com/q/25109390
tag name: integer
tags question: http://stackoverflow.com/q/25221885
tags question: http://stackoverflow.com/q/25223907
tags question: http://stackoverflow.com/q/25228014
type: Tag

http://stackoverflow.com/a/25123172
answers question: http://stackoverflow.com/q/25084970
type: Answer
has body: got it. The problem was that during a normal run, the aspect was autodiscovered BEFORE the class that it was supped to follow. In practice I have this in my WebAppInitializer: @Override protected Class&lt;?&gt;[] getRootConfigClasses() { return new Class&lt;?&gt;[] { CoreConfig.class, LibConfig.class }; } @Override protected Class&lt;?&gt;[] getServletConfigClasses() { return new Class&lt;?&gt;[] { WebConfig.class}; } LibConfig is the one that autodiscovers the service in the library (the one on which the aspect was walways working). CoreConfig is the one that discovers the aspect. WebConfig is the one that autodiscovers the other class that I wanted to intercept. So, while starting up, the aspect was initialized before the class from WebConfig was available and so the it couldn't place the Pointcut. During tests, all the classes where loaded together and everything was fine.
accepted answer of: http://stackoverflow.com/q/25084970
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/25111320
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/39079692
answer count: 2
downvote count: 4
upvote count: 0
accepted answer: http://stackoverflow.com/a/25112985
possible better answer: http://stackoverflow.com/a/25113248
has comment: http://stackoverflow.com/comment/39094312
has comment: http://stackoverflow.com/comment/39087761
favorite count: 0
has answer: http://stackoverflow.com/a/25113248
has comment: http://stackoverflow.com/comment/39079895
has title: Memory occupy by variable
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25112985
type: Question
has body: When a variable is initialized time and again do it occupy fresh memory at each initialization. Is this the reason why in a for loop initialization occurs only once at time of starting of loop because if variable is initialized at every next loop.it will occupy a lot of space in RAM.

http://stackoverflow.com/comment/39783314
score: 0
has text: I was finally able to build a selfcontained example. It works, but when it put this into Jersey, the marshaller throws: javax.xml.bind.PropertyException: name: `eclipselink.oxm.metadata-source value: java.io.ByteArrayInputStream@1dbb0de` because jersey passes `OXM_METADATA_SOURCE` to the marshaller.
type: Comment
comment on: http://stackoverflow.com/a/25268560
type: AnswerComment

http://stackoverflow.com/a/37419086
answers question: http://stackoverflow.com/q/25138413
downvote count: 0
type: Answer
upvote count: 1
has body: Looking at the source code, I figured out that native-maven-plugin sets the build.finalName to &lt;artifactId&gt;, and ignores the original &lt;finalName&gt; and &lt;linkerFinalName&gt;: . So changing &lt;artifactId&gt; to what you want in the finalName "solves" the problem.
score: 1

http://stackoverflow.com/q/25145789
duplicate of: http://stackoverflow.com/q/19109131
has answer: http://stackoverflow.com/a/25146029
favorite count: 0
has body: I saw an example on here how to sort an ArrayList using the Comparator interface, so I tried it out. With Strings it worked perfectly, but with one variable that I want to sort being an Integer, it will not compile, saying "int cannot be dereferenced". What can I do so that this will work and allow me to sort an ArrayList by the score variable? Here's my code: public class ScoreComparator implements Comparator<Review> { @Override public int compare(Review o1, Review o2) { return o1.getScore().compareTo(o2.getScore()); } }
has answer: http://stackoverflow.com/a/25145824
has comment: http://stackoverflow.com/comment/39144227
accepted answer: http://stackoverflow.com/a/25145824
linked to: http://stackoverflow.com/q/19109131
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39143811
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/14178539
has title: Comparator - int cannot be dereferenced
has comment: http://stackoverflow.com/comment/39146568
possible better answer: http://stackoverflow.com/a/25146029
type: Question
has comment: http://stackoverflow.com/comment/125830790
has comment: http://stackoverflow.com/comment/39146411
has answer: http://stackoverflow.com/a/25145893
has comment: http://stackoverflow.com/comment/39144051
has comment: http://stackoverflow.com/comment/39146019
upvote count: 2
answer count: 3

oauth-2.0
tag name: oauth-2.0
tags question: http://stackoverflow.com/q/25079795
tags question: http://stackoverflow.com/q/25182926
tags question: http://stackoverflow.com/q/25155668
tags question: http://stackoverflow.com/q/25181890
tags question: http://stackoverflow.com/q/25199974
type: Tag
tags question: http://stackoverflow.com/q/25153075

http://stackoverflow.com/q/25169635
downvote count: 0
tagged with: generics
favorite count: 0
possible better answer: http://stackoverflow.com/a/25170057
accepted answer: http://stackoverflow.com/a/25169740
has answer: http://stackoverflow.com/a/25170057
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: multithreading
type: Question
tagged with: java
tagged with: callable
has comment: http://stackoverflow.com/comment/39188244
tagged with: concurrency
has title: usage of generic in Callable and Future interface?
has answer: http://stackoverflow.com/a/25169740
has body: What's the use of generic in Callable interface? Consider this code which I copied from https://blogs.oracle.com/CoreJavaTechTips/entry/get_netbeans_6: import java.util.\*; import java.util.concurrent.\*; public class CallableExample { public static class WordLengthCallable implements Callable { private String word; public WordLengthCallable(String word) { this.word = word; } public Integer call() { return Integer.valueOf(word.length()); } } public static void main(String args[]) throws Exception { ExecutorService pool = Executors.newFixedThreadPool(3); Set<Future<Integer>> set = new HashSet<Future<Integer>>(); for (String word: args) { Callable<Integer> callable = new WordLengthCallable(word); Future<Integer> future = pool.submit(callable); set.add(future); } int sum = 0; for (Future<Integer> future : set) { sum += future.get(); } System.out.printf("The sum of lengths is %s%n", sum); System.exit(sum); } } Integer in Callable<Integer> and Future<Integer> is not being used. It could be anything else as well like Callable<String> and Future<String> and code will still work. I understand usage of Generics and appreciates its usage specially in collections. Thanks.
answer count: 2

http://stackoverflow.com/comment/39066398
type: QuestionComment
has text: But this Thread is only "one" time running and doesnt have to be synchronized as far as I see. In fact it should run the whole time through but it does only if the println is not commented out.
comment on: http://stackoverflow.com/q/25104405
score: 0
type: Comment

http://stackoverflow.com/q/25167282
has body: When .contains() is called on an ImmutableSet of Strings, is the comparison case-sensitive? In the sample code below, will the parameter key of "foo", "Foo", and "FOO" all return false? public class MyClass { public static final String FOO_KEY = "foo"; public static final String BAR_KEY = "bar"; static final ImmutableSet&lt;String&gt; RESERVED_KEYS = new ImmutableSet.Builder&lt;String&gt;() .add(FOO_KEY) .add(BAR_KEY) .build(); public boolean validate(String key) { if (RESERVED_KEYS.contains(key)) { return false; } else { return true; } } }
has title: Is ImmutableCollection.contains() case-sensitive?
has answer: http://stackoverflow.com/a/25167393
has comment: http://stackoverflow.com/comment/39184124
upvote count: 2
downvote count: 2
possible better answer: http://stackoverflow.com/a/25167393
has answer: http://stackoverflow.com/a/25167330
has comment: http://stackoverflow.com/comment/39183991
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39185943
type: Question
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25283974
accepted answer: http://stackoverflow.com/a/25167330
favorite count: 0

http://stackoverflow.com/q/25192282
has comment: http://stackoverflow.com/comment/39230535
has comment: http://stackoverflow.com/comment/39230171
upvote count: 1
has comment: http://stackoverflow.com/comment/39230091
type: Question
has comment: http://stackoverflow.com/comment/39230158
tagged with: java
has comment: http://stackoverflow.com/comment/39230153
has answer: http://stackoverflow.com/a/25192819
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has body: Background: I am fairly new to the world of Java programming and the Netbeans IDE so apologies if this is a simple question to most people. However, I am looking to run the following code when a button is clicked: JFileChooser fileChooser = new JFileChooser(); int returnValue = fileChooser.showOpenDialog(null); if (returnValue == fileChooser.APPROVE_OPTION){ File file = fileChooser.getSelectedFile(); Scanner InFile = new Scanner(new FileReader(file)); while(InFile.hasNext()) { String string1 = InFile.next(); System.out.print(&quot; &quot; + string1); } The issue is that in order for this code to run correctly, I believe it requires throws IOException after the deceleration of the method? So.... in Netbeans I have created a mouse click event and the following has been created for me: private void jButton1MouseClicked(java.awt.event.MouseEvent evt) { But... I need it to be this instead: private void jButton1MouseClicked(java.awt.event.MouseEvent evt) throws IOException { The problem is that Netbeans seems to have this section of code set to some sort of READ-ONLY and I am not able append the required code. Question: Therefore, my question is simple. How do I add the throws IOException code where it needs to be?
has title: Java - Issues using "throws IOException" in Netbeans with button click event
accepted answer: http://stackoverflow.com/a/25192819
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/39230231

wcf
type: Tag
tag name: wcf
tags question: http://stackoverflow.com/q/25199096
tags question: http://stackoverflow.com/q/25190801
tags question: http://stackoverflow.com/q/25211552
tags question: http://stackoverflow.com/q/25088095

http://stackoverflow.com/comment/40109709
score: 1
has text: in Orika too, if there is no configuration you can just map objects without register them :)
comment on: http://stackoverflow.com/a/25211357
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25119092
has body: According to the Java Cryptography Architecture (JCA) Reference Guide under How to Make Applications "Exempt" from Cryptographic Restrictions, you could bundle a policy file stating exemptions with your application's JAR, but the JAR must then be signed and it is not even sure that Oracle's default crypto providers support this: (NOTE: The SunJCE provider does not supply an implementation of the ExemptionMechanismSpi class.) Needless to say, I have not tested this way... ;) This looks way more complicated than replacing two files. I always installed the jurisdiction policy files on all my JVMs, but I use the Debian Alternatives System to have those files automatically replace the ones provided with the JDK. That makes upgrades much less painful.
type: Answer
has comment: http://stackoverflow.com/comment/39155345
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39173817
answers question: http://stackoverflow.com/q/25118536
downvote count: 0

http://stackoverflow.com/a/25159225
score: 2
accepted answer of: http://stackoverflow.com/q/25159067
has comment: http://stackoverflow.com/comment/40819557
upvote count: 2
has comment: http://stackoverflow.com/comment/39168345
answers question: http://stackoverflow.com/q/25159067
type: AcceptedAnswer
downvote count: 0
has body: you call the scale method in a wrong way.... BufferedImage.TYPE_ARGB = 6; http://docs.oracle.com/javase/7/docs/api/constant-values.html#java.awt.image.BufferedImage.TYPE_4BYTE_ABGR Image.SCALE_FAST = 2; http://docs.oracle.com/javase/7/docs/api/constant-values.html#java.awt.Image.SCALE_FAST try to call : scalledItemImage = itemImage.getScaledInstance(imgX, imgY, BufferedImage.SCALE_FAST); (as proposed above)
type: Answer
has comment: http://stackoverflow.com/comment/40820868
has comment: http://stackoverflow.com/comment/39237538

http://stackoverflow.com/comment/39296946
type: Comment
has text: Thanks! I was thinking this.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25228065

http://stackoverflow.com/comment/39192295
type: QuestionComment
comment on: http://stackoverflow.com/q/25171798
score: 1
has text: `List` is the interface. If you want to instanciate it, you need to use a class that implements the interface, such as `ArrayList`.
type: Comment

http://stackoverflow.com/comment/39107747
score: 0
comment on: http://stackoverflow.com/q/25126340
type: Comment
type: QuestionComment
has text: It will depend on how you will use them. For example, you can store the ending result in a `List` but for current solution (current recursive call) you can store the data in a local `List`.

http://stackoverflow.com/q/25121743
tagged with: android
has comment: http://stackoverflow.com/comment/39100599
favorite count: 0
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/39099131
linked to: http://stackoverflow.com/q/11473849
has comment: http://stackoverflow.com/comment/39099064
has body: I am using an AsyncTask like this: public class DownloadTask extends AsyncTask&lt;String, Integer, String&gt; { ProgressDialog mProgressDialog; private Context context; private PowerManager.WakeLock mWakeLock; String fileName=null; public DownloadTask(Context context,ProgressDialog Dialog) { this.context = context; this.mProgressDialog=Dialog; } @Override protected String doInBackground(String... sUrl) { InputStream input = null; OutputStream output = null; HttpURLConnection connection = null; try { URL url = new URL(sUrl[0]); connection = (HttpURLConnection) url.openConnection(); connection.connect(); if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) { return "Server returned HTTP " + connection.getResponseCode() + " " + connection.getResponseMessage(); } String raw = connection.getHeaderField("Content-Disposition"); if(raw != null &amp;&amp; raw.indexOf("=") != -1) { fileName = raw.split("=")[1]; fileName=fileName.split(";")[0]; fileName=fileName.substring(1, fileName.length()-1); } else { } File f=new File(context.getFilesDir()+"/"+fileName); if(!f.exists()) {Log.d("TAG","DOES NOT EXIST , downloading"); int fileLength = connection.getContentLength(); input = connection.getInputStream(); Log.d("Tag", raw); Log.d("Tag",fileName); output = new FileOutputStream(context.getFilesDir()+"/"+fileName); byte data[] = new byte[4096]; long total = 0; int count; while ((count = input.read(data)) != -1) { if (isCancelled()) { input.close(); File check =new File(context.getFilesDir()+"/"+fileName); check.delete(); return null; } total += count; if (fileLength &gt; 0) publishProgress((int) (total * 100 / fileLength)); output.write(data, 0, count); } } }catch (Exception e) { return e.toString(); } finally { try { if (output != null) output.close(); if (input != null) input.close(); } catch (IOException ignored) { } if (connection != null) connection.disconnect(); } return null; } @Override protected void onPreExecute() { super.onPreExecute(); PowerManager pm = (Power…
has comment: http://stackoverflow.com/comment/39099248
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/39098998
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25123320
tagged with: httprequest
type: Question
has title: Check if File Download has been interrupted
answer count: 2
linked to: http://stackoverflow.com/q/10847526
has comment: http://stackoverflow.com/comment/39099151
has answer: http://stackoverflow.com/a/25123241
possible better answer: http://stackoverflow.com/a/25123320
downvote count: 0
has comment: http://stackoverflow.com/comment/39100731
accepted answer: http://stackoverflow.com/a/25123241

http://stackoverflow.com/comment/39097421
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25120027
type: Comment
has text: ok so you can do the following: `int x = getCharAsInt(1, "01234?6789")` this will store the 2nd char (char at index 1) as integer. So after that, `x = 1` for this particualr example.

http://stackoverflow.com/comment/39216853
comment on: http://stackoverflow.com/q/25184977
has text: This isn't your first question on this network @Karthi, you should know better
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25262681
answers question: http://stackoverflow.com/q/25215610
type: Answer
score: 0
has body: The problem i was the hash key that i have uploaded and that i got from the code below were different. That was the reason that when facebook app was installed on the device it did not get the logged in session of the user. Thus I wrote this code, got the hash, updated on my console and woo.. i got the login perfect. I am posting this so that my fellow developer save some time that i have spent in solving this problem. try { PackageInfo info = getPackageManager().getPackageInfo( "com.facebook.samples.loginhowto", PackageManager.GET_SIGNATURES); for (Signature signature : info.signatures){ MessageDigest md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT)); } } catch (NameNotFoundException e) { } catch (NoSuchAlgorithmException e) { }
accepted answer of: http://stackoverflow.com/q/25215610
type: AcceptedAnswer

http://stackoverflow.com/a/25209591
type: Answer
upvote count: 1
has body: Well as Drakosha said shifting right by 1 : int x = y &gt;&gt; 1; or multiply by 0.5: int x = (int)(y * 0.5); or subtract by the value multiplied by 0.5: int x = (int)(y - (y * 0.5));
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25209428

http://stackoverflow.com/q/25214211
tagged with: java
score: 7
tagged with: jboss
type: Question
tagged with: jakarta-ee
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25613747
favorite count: 0
tagged with: cdi
has answer: http://stackoverflow.com/a/25214813
has body: My project structure looks like project/ business/pom.xml services/pom.xml integration/pom.xml business/pom.xml com.self persistence ${project.version} junit junit persistence/pom.xml org.hibernate.javax.persistence hibernate-jpa-2.0-api ${hibernate-jpa-2.0-api.version} com.mysema.querydsl querydsl-apt ${querydsl-version} com.mysema.querydsl querydsl-core ${querydsl-version} com.mysema.querydsl querydsl-jpa ${querydsl-version} junit junit org.hibernate hibernate-entitymanager ${hibernate-entitymanager.version} test com.h2database h2 ${h2.version} test project/pom.xml com.google.code.findbugs jsr305 ${jsr305.version} compile javax javaee-api ${javaee-api.version} business/ClientRegistrationManager.java @Stateless public class ClientRegistrationManager { private EntityManager entityManager; @SuppressWarnings("UnusedDeclaration") public ClientRegistrationManager() { } @Inject public ClientRegistrationManager(@Nonnull final EntityManager entityManager) { this.entityManager = entityManager; } public ClientDetail register(@Nonnull final String email, final long id, @Nonnull final String password) { final UserService userService = new UserService(entityManager); final User user = userService.getUserByEmail(email); return new ClientDetail("clientId", "clientSecret"); } } When I deploy, I see the following error [INFO] [talledLocalContainer] 17:48:53,405 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-15) MSC000001: Failed to start service jboss.deployment.unit."application.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."application.war".WeldStartService: Failed to start service [INFO] [talledLocalContainer] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.0.Final.jar:1.2.0.Final] [INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_05] [INFO] [talledLocalContainer] at java.util.concurrent…
has title: Unsatisfied dependencies for type EntityManager with qualifiers @Default
type: UnansweredQuestion
tagged with: maven
upvote count: 7

http://stackoverflow.com/a/25457258
type: AcceptedAnswer
has body: I figured it out. If I use DashClock API v1.1 everything works fine! No idea what the CM Home problem is with API v2.
answers question: http://stackoverflow.com/q/25127851
type: Answer
has comment: http://stackoverflow.com/comment/39724082
accepted answer of: http://stackoverflow.com/q/25127851
score: 0

http://stackoverflow.com/comment/39282194
has text: Not sure I understand how the path would be constructed? If there's a Maven artifact (say com.company:artifact:v1), how would I construct the path to that class file?
comment on: http://stackoverflow.com/a/25216782
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26195814
has comment: http://stackoverflow.com/comment/41141943
accepted answer of: http://stackoverflow.com/q/25074113
has body: I would say that dynamically loading classes the way you are trying, is a dead end. I see two options: If the client APIs are delivered in a bundle jar (meaning: it can be loaded as bundle into your OSGi framework), the solution would be to load the client API bundle from your first plugin using the standard OSGi APIs of BundleContext and Bundle (BundleContext.installBundle and Bundle.start). This should be possible, since you know the location of the client API jar after the user inputs the installation location. After that, you can do the same for your second bundle that depends on those client APIs. This should bring up all software for performing the functionality. If the client APIs are delivered in a normal jar and you cannot convince the supplier to create a bundle jar for you, the situation is a little more complex. The preferred solution would be to dynamically wrap the client API jar into a bundle jar. There is already software around that performs this action (bnd, pax, eclipse, various frameworks). After the wrapping you are back at the first solution. But question is whether this would be allowed given the licensing terms. If all of the above fails, I guess there is no other solution then creating software outside your plugin environment that bridges the gap via some kind of RPC solution: You need to write some non-plugin code that uses the client jar. This part runs in its own JVM and communicates with a plugin in your OSGi framework via remote method calls. Hope this helps or that this answer will cause some follow-ups with a better solution.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41133678
has comment: http://stackoverflow.com/comment/41133754
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25074113
has comment: http://stackoverflow.com/comment/41104832
has comment: http://stackoverflow.com/comment/41173113

http://stackoverflow.com/a/25220981
has body: i=i++; doesn't change i. It increments i but then assigns the old value of i to i (since the post increment operator returns the old value of the incremented number). Either write : i++; or i=i+1;
downvote count: 0
answers question: http://stackoverflow.com/q/25220964
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/39297074
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25228183
type: AnswerComment
has text: if I put console output inside blocking queue - it works good, but I want to understand why synch block doesn't work inside run

http://stackoverflow.com/comment/39082697
comment on: http://stackoverflow.com/a/25113062
type: Comment
score: 1
has text: Thanks @TAsk. I done it already. My bitmap is Facebook symbol. Now I got it. But it takes time to load and getting error as "W/UnimplementedWebViewApi??(1361): Unimplemented WebView?? method run called from: android.os.Handler.handleCallback(Handler.java:733)"
type: AnswerComment

http://stackoverflow.com/a/25152583
answers question: http://stackoverflow.com/q/25144438
score: 7
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39173925
type: Answer
upvote count: 7
accepted answer of: http://stackoverflow.com/q/25144438
has body: Because your class is annotated as both an @Entity and a @Table, Hibernate assumes that all fields, regardless of modifiers, map to a database column. Hibernate doesn't care that your field is static or final (which are Java constructs), all it cares about is that it can't map the field value to a database column. Mark your logger as @Transient and Hibernate will ignore it.

http://stackoverflow.com/comment/39046701
has text: thanks bro. you are champion. I should check the source code.
score: 1
comment on: http://stackoverflow.com/a/25087054
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39134947
has text: Does your html.html is pure html file without any javascript and css local dependent files? I've tried that it should work, make sure your relative path is correct. By default "user.dir" should be your project working directory.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25140248

http://stackoverflow.com/a/25113477
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25113384
answers question: http://stackoverflow.com/q/25113384
has comment: http://stackoverflow.com/comment/39084095
has comment: http://stackoverflow.com/comment/39083519
score: 5
type: AcceptedAnswer
upvote count: 5
has body: In the class that you want to test you create a new Constructor object (via Constructor const = new Constructor()), hence, you always use the REAL implementation. You have to inject the Constructor object if you want to have it replaced by a mock object for testing. Injection is also possible via constructor for testing. private final Constructor const; // remove final, if required public &lt;ConstructorOfYourClassHere&gt;(Constructor const) { assert const != null : "const != null"; // use assertions, if you like this.const = const; // other constructor code... } // your other code here... public process(String base) { if("abc".equals(base)) { // --- } else if("def".equals(base) { extract(); // --- } } private Obj extract() { Obj object = const.getOBJMethod("12345","c:/file/a.zip",null); return object; } Then you can inject the mock when you create the object under test and call process(). Then your mock implementation will be used. BTW: If you're the owner of the code, you might want to change the visibility of the extract method to protected so that you can test the method, too. See here. Also, you might want to read something about dependency injection in general. Testing with DI is often much easier. You don't have to use a DI-framework, just inject your dependencies via method parameters or via constructor at object creation time.

http://stackoverflow.com/a/25138070
has body: I tried what's suggested in this post and it works. I add the permission programmatically. PropertyPermission propertyPermission = new PropertyPermission("javafx.macosx.embedded", "write"); However the permissions of the orginal policy are lost.
answers question: http://stackoverflow.com/q/25137311
score: 0
type: Answer

http://stackoverflow.com/q/25113835
tagged with: java
type: Question
has title: Swipe gesture does not work in AlertDialog on Google Glass
has body: I implemented gesture detection on my app and it works well on a activity. Now, what i want to do is to be able to use those gesture detection in an AlertDialog. Indeed i have an activity with a Cancel button. When i click on this button, the user have to confirm his choice in an AlertDialog which have two button: Yes and No. However, in this AlertDialog, swipe gesture does not work and i am not able to choose between Yes or No because it only focus on the No button. I want to implement Swipe gesture detection for this alert dialog. Here is what i did : package com.example.recente; import android.app.ActionBar.LayoutParams; import android.app.Activity; import android.app.AlertDialog; import android.app.Fragment; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import com.google.android.glass.touchpad.Gesture; import com.google.android.glass.touchpad.GestureDetector; public class ChoixUtilisateur extends Activity { private GestureDetector mGestureDetector; Button cancelno; Button cancelyes; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mGestureDetector = createGestureDetector(this); setContentView(R.layout.fragment_choix_utilisateur); Button execute = (Button)findViewById(R.id.execute); execute.setFocusable(true); execute.setFocusableInTouchMode(true);///add this line execute.requestFocus(); } private GestureDetector createGestureDetector(Context context) { GestureDetector gestureDetector = new GestureDetector(context); //Create a base listener for generic gestures gestureDetector.setBaseListener( new GestureDetector.BaseListener() { @Override public boolean onGesture(Gesture gesture) { Button can…
upvote count: 2
tagged with: google-glass
has answer: http://stackoverflow.com/a/25113928
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 2

http://stackoverflow.com/comment/40212400
has text: Actually the SARXOS API is great API and I also tried the jmf but it's better to use SARXOS for the simplicity and reliablity.Thanks a lot buddies...
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25184095
type: Comment

http://stackoverflow.com/a/25117081
has comment: http://stackoverflow.com/comment/39090528
has comment: http://stackoverflow.com/comment/39090104
score: 0
has body: the first way only can start your own Activity in your project. the second can start a activity of other App if its exproted != false in AndroidManifext.xml. I guess.
type: Answer
answers question: http://stackoverflow.com/q/25117002

http://stackoverflow.com/q/25162806
tagged with: android
has answer: http://stackoverflow.com/a/25163055
tagged with: location-services
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39175880
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/39175652
type: Question
linked to: http://stackoverflow.com/q/11546214
has comment: http://stackoverflow.com/comment/39175580
accepted answer: http://stackoverflow.com/a/25163055
linked to: http://stackoverflow.com/q/13481653
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/1051649
favorite count: 0
has title: Turn off Location Services from my Android App
has body: Salaam my friends, Is there any specific code that I can use to turn off the location services in my phone from my app? Regards, Tareq Al-Aqarbeh﻿

http://stackoverflow.com/comment/39261644
comment on: http://stackoverflow.com/a/25208612
has text: @user3923111 In that case, you can do `i--;continue;`, which will cause the same `tileArray` to be processed, but be careful, since you might get an infinite loop. Alternately, you can remove the `i++` from the for loop, and only increment it when some condition is met.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39288969
comment on: http://stackoverflow.com/q/25223897
has text: The Document is null, but one it's root properties, which it uses to generate the output, is. Try processing the document in some way and you'll see its fine...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25223691
accepted answer of: http://stackoverflow.com/q/25223553
answers question: http://stackoverflow.com/q/25223553
has comment: http://stackoverflow.com/comment/118258134
upvote count: 150
type: AcceptedAnswer
downvote count: 1
has body: For a completely stateless utility class in Java, I suggest the class be declared public and final, and have a private constructor to prevent instantiation. The final keyword prevents sub-classing and can improve efficiency at runtime. The class should contain all static methods and should not be declared abstract (as that would imply the class is not concrete and has to be implemented in some way). The class should be given a name that corresponds to its set of provided utilities (or "Util" if the class is to provide a wide range of uncategorized utilities). The class should not contain a nested class unless the nested class is to be a utility class as well (though this practice is potentially complex and hurts readability). Methods in the class should have appropriate names. Methods only used by the class itself should be private. The class should not have any non-final/non-static class fields. The class can also be statically imported by other classes to improve code readability (this depends on the complexity of the project however). Example: public final class ExampleUtilities { // Example Utility method public static int foo(int i, int j) { int val; //Do stuff return val; } // Example Utility method overloaded public static float foo(float i, float j) { float val; //Do stuff return val; } // Example Utility method calling private method public static long bar(int p) { return hid(p) * hid(p); } // Example private method private static long hid(int i) { return i * 2 + 1; } } Perhaps most importantly of all, the documentation for each method should be precise and descriptive. Chances are methods from this class will be used very often and its good to have high quality documentation to complement the code.
has comment: http://stackoverflow.com/comment/82808746
type: Answer
score: 149
has comment: http://stackoverflow.com/comment/74572862

http://stackoverflow.com/q/25092302
upvote count: 12
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25092630
has comment: http://stackoverflow.com/comment/119859125
has answer: http://stackoverflow.com/a/25092468
answer count: 4
has title: What is the difference between Advisor and Aspect in AOP?
score: 12
has answer: http://stackoverflow.com/a/47061851
has body: I am new to Spring AOP. Based on my understanding, I noticed that both Advisor (for example DefaultPointcutAdvisor) and Aspect (for example the class annotated with @Aspect) can both help to solve the cross-cutting problem by doing something more when a method is invoked. What is the different between these two term please?
tagged with: spring
possible better answer: http://stackoverflow.com/a/25094033
type: Question
linked to: http://stackoverflow.com/q/15447397
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25094033
tagged with: java
tagged with: aop
has answer: http://stackoverflow.com/a/25092630

http://stackoverflow.com/a/38636764
has body: Use the Spring Boot CXF JAX-RS starter by adding: org.apache.cxf cxf-spring-boot-starter-jaxrs 3.1.7 See also: http://cxf.apache.org/docs/springboot.html
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/25083045
upvote count: 3
type: Answer

http://stackoverflow.com/a/25089174
upvote count: 3
downvote count: 0
has body: For ECB and CBC modes of operation, each block (128 bits or 16 bytes for AES) of plaintext or will be encrypted once it is available. Furthermore, your example uses PKCS#7 padding (or, in Java, "PKCS5Padding") to make sure that the last plaintext is padded to a full block. Otherwise you would not be able to encrypt it. When you encrypt it is obviously not a good idea to buffer all the resulting ciphertext. So update will simply return all blocks it can encrypt. Therefore you will always get a multiple of the blocksize back. That means that it may keep part of a block in an internal buffer. Of course, once you add enough bytes for a full block it will encrypt and return the data. All this means that the update may return up to blocksize - 1 bytes more or less than the input. For smaller input it may not return anything at all - everything is buffered until the block is full. Now PKCS#7 padding is always applied, adding 1 to blocksize bytes. Obviously the cipher must know if more bytes are to be expected, or if the end of the plaintext is reached, before it applies the padding. So doFinal will return at least one block, even if no data is presented to it. If the previous updates did not return any data, then the doFinal() method will return the entire ciphertext. More or less the same reasoning can be performed for decryption. Also note the getOutputSize(int inputLength) and the getBlockSize() methods of Cipher. If you want to receive all the data back at once, you can use a stream cipher mode of operation, such as "AES/CTR/NoPadding", which has a block size of 1 byte. Although this should explain the actual issue, the question you asked was "Does it have some maximum length of data it can update?". The answer is that the update is only limited by the amount of memory available in the JVM and the size of byte arrays in Java.
type: Answer
has comment: http://stackoverflow.com/comment/39068902
score: 3
answers question: http://stackoverflow.com/q/25087094

http://stackoverflow.com/comment/39159846
has text: @user3848118 Which line is `RuleServiceImpl.java:63` and you are sure that `logDataRepository` is not `null`?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25154212

http://stackoverflow.com/comment/39038201
has text: Stackoverflow is a question and answer website. So putting question and answer in one post is invalid. So please post your answer using *Answer your own question* as described at http://stackoverflow.com/help/self-answer.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25088899

http://stackoverflow.com/comment/39244276
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25093744
has text: It looks as thought the problem is due to Swing Timer - see above.

http://stackoverflow.com/comment/39212430
type: AnswerComment
has text: Thanks for the answer, i forgot to write that subkeys are dynamic so i do now know how many subkeys there are. Edited the question
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25183282

http://stackoverflow.com/a/25186895
has body: Is it possible to remove JTable header grid lines. Just curious: Why would you want to do that? Now the answer: No it's not. Table header rendering depends on both TableHeaderUI implementation provided by the Look and Feel and JTableHeader's renderer. You can tell the renderer you don't want borders but if L&amp;F uses a custom painter with borders (f.i.: Nimbus) then you still have borders. There are (poor) workarounds though, as described in other answers, but all of them have their limitations. Providing a custom renderer In order to keep tables header's rendering most similar to the original as possible, wich means no losing columns DnD effect, icons when sorting is applied, etc., I'd go with my own renderer as follows: public class TableHeaderRenderer implements TableCellRenderer { private final TableCellRenderer baseRenderer; public TableHeaderRenderer(TableCellRenderer baseRenderer) { this.baseRenderer = baseRenderer; } @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JComponent c = (JComponent)baseRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); c.setBorder(new EmptyBorder(2,2,2,2)); return c; } } Then you can use default renderer as base for the new renderer, like this: JTable table = new JTable(5, 5); table.setAutoCreateRowSorter(true); table.setShowGrid(false); TableCellRenderer baseRenderer = table.getTableHeader().getDefaultRenderer(); table.getTableHeader().setDefaultRenderer(new TableHeaderRenderer(baseRenderer)); However its functioning depends on the L&amp;F: this won't work with Nimbus, for example. Playing with UIManager properties As @blackbishop states, you can use UIManager to set a property to tell the L&amp;F it must not draw table header cells border. However there's no convention about these properties (each L&amp;F has its own properties) and most L&amp;F will probably ignore them.
answers question: http://stackoverflow.com/q/25184138
downvote count: 0
score: 3
type: Answer
upvote count: 3

http://stackoverflow.com/q/25195626
has answer: http://stackoverflow.com/a/25195719
has comment: http://stackoverflow.com/comment/39236148
upvote count: 4
has body: I am working on finding the largest prime factor of any given number. The code below works fine for most numbers until I input the number I want which is 600851475143. Once I do this I get stack overflow. I have been reading up on tail recursion and from what I know I should have implemented it right. Yet, I still receive the stack overflow error despite it. Where am I going wrong when it comes to implementing tail recursion? import java.util.Scanner; public class LargestPrimeFactor { static long number; static long answer; public static void main(String[] args) { System.out.println( "Enter number to find its largest prime factor"); Scanner input = new Scanner(System.in); number = input.nextLong(); answer = largestPrime(number); System.out.println("The largest prime of " + number + " is " + answer); } private static long largestPrime(long n) { n = n-1; if(n % 2 != 0 &amp; number % n == 0 ) { return n; } else { return largestPrime(n); } } }
answer count: 1
tagged with: stack-overflow
favorite count: 0
accepted answer: http://stackoverflow.com/a/25195719
tagged with: tail-recursion
has comment: http://stackoverflow.com/comment/39236144
tagged with: recursion
type: AnsweredQuestion
score: 3
tagged with: java
has title: Tail Recursion java
downvote count: 1
type: Question

http://stackoverflow.com/comment/39204635
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25178052
has text: Packages are placed either in the src/main/java or the src/test/java directories (you can do the same with the resource directories as they are merged with the source/target packages at runtime). Based on the assumption that "Component" is a maven module, it seems to me as the structure you ask for is not valid.

http://stackoverflow.com/q/25073413
answer count: 0
type: UnansweredQuestion
has body: I am using the following code to initialize the google map object: if (googleMap == null) { googleMap = ( (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); } It works fine but on certain devices the googleMap object is shown as null.How do i work around it? I broke the single line code as: FragmentManager fmanager = getSupportFragmentManager(); Fragment fragment = fmanager.findFragmentById(R.id.map); SupportMapFragment supportmapfragment = (SupportMapFragment)fragment; googleMap=supportmapfragment.getMap(); The last line supportmapfragment.getMap() is the one which returns null. My xml file: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Store locator" android:layout_gravity="center_horizontal" android:textSize="40px" /&gt; &lt;fragment android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="200px"/&gt; &lt;ListView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/list_categories" /&gt; &lt;/LinearLayout&gt;
has title: Google Map object returned as null on certain devices
tagged with: java
type: Question
tagged with: google-maps
score: 0
tagged with: google-maps-api-2
tagged with: android
has comment: http://stackoverflow.com/comment/39008613
has comment: http://stackoverflow.com/comment/39008688

http://stackoverflow.com/comment/39044754
type: Comment
score: 0
type: AnswerComment
has text: @user904963 Well, it turns out the answer is wrong. It is not a matter of pedantry. It shows you have failed to grasp this concept, given that you selected this answer.
comment on: http://stackoverflow.com/a/25092333

http://stackoverflow.com/comment/39195374
score: 0
type: Comment
has text: Your statement about [`LocalDate.toString()`](http://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html#toString--) output varying from computer to computer is incorrect. Doc says: `The output will be in the ISO-8601 format uuuu-MM-dd.`
type: AnswerComment
comment on: http://stackoverflow.com/a/25173408

http://stackoverflow.com/a/67517418
type: Answer
score: 1
upvote count: 1
has body: FOR LINUX USERS if java and javac are showing different versions, then you can easily set them to the correct or same versions step 1 sudo update-alternatives --config javac output : Selection Path Priority Status ------------------------------------------------------------ 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/javac 1111 auto mode 1 /usr/lib/jvm/java-11-openjdk-amd64/bin/javac 1111 manual mode * 2 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 manual mode this will show the following message: start(*) indicates the javac version that your system is using. You can change it by selecting your required version. step 2 sudo update-alternatives --config java output : Selection Path Priority Status ------------------------------------------------------------ 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode 1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode * 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode Now again you can select the version you want to run for java. This way you can ensure that java and javac are having the same versions.
downvote count: 0
answers question: http://stackoverflow.com/q/25074017

http://stackoverflow.com/a/25095587
downvote count: 0
answers question: http://stackoverflow.com/q/25095555
type: Answer
score: 1
upvote count: 1
has body: You can detach the entity from the session when you are done with it by calling evict: { Song song = SongCache.loadSongFromDatabase(session, next); folderToSongIds.put(new File(song.getFilename()).getParent(),song.getRecNo()); session.evict(song); }
accepted answer of: http://stackoverflow.com/q/25095555
type: AcceptedAnswer

http://stackoverflow.com/comment/39156394
score: 0
type: Comment
type: QuestionComment
has text: I can't compile it. Am I doing anything wrong?
comment on: http://stackoverflow.com/q/25152625

http://stackoverflow.com/q/25093744
has comment: http://stackoverflow.com/comment/39244276
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25192818
has comment: http://stackoverflow.com/comment/39046837
has body: Running a Java drawing benchmark on a new PC (Core i7-4820K 3.7 GHz, Asus P9X79 LE, GeForce GTX 650, Windows 8.1 and Ubuntu 14.04) appeared to run using vsync at around 60 FPS via Windows with Java RTE 1.7.0_65 . Then, on one later occasion, ran at an expected 400+ FPS, based on speeds on other PCs. Now it is back to 60 FPS. CPU utilisation is almost 0% with GPU at &lt;10% on the lightest test. A new graphics driver made no difference. The same class file obtains 400 FPS via Ubuntu with linux java 1.7.0_55 and makes no difference compiled with JDK 6 or 7. Below is the code without the functions that load, calculate and display images. This obtains nearly 600 FPS on an older slightly slower Win 7 PC but, again, 60 FPS on the new PC. A variation of the code to run on-line via an HTML applet runs at 400+ FPS. Does anyone have an explanation? // Save as JavaDrawIt.java // Compile command - javac JavaDrawIt.java // Run command - java JavaDrawIt import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.Random; public class JavaDrawIt extends JPanel implements ActionListener { Timer timer; static int WIDTH = 1280 ; static int HEIGHT = 720 ; int gch = 1; int gcm = 1; int grn = 0; String msg; double fps; double startTime; double runTime = 0; int frames = 0; Random randNum = new Random(); private JavaDrawIt() { randNum.setSeed(999); timer = new Timer(0, this); startTime = (double)System.currentTimeMillis(); } public void actionPerformed(ActionEvent e) { if (runTime &lt;= 5.0) { repaint(); } } public void paintComponent(Graphics g) { int i; float fh; float fw; super.paintComponent(g); grn = grn + gch; if (grn &gt; 255) { gch = -gcm; grn = 255; } if (grn &lt; 1) { gch = gcm; grn = 0; } g.setColor(new Color(0, grn, 255)); g.fillRect(0, 0, WIDTH, HEIGHT); frames = frames + 1; Graphics2D g2 = (Graphics2D)g; Font font = new Font("MONOSPACE", Font.PLAIN, 24); g2.setFont(font); g.setColor (Color.WHITE); runTime = ((double)System.currentTimeMillis() - startTim…
tagged with: vsync
tagged with: java
type: Question
tagged with: benchmarking
has title: Why is Java drawing slow on a new PC? - VSYNC?
answer count: 1
tagged with: drawing

http://stackoverflow.com/a/25176862
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39201055
has comment: http://stackoverflow.com/comment/39201255
has body: Try this: &lt;xsd:simpleType name="Date"&gt; &lt;xsd:restriction base="xsd:string"&gt; &lt;xsd:pattern value="^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$"/&gt; &lt;/xsd:restriction&gt; &lt;/xsd:simpleType&gt;
upvote count: 2
answers question: http://stackoverflow.com/q/25176754

http://stackoverflow.com/a/70200996
answers question: http://stackoverflow.com/q/25072146
has comment: http://stackoverflow.com/comment/124097701
type: Answer
score: 0
has body: I used XML Comment markup for JS to make it work in XML &lt;script&gt; &lt;!-- [Place your Javascript here] --&gt; &lt;/script&gt;

http://stackoverflow.com/comment/39282381
type: Comment
type: QuestionComment
score: 1
has text: Read the last sentence of the first paragraph of the javadoc of HashMap: http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html: *This class makes no guarantees as to the order of the map*
comment on: http://stackoverflow.com/q/25220230

http://stackoverflow.com/a/44655183
has body: for me configuration working in chrome, firefox and explorer : Play Framework CORS Headers
type: Answer
answers question: http://stackoverflow.com/q/25152277
score: 0

http://stackoverflow.com/q/25188249
tagged with: lexicographic
favorite count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has body: I am trying to write a program that takes in a 'word' from the user and prints out its lexicographic rank among all of its permutations. I have the functions for getting the rank and the calculating factorials (iteratively for complexity reasons) but I need a main method to test the program and make it runnable. Here's what I have so far: EDIT: I am trying to convert this C program that does the above correctly into Java. I have run into troubles mostly with the increase and update Count functions getting the error: The type of expression must be an array type but i resolved to int/String. package ranking; public class Ranking { public static void increaseCount (int count, String str) { int i; for (i=0; str[i]; i++) count[str[i]]++; for (i=1; i &lt; 256; i++) count[i] += count[i-1]; } public static void updateCount (int count, String ch){ int i; for (i=ch; i &lt; 256; i++) count[i]--; } public static int findRank (String str) { int length = str.length(); int mul = fact(length); int rank = 1, i; int count[256] = {0}; increaseCount(count, str); for (i=0; i &lt; length; i++) { mul/= length - i; rank += count [ str[i] - 1] * mul; updateCount(count, str[i];) } return rank; } public static int factorial (int n){ int fact = 1; if (n ==0 || n==1) { return 1; } else { for (int i=1; i&lt;=n; i++){ fact *= i; } } return fact; } public static void main (String[] args){ String str = "string"; System.out.print(findRank(str)); } }
linked to: http://stackoverflow.com/q/2000048
tagged with: ranking
has comment: http://stackoverflow.com/comment/39222257
score: 0
has answer: http://stackoverflow.com/a/25188367
has title: Lexicographic rank of a string Java
upvote count: 1
answer count: 1
downvote count: 1
tagged with: permutation

http://stackoverflow.com/a/25216754
has comment: http://stackoverflow.com/comment/39298139
score: 1
has comment: http://stackoverflow.com/comment/39297889
has comment: http://stackoverflow.com/comment/39297550
has comment: http://stackoverflow.com/comment/39297422
upvote count: 1
answers question: http://stackoverflow.com/q/25200764
has comment: http://stackoverflow.com/comment/39295838
type: Answer
has comment: http://stackoverflow.com/comment/39297317
has comment: http://stackoverflow.com/comment/39299217
has comment: http://stackoverflow.com/comment/39298344
downvote count: 0
has body: I think this is "works as designed". I tried this once with a global document, which imports documents and display them as is... as long as paragraph styles have different names ! Using same named templates are overwritten with the values the "master" document have. So I ended up cloning standard styles with unique (per document) names. HTH

http://stackoverflow.com/a/25105697
answers question: http://stackoverflow.com/q/25105268
has body: make sure you set variables/call methods after calling super.onCreate(). You most probably haven't set the contentview if you are trying to interact with the view.
score: 0
type: Answer